On Fri, 19 Apr 2013 08:30:24 -0500 Jonathan Brassow <jbrassow@xxxxxxxxxx> wrote: > DM RAID: Explicitly turn off bad block support > > DM RAID does not currently use the bad block tracking available in > MD. 'badblocks.shift' must be set to '-1' in order to explicitly > tell MD not to perform bad block related functions, like > narrow_write_error(). > > Signed-off-by: Jonathan Brassow <jbrassow@xxxxxxxxxx> > > Index: linux-upstream/drivers/md/dm-raid.c > =================================================================== > --- linux-upstream.orig/drivers/md/dm-raid.c > +++ linux-upstream/drivers/md/dm-raid.c > @@ -170,8 +170,10 @@ static struct raid_set *context_alloc(st > rs->md.delta_disks = 0; > rs->md.recovery_cp = 0; > > - for (i = 0; i < raid_devs; i++) > + for (i = 0; i < raid_devs; i++) { > md_rdev_init(&rs->dev[i].rdev); > + rs->dev[i].rdev.badblocks.shift = -1; /* No bad block support */ > + } > > /* > * Remaining items to be initialized by further RAID params: > Thanks, but I don't think this is the right fix. md_rdev_init really should set shift to -1, because we can only support badblocks if the metadata explicitly supports it. What do you think of this instead? Thanks, NeilBrown diff --git a/drivers/md/md.c b/drivers/md/md.c index 41502cf..2166486 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1567,8 +1567,8 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ sector, count, 1) == 0) return -EINVAL; } - } else if (sb->bblog_offset == 0) - rdev->badblocks.shift = -1; + } else if (sb->bblog_offset != 0) + rdev->badblocks.shift = 0; if (!refdev) { ret = 1; @@ -3227,7 +3227,7 @@ int md_rdev_init(struct md_rdev *rdev) * be used - I wonder if that matters */ rdev->badblocks.count = 0; - rdev->badblocks.shift = 0; + rdev->badblocks.shift = -1; /* disabled until explicitly enabled */ rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL); seqlock_init(&rdev->badblocks.lock); if (rdev->badblocks.page == NULL) @@ -3299,9 +3299,6 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe goto abort_free; } } - if (super_format == -1) - /* hot-add for 0.90, or non-persistent: so no badblocks */ - rdev->badblocks.shift = -1; return rdev;
Attachment:
signature.asc
Description: PGP signature