Skip to content

Commit 34ffec6

Browse files
Ming Leiaxboe
authored andcommitted
block: make sure writesame bio is aligned with logical block size
Obviously the created writesame bio has to be aligned with logical block size, and use bio_allowed_max_sectors() to retrieve this number. Cc: stable@vger.kernel.org Cc: Mike Snitzer <snitzer@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Xiao Ni <xni@redhat.com> Cc: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Fixes: b49a087 ("block: remove split code in blkdev_issue_{discard,write_same}") Tested-by: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ba5d738 commit 34ffec6

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
@@ -149,7 +149,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
149149
return -EOPNOTSUPP;
150150

151151
/* Ensure that max_write_same_sectors doesn't overflow bi_size */
152-
max_write_same_sectors = UINT_MAX >> 9;
152+
max_write_same_sectors = bio_allowed_max_sectors(q);
153153

154154
while (nr_sects) {
155155
bio = blk_next_bio(bio, 1, gfp_mask);

0 commit comments

Comments
 (0)