]> Git Repo - linux.git/commitdiff
block: make sure writesame bio is aligned with logical block size
authorMing Lei <[email protected]>
Mon, 29 Oct 2018 12:57:19 +0000 (20:57 +0800)
committerJens Axboe <[email protected]>
Fri, 9 Nov 2018 13:23:18 +0000 (06:23 -0700)
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]>
block/blk-lib.c

index d58d5d87dd8870f02b9c8785a7dab9fcca966713..e8b3bb9bf37595acea4ec434b3664f8ad6a8c2b8 100644 (file)
@@ -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);
This page took 0.052563 seconds and 4 git commands to generate.