linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "Czarnowska, Anna" <anna.czarnowska@intel.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	"Labun, Marcin" <Marcin.Labun@intel.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"Ciechanowski, Ed" <ed.ciechanowski@intel.com>,
	"Grabowski, Grzegorz" <grzegorz.grabowski@intel.com>
Subject: Re: [PATCH 5/9] imsm: fix reserved sectors for spares
Date: Wed, 21 Sep 2011 14:45:23 +1000	[thread overview]
Message-ID: <20110921144523.481205c6@notabene.brown> (raw)
In-Reply-To: <3F8F31A3BFD1664EAB894D1BD6AF32B9024C2A@IRSMSX102.ger.corp.intel.com>

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

On Mon, 19 Sep 2011 12:57:48 +0000 "Czarnowska, Anna"
<anna.czarnowska@intel.com> wrote:

> The patch below makes a better decision as to the size of required reservation.

I've applied this, thanks.

NeilBrown


> 
> > -----Original Message-----
> > From: Williams, Dan J [mailto:dan.j.williams@intel.com]
> > Sent: Tuesday, September 06, 2011 10:43 PM
> > To: NeilBrown
> > Cc: linux-raid@vger.kernel.org; Czarnowska, Anna; Labun, Marcin;
> > Ciechanowski, Ed
> > Subject: Re: [PATCH 5/9] imsm: fix reserved sectors for spares
> > 
> > On Mon, Aug 29, 2011 at 7:20 PM, NeilBrown <neilb@suse.de> wrote:
> > >> Anna rightly points out that this could probably be safely made
> > >> bigger.  As it stands this applies to too broad an array of disks.
> >  I
> > >> think a happy medium (until we can nail down the forward
> > compatibility
> > >> of older oroms, v8 in this case) is to detect the case where the
> > disk
> > >> is being activated for rebuild and if it is at least as large as one
> > >> of the existing members truncate the reserved region to the same
> > size
> > >> as the other member.  That way we are at least compatible with
> > >> whatever agent created the array in the first instance.
> > >>
> > >
> > > I think you are saying that I can go ahead and apply this patch, but
> > that it
> > > might get improved upon in the future .... I hope that is right ?
> > 
> > Yes, this may have corrected things too far in the other direction,
> > but is less surprising than what we had before.
> 
> >From bf5c919219d9947a0eba1ce2b450c8f663291f48 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska <anna.czarnowska@intel.com>
> Date: Mon, 19 Sep 2011 13:41:46 +0200
> Subject: [PATCH] Calculate reservation for a spare based on active disks in container
> 
> New function to calculate minimum reservation to expect from a spare
> is introduced.
> 
> The required amount of space at the end of the disk depends on what we
> plan to do with the spare and what array we want to use it in.
> For creating new subarray in an empty container the full reservation of
> MPB_SECTOR_COUNT + IMSM_RESERVED_SECTORS is required.
> 
> For recovery or OLCE on a volume using new metadata format at least
> MPB_SECTOR_CNT + NUM_BLOCKS_DIRTY_STRIPE_REGION is required.
> The additional space for migration optimization included in
> IMSM_RESERVED_SECTORS is not necessary and is not reserved by some oroms.
> 
> MPB_SECTOR_CNT alone is not sufficient as it does not include the
> reservation at the end of subarray.
> 
> However if the real reservation on active disks is smaller than this
> (when the array uses old metadata format) we should use the real value.
> This will allow OLCE and recovery to start on the spare even if the volume
> doesn't have the reservation we normally use for new volumes.
> 
> Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
> ---
>  super-intel.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 54 insertions(+), 2 deletions(-)
> 
> diff --git a/super-intel.c b/super-intel.c
> index f1c924f..8dad03c 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -88,6 +88,7 @@
>  
>  #define MPB_SECTOR_CNT 2210
>  #define IMSM_RESERVED_SECTORS 4096
> +#define NUM_BLOCKS_DIRTY_STRIPE_REGION 2056
>  #define SECT_PER_MB_SHIFT 11
>  
>  /* Disk configuration info. */
> @@ -827,6 +828,8 @@ static int count_memberships(struct dl *dl, struct intel_super *super)
>  	return memberships;
>  }
>  
> +static __u32 imsm_min_reserved_sectors(struct intel_super *super);
> +
>  static struct extent *get_extents(struct intel_super *super, struct dl *dl)
>  {
>  	/* find a list of used extents on the given physical device */
> @@ -840,7 +843,7 @@ static struct extent *get_extents(struct intel_super *super, struct dl *dl)
>  	 * IMSM_RESERVED_SECTORS region
>  	 */
>  	if (dl->index == -1)
> -		reservation = MPB_SECTOR_CNT;
> +		reservation = imsm_min_reserved_sectors(super);
>  	else
>  		reservation = MPB_SECTOR_CNT + IMSM_RESERVED_SECTORS;
>  
> @@ -933,6 +936,51 @@ static int is_failed(struct imsm_disk *disk)
>  	return (disk->status & FAILED_DISK) == FAILED_DISK;
>  }
>  
> +/* try to determine how much space is reserved for metadata from
> + * the last get_extents() entry on the smallest active disk,
> + * otherwise fallback to the default
> + */
> +static __u32 imsm_min_reserved_sectors(struct intel_super *super)
> +{
> +	struct extent *e;
> +	int i;
> +	__u32 min_active, remainder;
> +	__u32 rv = MPB_SECTOR_CNT + IMSM_RESERVED_SECTORS;
> +	struct dl *dl, *dl_min = NULL;
> +
> +	if (!super)
> +		return rv;
> +
> +	min_active = 0;
> +	for (dl = super->disks; dl; dl = dl->next) {
> +		if (dl->index < 0)
> +			continue;
> +		if (dl->disk.total_blocks < min_active || min_active == 0) {
> +			dl_min = dl;
> +			min_active = dl->disk.total_blocks;
> +		}
> +	}
> +	if (!dl_min)
> +		return rv;
> +
> +	/* find last lba used by subarrays on the smallest active disk */
> +	e = get_extents(super, dl_min);
> +	if (!e)
> +		return rv;
> +	for (i = 0; e[i].size; i++)
> +		continue;
> +
> +	remainder = min_active - e[i].start;
> +	free(e);
> +
> +	/* to give priority to recovery we should not require full
> +	   IMSM_RESERVED_SECTORS from the spare */
> +	rv = MPB_SECTOR_CNT + NUM_BLOCKS_DIRTY_STRIPE_REGION;
> +
> +	/* if real reservation is smaller use that value */
> +	return  (remainder < rv) ? remainder : rv;
> +}
> +
>  /* Return minimum size of a spare that can be used in this array*/
>  static unsigned long long min_acceptable_spare_size_imsm(struct supertype *st)
>  {
> @@ -941,6 +989,7 @@ static unsigned long long min_acceptable_spare_size_imsm(struct supertype *st)
>  	struct extent *e;
>  	int i;
>  	unsigned long long rv = 0;
> +	__u32 reservation;
>  
>  	if (!super)
>  		return rv;
> @@ -958,9 +1007,12 @@ static unsigned long long min_acceptable_spare_size_imsm(struct supertype *st)
>  		continue;
>  	if (i > 0)
>  		rv = e[i-1].start + e[i-1].size;
> +	reservation = __le32_to_cpu(dl->disk.total_blocks) - e[i].start;
>  	free(e);
> +
>  	/* add the amount of space needed for metadata */
> -	rv = rv + MPB_SECTOR_CNT + IMSM_RESERVED_SECTORS;
> +	rv = rv + imsm_min_reserved_sectors(super);
> +
>  	return rv * 512;
>  }
>  


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2011-09-21  4:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26  2:13 [PATCH 0/9] recovering an imsm raid5 array Dan Williams
2011-08-26  2:14 ` [PATCH 1/9] imsm: fix max disks per array Dan Williams
2011-08-26  2:14 ` [PATCH 2/9] imsm: fix, stop metadata updates to newly failed devices Dan Williams
2011-08-26  2:14 ` [PATCH 3/9] imsm: fix display spares Dan Williams
2011-08-26  2:14 ` [PATCH 4/9] sysfs: fix sysfs_disk_to_scsi_id Dan Williams
2011-08-26  2:14 ` [PATCH 5/9] imsm: fix reserved sectors for spares Dan Williams
2011-08-26 19:51   ` Williams, Dan J
2011-08-30  2:20     ` NeilBrown
2011-09-06 20:42       ` Williams, Dan J
2011-09-19 12:57         ` Czarnowska, Anna
2011-09-21  4:45           ` NeilBrown [this message]
2011-08-26  2:14 ` [PATCH 6/9] mdmon: fix, close spare activation race Dan Williams
2011-08-26  2:14 ` [PATCH 7/9] imsm: support 'missing' devices at Create Dan Williams
2011-08-30  2:26   ` NeilBrown
2011-08-26  2:14 ` [PATCH 8/9] util: allow regular files through test_partition() Dan Williams
2011-08-26  2:14 ` [PATCH 9/9] mdadm: 'dump' support Dan Williams
2011-08-30  2:58   ` NeilBrown
2011-08-30 10:12     ` Alexander Kühn
2013-05-16  5:11       ` NeilBrown
2011-08-26 11:06 ` [PATCH 0/9] recovering an imsm raid5 array linbloke
2011-08-30  3:13 ` 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=20110921144523.481205c6@notabene.brown \
    --to=neilb@suse.de \
    --cc=Marcin.Labun@intel.com \
    --cc=anna.czarnowska@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=grzegorz.grabowski@intel.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;
as well as URLs for NNTP newsgroup(s).