md/raid10: round up to bdev_logical_block_size in narrow_write_error.
authorNeilBrown <neilb@suse.de>
Mon, 16 Feb 2015 03:51:54 +0000 (14:51 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 16 Feb 2015 03:51:54 +0000 (14:51 +1100)
RAID10 version of earlier fix for RAID1.  We must never initiate
IO with sizes less that logical_block_size.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid10.c

index b8d76b1fba6457dd722410d8d82d752c67f84bba..a7196c49d15d5265df304ac6c2591ff8e1d1a5f3 100644 (file)
@@ -2572,7 +2572,8 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
        if (rdev->badblocks.shift < 0)
                return 0;
 
-       block_sectors = 1 << rdev->badblocks.shift;
+       block_sectors = roundup(1 << rdev->badblocks.shift,
+                               bdev_logical_block_size(rdev->bdev) >> 9);
        sector = r10_bio->sector;
        sectors = ((r10_bio->sector + block_sectors)
                   & ~(sector_t)(block_sectors - 1))