Skip to content
Snippets Groups Projects
  1. Nov 19, 2021
  2. Nov 05, 2021
    • Jens Axboe's avatar
      block: move queue enter logic into blk_mq_submit_bio() · 900e0807
      Jens Axboe authored
      
      Retain the old logic for the fops based submit, but for our internal
      blk_mq_submit_bio(), move the queue entering logic into the core
      function itself.
      
      We need to be a bit careful if going into the scheduler, as a scheduler
      or queue mappings can arbitrarily change before we have entered the queue.
      Have the bio scheduler mapping do that separately, it's a very cheap
      operation compared to actually doing merging locking and lookups.
      
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      [axboe: update to check merge post submit_bio_checks() doing remap...]
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      900e0807
  3. Nov 04, 2021
  4. Oct 27, 2021
    • Damien Le Moal's avatar
      block: Add independent access ranges support · a2247f19
      Damien Le Moal authored
      
      The Concurrent Positioning Ranges VPD page (for SCSI) and data log page
      (for ATA) contain parameters describing the set of contiguous LBAs that
      can be served independently by a single LUN multi-actuator hard-disk.
      Similarly, a logically defined block device composed of multiple disks
      can in some cases execute requests directed at different sector ranges
      in parallel. A dm-linear device aggregating 2 block devices together is
      an example.
      
      This patch implements support for exposing a block device independent
      access ranges to the user through sysfs to allow optimizing device
      accesses to increase performance.
      
      To describe the set of independent sector ranges of a device (actuators
      of a multi-actuator HDDs or table entries of a dm-linear device),
      The type struct blk_independent_access_ranges is introduced. This
      structure describes the sector ranges using an array of
      struct blk_independent_access_range structures. This range structure
      defines the start sector and number of sectors of the access range.
      The ranges in the array cannot overlap and must contain all sectors
      within the device capacity.
      
      The function disk_set_independent_access_ranges() allows a device
      driver to signal to the block layer that a device has multiple
      independent access ranges.  In this case, a struct
      blk_independent_access_ranges is attached to the device request queue
      by the function disk_set_independent_access_ranges(). The function
      disk_alloc_independent_access_ranges() is provided for drivers to
      allocate this structure.
      
      struct blk_independent_access_ranges contains kobjects (struct kobject)
      to expose to the user through sysfs the set of independent access ranges
      supported by a device. When the device is initialized, sysfs
      registration of the ranges information is done from blk_register_queue()
      using the block layer internal function
      disk_register_independent_access_ranges(). If a driver calls
      disk_set_independent_access_ranges() for a registered queue, e.g. when a
      device is revalidated, disk_set_independent_access_ranges() will execute
      disk_register_independent_access_ranges() to update the sysfs attribute
      files.  The sysfs file structure created starts from the
      independent_access_ranges sub-directory and contains the start sector
      and number of sectors of each range, with the information for each range
      grouped in numbered sub-directories.
      
      E.g. for a dual actuator HDD, the user sees:
      
      $ tree /sys/block/sdk/queue/independent_access_ranges/
      /sys/block/sdk/queue/independent_access_ranges/
      |-- 0
      |   |-- nr_sectors
      |   `-- sector
      `-- 1
          |-- nr_sectors
          `-- sector
      
      For a regular device with a single access range, the
      independent_access_ranges sysfs directory does not exist.
      
      Device revalidation may lead to changes to this structure and to the
      attribute values. When manipulated, the queue sysfs_lock and
      sysfs_dir_lock mutexes are held for atomicity, similarly to how the
      blk-mq and elevator sysfs queue sub-directories are protected.
      
      The code related to the management of independent access ranges is
      added in the new file block/blk-ia-ranges.c.
      
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Link: https://lore.kernel.org/r/20211027022223.183838-2-damien.lemoal@wdc.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a2247f19
  5. Oct 19, 2021
  6. Oct 18, 2021
  7. Oct 16, 2021
  8. Sep 07, 2021
  9. Aug 23, 2021
  10. Aug 18, 2021
    • Ming Lei's avatar
      blk-mq: fix is_flush_rq · a9ed27a7
      Ming Lei authored
      
      is_flush_rq() is called from bt_iter()/bt_tags_iter(), and runs the
      following check:
      
      	hctx->fq->flush_rq == req
      
      but the passed hctx from bt_iter()/bt_tags_iter() may be NULL because:
      
      1) memory re-order in blk_mq_rq_ctx_init():
      
      	rq->mq_hctx = data->hctx;
      	...
      	refcount_set(&rq->ref, 1);
      
      OR
      
      2) tag re-use and ->rqs[] isn't updated with new request.
      
      Fix the issue by re-writing is_flush_rq() as:
      
      	return rq->end_io == flush_end_io;
      
      which turns out simpler to follow and immune to data race since we have
      ordered WRITE rq->end_io and refcount_set(&rq->ref, 1).
      
      Fixes: 2e315dc0 ("blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter")
      Cc: "Blank-Burian, Markus, Dr." <blankburian@uni-muenster.de>
      Cc: Yufen Yu <yuyufen@huawei.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20210818010925.607383-1-ming.lei@redhat.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a9ed27a7
  11. Aug 15, 2021
  12. Aug 12, 2021
  13. Aug 02, 2021
  14. Jun 25, 2021
    • Jan Kara's avatar
      blk: Fix lock inversion between ioc lock and bfqd lock · fd2ef39c
      Jan Kara authored
      
      Lockdep complains about lock inversion between ioc->lock and bfqd->lock:
      
      bfqd -> ioc:
       put_io_context+0x33/0x90 -> ioc->lock grabbed
       blk_mq_free_request+0x51/0x140
       blk_put_request+0xe/0x10
       blk_attempt_req_merge+0x1d/0x30
       elv_attempt_insert_merge+0x56/0xa0
       blk_mq_sched_try_insert_merge+0x4b/0x60
       bfq_insert_requests+0x9e/0x18c0 -> bfqd->lock grabbed
       blk_mq_sched_insert_requests+0xd6/0x2b0
       blk_mq_flush_plug_list+0x154/0x280
       blk_finish_plug+0x40/0x60
       ext4_writepages+0x696/0x1320
       do_writepages+0x1c/0x80
       __filemap_fdatawrite_range+0xd7/0x120
       sync_file_range+0xac/0xf0
      
      ioc->bfqd:
       bfq_exit_icq+0xa3/0xe0 -> bfqd->lock grabbed
       put_io_context_active+0x78/0xb0 -> ioc->lock grabbed
       exit_io_context+0x48/0x50
       do_exit+0x7e9/0xdd0
       do_group_exit+0x54/0xc0
      
      To avoid this inversion we change blk_mq_sched_try_insert_merge() to not
      free the merged request but rather leave that upto the caller similarly
      to blk_mq_sched_try_merge(). And in bfq_insert_requests() we make sure
      to free all the merged requests after dropping bfqd->lock.
      
      Fixes: aee69d78 ("block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler")
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Acked-by: default avatarPaolo Valente <paolo.valente@linaro.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20210623093634.27879-3-jack@suse.cz
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      fd2ef39c
  15. Jun 24, 2021
  16. Jun 11, 2021
  17. Jun 01, 2021
  18. Apr 08, 2021
  19. Apr 06, 2021
  20. Feb 10, 2021
  21. Feb 08, 2021
Loading