linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [md PATCH] md/raid1: round up to bdev_logical_block_size in narrow_write_error
@ 2015-02-12 17:02 Nate Dailey
  2015-02-16  3:54 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Nate Dailey @ 2015-02-12 17:02 UTC (permalink / raw)
  To: linux-raid

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>
---

diff -Nupr a/drivers/md/raid1.c b/drivers/md/raid1.c
--- a/drivers/md/raid1.c        2015-02-10 15:29:02.000000000 -0500
+++ b/drivers/md/raid1.c        2015-02-10 15:29:45.000000000 -0500
@@ -2206,7 +2206,8 @@ static int narrow_write_error(struct r1b
        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))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-16  3:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 17:02 [md PATCH] md/raid1: round up to bdev_logical_block_size in narrow_write_error Nate Dailey
2015-02-16  3:54 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).