[PATCH 3/3] block: make sure writesame bio is aligned with logical block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Obviously the created writesame bio has to be aligned with logical block
size.

Fixes: b49a0871be31a745b2ef ("block: remove split code in blkdev_issue_{discard,write_same}")
Cc: Rui Salvaterra <rsalvaterra@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Xiao Ni <xni@xxxxxxxxxx>
Cc: Mariusz Dabrowski <mariusz.dabrowski@xxxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 block/blk-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index 93011785f710..1750f0e480c0 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 = (UINT_MAX >> 9) & ~bs_mask;
 
 	while (nr_sects) {
 		bio = next_bio(bio, 1, gfp_mask);
-- 
2.9.5




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux