projects/linux·commit 34ffec60

block: make sure writesame bio is aligned with logical block size

34ffec60 · Ming Lei <[email protected]> · 2018-10-29 20:57:19 +08:00

Obviously the created writesame bio has to be aligned with logical block
size, and use bio_allowed_max_sectors() to retrieve this number.

Cc: [email protected]
Cc: Mike Snitzer <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Xiao Ni <[email protected]>
Cc: Mariusz Dabrowski <[email protected]>
Fixes: b49a0871be31a745b2ef ("block: remove split code in blkdev_issue_{discard,write_same}")
Tested-by: Rui Salvaterra <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Commit
34ffec60b27aa81d04e274e71e4c6ef740f75fc7
Parents
ba5d7385

Changes

1 files changed · +1 −1

FileStatusAddDelContent
block/blk-lib.cmodified+1−1View file

block/blk-lib.c

View file
diff --git a/block/blk-lib.c b/block/blk-lib.c
index d58d5d8..e8b3bb9 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -149,7 +149,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
return -EOPNOTSUPP;
/* Ensure that max_write_same_sectors doesn't overflow bi_size */
- max_write_same_sectors = UINT_MAX >> 9;
+ max_write_same_sectors = bio_allowed_max_sectors(q);
while (nr_sects) {
bio = blk_next_bio(bio, 1, gfp_mask);