All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: [PATCH 3/4] imsm: FIX: Add spare disks information to array description
Date: Thu, 10 Feb 2011 14:56:34 +0100	[thread overview]
Message-ID: <20110210135634.9276.67316.stgit@gklab-128-013.igk.intel.com> (raw)
In-Reply-To: <20110210134710.9276.91430.stgit@gklab-128-013.igk.intel.com>

Spares that are specified on container can be used by any array in container.
this means that for every array in container they should be reported.
This let caller know how many spare devices (not used in any array)
are still available.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 super-intel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index fed831d..e06a6f4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4731,11 +4731,19 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 	struct mdinfo *rest = NULL;
 	unsigned int i;
 	int bbm_errors = 0;
+	struct dl *d;
+	int spare_disks = 0;
 
 	/* check for bad blocks */
 	if (imsm_bbm_log_size(super->anchor))
 		bbm_errors = 1;
 
+	/* count spare devices, not used in maps
+	 */
+	for (d = super->disks; d; d = d->next)
+		if (d->index == -1)
+			spare_disks++;
+
 	for (i = 0; i < mpb->num_raid_devs; i++) {
 		struct imsm_dev *dev;
 		struct imsm_map *map;
@@ -4852,6 +4860,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 		}
 		/* now that the disk list is up-to-date fixup recovery_start */
 		update_recovery_start(dev, this);
+		this->array.spare_disks += spare_disks;
 		rest = this;
 	}
 


  parent reply	other threads:[~2011-02-10 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 13:55 [PATCH 0/4] Prepare mdadm for migrations (external meta) Adam Kwolek
2011-02-10 13:56 ` [PATCH 1/4] FIX: delta_disk can have UnSet value Adam Kwolek
2011-02-10 13:56 ` [PATCH 2/4] FIX: Get spares from external metadata Adam Kwolek
2011-02-10 13:56 ` Adam Kwolek [this message]
2011-02-10 13:56 ` [PATCH 4/4] FIX: Add raid5 to raid0 case to analyse_change() Adam Kwolek
2011-02-14  0:17 ` [PATCH 0/4] Prepare mdadm for migrations (external meta) 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=20110210135634.9276.67316.stgit@gklab-128-013.igk.intel.com \
    --to=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=wojciech.neubauer@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.