Linux RAID subsystem development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Jonathan Brassow <jbrassow@redhat.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH] DM RAID: Explicitly turn off bad block support
Date: Mon, 22 Apr 2013 10:52:28 +1000	[thread overview]
Message-ID: <20130422105228.3948c69f@notabene.brown> (raw)
In-Reply-To: <1366378224.14427.1.camel@f16>

[-- Attachment #1: Type: text/plain, Size: 2399 bytes --]

On Fri, 19 Apr 2013 08:30:24 -0500 Jonathan Brassow <jbrassow@redhat.com>
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@redhat.com>
> 
> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2013-04-22  0:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 13:30 [PATCH] DM RAID: Explicitly turn off bad block support Jonathan Brassow
2013-04-22  0:52 ` NeilBrown [this message]
2013-04-22 16:29   ` Brassow Jonathan
2013-04-23  0:05     ` NeilBrown
2013-04-24  3:48       ` Brassow Jonathan
2013-04-24  6:24         ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130422105228.3948c69f@notabene.brown \
    --to=neilb@suse.de \
    --cc=jbrassow@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox