1. 02 12月, 2020 2 次提交
    • C
      block: remove the nr_sects field in struct hd_struct · a782483c
      Christoph Hellwig 提交于
      Now that the hd_struct always has a block device attached to it, there is
      no need for having two size field that just get out of sync.
      
      Additionally the field in hd_struct did not use proper serialization,
      possibly allowing for torn writes.  By only using the block_device field
      this problem also gets fixed.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Acked-by: Coly Li <colyli@suse.de>			[bcache]
      Acked-by: Chao Yu <yuchao0@huawei.com>			[f2fs]
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      a782483c
    • C
      block: simplify bdev/disk lookup in blkdev_get · 22ae8ce8
      Christoph Hellwig 提交于
      To simplify block device lookup and a few other upcoming areas, make sure
      that we always have a struct block_device available for each disk and
      each partition, and only find existing block devices in bdget.  The only
      downside of this is that each device and partition uses a little more
      memory.  The upside will be that a lot of code can be simplified.
      
      With that all we need to look up the block device is to lookup the inode
      and do a few sanity checks on the gendisk, instead of the separate lookup
      for the gendisk.  For blk-cgroup which wants to access a gendisk without
      opening it, a new blkdev_{get,put}_no_open low-level interface is added
      to replace the previous get_gendisk use.
      
      Note that the change to look up block device directly instead of the two
      step lookup using struct gendisk causes a subtile change in behavior:
      accessing a non-existing partition on an existing block device can now
      cause a call to request_module.  That call is harmless, and in practice
      no recent system will access these nodes as they aren't created by udev
      and static /dev/ setups are unusual.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      22ae8ce8
  2. 06 10月, 2020 1 次提交
  3. 08 9月, 2020 1 次提交
  4. 02 9月, 2020 4 次提交
  5. 01 9月, 2020 2 次提交
  6. 15 7月, 2020 1 次提交
    • M
      block: always remove partitions from blk_drop_partitions() · d0f0f1b4
      Ming Lei 提交于
      In theory, when GENHD_FL_NO_PART_SCAN is set, no partitions can be created
      on one disk. However, ioctl(BLKPG, BLKPG_ADD_PARTITION) doesn't check
      GENHD_FL_NO_PART_SCAN, so partitions still can be added even though
      GENHD_FL_NO_PART_SCAN is set.
      
      So far blk_drop_partitions() only removes partitions when disk_part_scan_enabled()
      return true. This way can make ghost partition on loop device after changing/clearing
      FD in case that PARTSCAN is disabled, such as partitions can be added
      via 'parted' on loop disk even though GENHD_FL_NO_PART_SCAN is set.
      
      Fix this issue by always removing partitions in blk_drop_partitions(), and
      this way is correct because the current code supposes that no partitions
      can be added in case of GENHD_FL_NO_PART_SCAN.
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      d0f0f1b4
  7. 27 5月, 2020 1 次提交
  8. 13 5月, 2020 2 次提交
  9. 01 5月, 2020 1 次提交
  10. 21 4月, 2020 8 次提交
  11. 10 4月, 2020 1 次提交
  12. 08 4月, 2020 1 次提交
  13. 25 3月, 2020 1 次提交
  14. 24 3月, 2020 7 次提交
  15. 27 1月, 2020 1 次提交
  16. 22 11月, 2019 1 次提交
    • K
      block: add iostat counters for flush requests · b6866318
      Konstantin Khlebnikov 提交于
      Requests that triggers flushing volatile writeback cache to disk (barriers)
      have significant effect to overall performance.
      
      Block layer has sophisticated engine for combining several flush requests
      into one. But there is no statistics for actual flushes executed by disk.
      Requests which trigger flushes usually are barriers - zero-size writes.
      
      This patch adds two iostat counters into /sys/class/block/$dev/stat and
      /proc/diskstats - count of completed flush requests and their total time.
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      b6866318
  17. 14 11月, 2019 4 次提交
  18. 13 11月, 2019 1 次提交
    • D
      block: Remove partition support for zoned block devices · 5eac3eb3
      Damien Le Moal 提交于
      No known partitioning tool supports zoned block devices, especially the
      host managed flavor with strong sequential write constraints.
      Furthermore, there are also no known user nor use cases for partitioned
      zoned block devices.
      
      This patch removes partition device creation for zoned block devices,
      which allows simplifying the processing of zone commands for zoned
      block devices. A warning is added if a partition table is found on the
      device.
      
      For report zones operations no zone sector information remapping is
      necessary anymore, simplifying the code. Of note is that remapping of
      zone reports for DM targets is still necessary as done by
      dm_remap_zone_report().
      
      Similarly, remaping of a zone reset bio is not necessary anymore.
      Testing for the applicability of the zone reset all request also becomes
      simpler and only needs to check that the number of sectors of the
      requested zone range is equal to the disk capacity.
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5eac3eb3