Skip to content

Commit 1ea5c40

Browse files
Ming Leigregkh
authored andcommitted
block: make sure writesame bio is aligned with logical block size
commit 34ffec6 upstream. 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: b49a087 ("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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 14657ef commit 1ea5c40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
161161
return -EOPNOTSUPP;
162162

163163
/* Ensure that max_write_same_sectors doesn't overflow bi_size */
164-
max_write_same_sectors = UINT_MAX >> 9;
164+
max_write_same_sectors = bio_allowed_max_sectors(q);
165165

166166
while (nr_sects) {
167167
bio = next_bio(bio, 1, gfp_mask);

0 commit comments

Comments
 (0)