mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
block: make sure discard bio is aligned with logical block size
Obviously the created discard bio has to be aligned with logical block size. This patch introduces the helper of bio_allowed_max_sectors() for this purpose. Cc: [email protected] Cc: Mike Snitzer <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Xiao Ni <[email protected]> Cc: Mariusz Dabrowski <[email protected]> Fixes:744889b7cb("block: don't deal with discard limit in blkdev_issue_discard()") Fixes:a22c4d7e34("block: re-add discard_granularity and alignment checks") Reported-by: Rui Salvaterra <[email protected]> Tested-by: Rui Salvaterra <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
d39aa49792
commit
1adfc5e413
3 changed files with 13 additions and 3 deletions
|
|
@ -57,8 +57,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
|
|||
|
||||
if (!req_sects)
|
||||
goto fail;
|
||||
if (req_sects > UINT_MAX >> 9)
|
||||
req_sects = UINT_MAX >> 9;
|
||||
req_sects = min(req_sects, bio_allowed_max_sectors(q));
|
||||
|
||||
end_sect = sector + req_sects;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue