From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Williams Subject: Re: [PATCH 13/17] Monitor: autorebuild functionality added Date: Thu, 04 Nov 2010 22:58:22 -0700 Message-ID: <4CD39CFE.506@intel.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-raid-owner@vger.kernel.org To: "Czarnowska, Anna" Cc: Neil Brown , "linux-raid@vger.kernel.org" , "Neubauer, Wojciech" , "Ciechanowski, Ed" , "Labun, Marcin" , "Hawrylewicz Czarnowski, Przemyslaw" List-Id: linux-raid.ids On 10/29/2010 7:25 AM, Czarnowska, Anna wrote: > From 43c50f74689943e85913db343b33a0ff24812721 Mon Sep 17 00:00:00 2001 > From: Anna Czarnowska > Date: Thu, 28 Oct 2010 13:20:21 +0200 > Subject: [PATCH 13/17] Monitor: autorebuild functionality added > > After all information on arrays is updated we first move spares > using spare-group information from config file, then link containers with > subarrays and call spare_sharing. Arrays with defined spare-groups > are not considered again. spare_sharing searches for suitable spares > in other arrays and moves them using move_spare to the arrays > that need them. move_spare removes spare from one array/container > and adds to another. If add fails we add back to original container. > Manage_subdevs function is used to perform the spare relocation. > > Signed-off-by: Anna Czarnowska > Signed-off-by: Marcin Labun > --- > Monitor.c | 299 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 294 insertions(+), 5 deletions(-) Looks good, only a couple of future enhancements. A ddf array may be able to fix up a degraded array with free space on another array member. So we may need to ensure that mdmon has had a chance to perform the search before we grab a free spare from another container. > +static struct supertype *get_super(struct state *st) > +{ > + struct supertype *super = NULL; > + char *metadata = NULL; > + int i; > + > + if (is_external(st->metadata_version)) { > + st = st->parent; > + if (!st) > + return NULL; > + metadata = st->metadata_version + strlen("external:"); > + } else { > + metadata = st->metadata_version; > + } > + for (i = 0; !super&& superlist[i]; i++) > + super = superlist[i]->match_metadata_desc(metadata); This looks like an open-coded version_to_superswitch()