1. 22 8月, 2020 1 次提交
    • K
      block: fix get_max_io_size() · e4b469c6
      Keith Busch 提交于
      A previous commit aligning splits to physical block sizes inadvertently
      modified one return case such that that it now returns 0 length splits
      when the number of sectors doesn't exceed the physical offset. This
      later hits a BUG in bio_split(). Restore the previous working behavior.
      
      Fixes: 9cc5169c ("block: Improve physical block alignment of split bios")
      Reported-by: NEric Deal <eric.deal@wdc.com>
      Signed-off-by: NKeith Busch <kbusch@kernel.org>
      Cc: Bart Van Assche <bvanassche@acm.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      e4b469c6
  2. 17 8月, 2020 1 次提交
  3. 17 7月, 2020 1 次提交
  4. 01 7月, 2020 2 次提交
  5. 26 6月, 2020 1 次提交
    • J
      blktrace: Provide event for request merging · f3bdc62f
      Jan Kara 提交于
      Currently blk-mq does not report any event when two requests get merged
      in the elevator. This then results in difficult to understand sequence
      of events like:
      
      ...
        8,0   34     1579     0.608765271  2718  I  WS 215023504 + 40 [dbench]
        8,0   34     1584     0.609184613  2719  A  WS 215023544 + 56 <- (8,4) 2160568
        8,0   34     1585     0.609184850  2719  Q  WS 215023544 + 56 [dbench]
        8,0   34     1586     0.609188524  2719  G  WS 215023544 + 56 [dbench]
        8,0    3      602     0.609684162   773  D  WS 215023504 + 96 [kworker/3:1H]
        8,0   34     1591     0.609843593     0  C  WS 215023504 + 96 [0]
      
      and you can only guess (after quite some headscratching since the above
      excerpt is intermixed with a lot of other IO) that request 215023544+56
      got merged to request 215023504+40. Provide proper event for request
      merging like we used to do in the legacy block layer.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      f3bdc62f
  6. 27 5月, 2020 2 次提交
  7. 19 5月, 2020 1 次提交
  8. 14 5月, 2020 1 次提交
    • S
      block: Inline encryption support for blk-mq · a892c8d5
      Satya Tangirala 提交于
      We must have some way of letting a storage device driver know what
      encryption context it should use for en/decrypting a request. However,
      it's the upper layers (like the filesystem/fscrypt) that know about and
      manages encryption contexts. As such, when the upper layer submits a bio
      to the block layer, and this bio eventually reaches a device driver with
      support for inline encryption, the device driver will need to have been
      told the encryption context for that bio.
      
      We want to communicate the encryption context from the upper layer to the
      storage device along with the bio, when the bio is submitted to the block
      layer. To do this, we add a struct bio_crypt_ctx to struct bio, which can
      represent an encryption context (note that we can't use the bi_private
      field in struct bio to do this because that field does not function to pass
      information across layers in the storage stack). We also introduce various
      functions to manipulate the bio_crypt_ctx and make the bio/request merging
      logic aware of the bio_crypt_ctx.
      
      We also make changes to blk-mq to make it handle bios with encryption
      contexts. blk-mq can merge many bios into the same request. These bios need
      to have contiguous data unit numbers (the necessary changes to blk-merge
      are also made to ensure this) - as such, it suffices to keep the data unit
      number of just the first bio, since that's all a storage driver needs to
      infer the data unit number to use for each data block in each bio in a
      request. blk-mq keeps track of the encryption context to be used for all
      the bios in a request with the request's rq_crypt_ctx. When the first bio
      is added to an empty request, blk-mq will program the encryption context
      of that bio into the request_queue's keyslot manager, and store the
      returned keyslot in the request's rq_crypt_ctx. All the functions to
      operate on encryption contexts are in blk-crypto.c.
      
      Upper layers only need to call bio_crypt_set_ctx with the encryption key,
      algorithm and data_unit_num; they don't have to worry about getting a
      keyslot for each encryption context, as blk-mq/blk-crypto handles that.
      Blk-crypto also makes it possible for request-based layered devices like
      dm-rq to make use of inline encryption hardware by cloning the
      rq_crypt_ctx and programming a keyslot in the new request_queue when
      necessary.
      
      Note that any user of the block layer can submit bios with an
      encryption context, such as filesystems, device-mapper targets, etc.
      Signed-off-by: NSatya Tangirala <satyat@google.com>
      Reviewed-by: NEric Biggers <ebiggers@google.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      a892c8d5
  9. 29 4月, 2020 1 次提交
  10. 23 4月, 2020 4 次提交
  11. 15 1月, 2020 1 次提交
  12. 30 12月, 2019 1 次提交
    • M
      block: fix splitting segments on boundary masks · 429120f3
      Ming Lei 提交于
      We ran into a problem with a mpt3sas based controller, where we would
      see random (and hard to reproduce) file corruption). The issue seemed
      specific to this controller, but wasn't specific to the file system.
      After a lot of debugging, we find out that it's caused by segments
      spanning a 4G memory boundary. This shouldn't happen, as the default
      setting for segment boundary masks is 4G.
      
      Turns out there are two issues in get_max_segment_size():
      
      1) The default segment boundary mask is bypassed
      
      2) The segment start address isn't taken into account when checking
         segment boundary limit
      
      Fix these two issues by removing the bypass of the segment boundary
      check even if the mask is set to the default value, and taking into
      account the actual start address of the request when checking if a
      segment needs splitting.
      
      Cc: stable@vger.kernel.org # v5.1+
      Reviewed-by: NChris Mason <clm@fb.com>
      Tested-by: NChris Mason <clm@fb.com>
      Fixes: dcebd755 ("block: use bio_for_each_bvec() to compute multi-page bvec count")
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      
      Dropped const on the page pointer, ppc page_to_phys() doesn't mark the
      page as const...
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      429120f3
  13. 22 11月, 2019 1 次提交
  14. 08 11月, 2019 2 次提交
  15. 05 11月, 2019 1 次提交
  16. 05 8月, 2019 5 次提交
  17. 03 7月, 2019 1 次提交
  18. 21 6月, 2019 3 次提交
  19. 24 5月, 2019 3 次提交
  20. 22 4月, 2019 1 次提交
  21. 12 4月, 2019 1 次提交
  22. 09 4月, 2019 1 次提交
    • M
      block: fix build warning in merging bvecs · b21e11c5
      Ming Lei 提交于
      Commit f6970f83 ("block: don't check if adjacent bvecs in one bio can
      be mergeable") changes bvec merge by only considering two bvecs from
      different bios. However, if the former bio doesn't inlcude any io bvec,
      then the following warning may be triggered:
      
       warning: ‘bvec.bv_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      In practice, it shouldn't be triggered.
      
      Fixes it by adding check on former bio, the check shouldn't add any cost
      given 'bio->bi_iter' can be hit in cache.
      Reported-by: NJens Axboe <axboe@kernel.dk>
      Fixes: f6970f83 ("block: don't check if adjacent bvecs in one bio can be mergeable")
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      b21e11c5
  23. 02 4月, 2019 4 次提交