All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
	marcin.labun@intel.com
Subject: [PATCH 02/13] imsm: honor orom constraints for auto-layout
Date: Tue, 22 Dec 2009 16:59:29 -0700	[thread overview]
Message-ID: <20091222235929.31628.32471.stgit@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20091222235807.31628.23231.stgit@dwillia2-linux.ch.intel.com>

Factor out the orom checking bits to validate_geometry_imsm_orom() and
share it between validate_geometry_imsm_volume() and the entry path to
reserve_space().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

 super-intel.c |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 6fe5e0d..4372ab4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3421,6 +3421,34 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int
 }
 
 #define pr_vrb(fmt, arg...) (void) (verbose && fprintf(stderr, Name fmt, ##arg))
+static int
+validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
+			    int raiddisks, int chunk, int verbose)
+{
+	if (!is_raid_level_supported(super->orom, level, raiddisks)) {
+		pr_vrb(": platform does not support raid%d with %d disk%s\n",
+			level, raiddisks, raiddisks > 1 ? "s" : "");
+		return 0;
+	}
+	if (super->orom && level != 1 &&
+	    !imsm_orom_has_chunk(super->orom, chunk)) {
+		pr_vrb(": platform does not support a chunk size of: %d\n", chunk);
+		return 0;
+	}
+	if (layout != imsm_level_to_layout(level)) {
+		if (level == 5)
+			pr_vrb(": imsm raid 5 only supports the left-asymmetric layout\n");
+		else if (level == 10)
+			pr_vrb(": imsm raid 10 only supports the n2 layout\n");
+		else
+			pr_vrb(": imsm unknown layout %#x for this raid level %d\n",
+				layout, level);
+		return 0;
+	}
+
+	return 1;
+}
+
 /* validate_geometry_imsm_volume - lifted from validate_geometry_ddf_bvd 
  * FIX ME add ahci details
  */
@@ -3443,26 +3471,8 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
 	if (!super)
 		return 0;
 
-	if (!is_raid_level_supported(super->orom, level, raiddisks)) {
-		pr_vrb(": platform does not support raid%d with %d disk%s\n",
-			level, raiddisks, raiddisks > 1 ? "s" : "");
+	if (!validate_geometry_imsm_orom(super, level, layout, raiddisks, chunk, verbose))
 		return 0;
-	}
-	if (super->orom && level != 1 &&
-	    !imsm_orom_has_chunk(super->orom, chunk)) {
-		pr_vrb(": platform does not support a chunk size of: %d\n", chunk);
-		return 0;
-	}
-	if (layout != imsm_level_to_layout(level)) {
-		if (level == 5)
-			pr_vrb(": imsm raid 5 only supports the left-asymmetric layout\n");
-		else if (level == 10)
-			pr_vrb(": imsm raid 10 only supports the n2 layout\n");
-		else
-			pr_vrb(": imsm unknown layout %#x for this raid level %d\n",
-				layout, level);
-		return 0;
-	}
 
 	if (!dev) {
 		/* General test:  make sure there is space for
@@ -3689,6 +3699,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
 			 * created.  add_to_super and getinfo_super
 			 * detect when autolayout is in progress.
 			 */
+			if (!validate_geometry_imsm_orom(st->sb, level, layout,
+							 raiddisks, chunk,
+							 verbose))
+				return 0;
 			return reserve_space(st, raiddisks, size, chunk, freesize);
 		}
 		return 1;


  parent reply	other threads:[~2009-12-22 23:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 23:59 [mdadm PATCH 00/13] rebuild / resync checkpointing and other external metadata fixes Dan Williams
2009-12-22 23:59 ` [PATCH 01/13] imsm: catch attempt to auto-layout zero-length arrays Dan Williams
2009-12-22 23:59 ` Dan Williams [this message]
2009-12-22 23:59 ` [PATCH 03/13] imsm: fix spare promotion Dan Williams
2009-12-22 23:59 ` [PATCH 04/13] imsm: fix thunderdome segfault Dan Williams
2009-12-22 23:59 ` [PATCH 05/13] util: fix devnum2devname for devnum == 0 Dan Williams
2009-12-22 23:59 ` [PATCH 06/13] imsm: cleanup print_imsm_dev() Dan Williams
2009-12-22 23:59 ` [PATCH 07/13] mdmon: cleanup manage_member() leak Dan Williams
2009-12-23  0:00 ` [PATCH 08/13] mdmon: cleanup resync_start Dan Williams
2009-12-23  0:00 ` [PATCH 10/13] Introduce MaxSector Dan Williams
2009-12-23  0:00 ` [PATCH 11/13] Teach sysfs_add_disk() callers to use ->recovery_start versus 'insync' parameter Dan Williams
2009-12-23  0:00 ` [PATCH 12/13] Support external metadata recovery-resume Dan Williams
2009-12-23  0:00 ` [PATCH 13/13] imsm: add support for checkpointing via 'curr_migr_unit' Dan Williams
2009-12-23  0:13 ` [mdadm PATCH 00/13] rebuild / resync checkpointing and other external metadata fixes Dan Williams
2009-12-30  2:56 ` Neil Brown
2009-12-30  7:19   ` Luca Berra
2009-12-30  7:57     ` Neil Brown

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=20091222235929.31628.32471.stgit@dwillia2-linux.ch.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=marcin.labun@intel.com \
    --cc=neilb@suse.de \
    /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.