提交 ab713cdc 编写于 作者: N Nate Dailey 提交者: NeilBrown

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: NNate Dailey <nate.dailey@stratus.com>
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 53a6ab4d
...@@ -2196,7 +2196,8 @@ static int narrow_write_error(struct r1bio *r1_bio, int i) ...@@ -2196,7 +2196,8 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
if (rdev->badblocks.shift < 0) if (rdev->badblocks.shift < 0)
return 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; sector = r1_bio->sector;
sectors = ((sector + block_sectors) sectors = ((sector + block_sectors)
& ~(sector_t)(block_sectors - 1)) & ~(sector_t)(block_sectors - 1))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册