summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNate Dailey <nate.dailey@stratus.com>2015-02-12 18:02:09 +0100
committerNeilBrown <neilb@suse.de>2015-02-16 04:49:26 +0100
commitab713cdc6f70da62c254c4acf77a0cfcda87b7f5 (patch)
treeec235d733d5b52006e31343e79acede6c2578f8b /drivers/md/raid1.c
parentmd/raid10: fix conversion from RAID0 to RAID10 (diff)
downloadlinux-ab713cdc6f70da62c254c4acf77a0cfcda87b7f5.tar.xz
linux-ab713cdc6f70da62c254c4acf77a0cfcda87b7f5.zip
md/raid1: round up to bdev_logical_block_size in narrow_write_error
This modifies raid1's narrow_write_error to round up block_sectors to the device's logical block size. This prevents sd complaining about "Bad block number requested" for non-512-byte sector disks. Signed-off-by: Nate Dailey <nate.dailey@stratus.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5dd0c2e59ab9..4153da5d4011 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2196,7 +2196,8 @@ static int narrow_write_error(struct r1bio *r1_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 = r1_bio->sector;
sectors = ((sector + block_sectors)
& ~(sector_t)(block_sectors - 1))