All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, wojciech.neubauer@intel.com,
	adam.kwolek@intel.com, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com
Subject: [PATCH 1/6] Limit no-restriping operations only for raid5
Date: Wed, 19 Jan 2011 17:23:08 +0100	[thread overview]
Message-ID: <20110119162308.8738.44079.stgit@gklab-128-111.igk.intel.com> (raw)
In-Reply-To: <20110119161925.8738.85284.stgit@gklab-128-111.igk.intel.com>

If no-restriping needed, we might need to impose some more
changes: layout, raid_disks, chunk_size but only for raid5 arrays.
Move this part of code before operations connected with restriping.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
---
 Grow.c |   81 ++++++++++++++++++++++++++++++++++------------------------------
 1 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/Grow.c b/Grow.c
index e1ec01c..0ce7c17 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1656,6 +1656,49 @@ static int reshape_array(char *container, int cfd, int fd, char *devname,
 	}
 	ping_monitor(container);
 
+	if (reshape.backup_blocks == 0) {
+		/* No restriping needed, but we might need to impose
+		 * some more changes: layout, raid_disks, chunk_size
+		 */
+		/* Changes possible only for raid5 arrays */
+		if (info->array.level != 5) {
+			unfreeze(st);
+			return rv;
+		}
+		if (info->new_layout != UnSet &&
+		    info->new_layout != info->array.layout) {
+			info->array.layout = info->new_layout;
+			if (ioctl(fd, SET_ARRAY_INFO, &info->array) != 0) {
+				fprintf(stderr, Name ": failed to set new layout\n");
+				rv = 1;
+			} else if (!quiet)
+				printf("layout for %s set to %d\n",
+				       devname, info->array.layout);
+		}
+		if (info->delta_disks != UnSet &&
+		    info->delta_disks != 0) {
+			info->array.raid_disks += info->delta_disks;
+			if (ioctl(fd, SET_ARRAY_INFO, &info->array) != 0) {
+				fprintf(stderr, Name ": failed to set raid disks\n");
+				rv = 1;
+			} else if (!quiet)
+				printf("raid_disks for %s set to %d\n",
+				       devname, info->array.raid_disks);
+		}
+		if (info->new_chunk != 0 &&
+		    info->new_chunk != info->array.chunk_size) {
+			if (sysfs_set_num(info, NULL,
+					  "chunk_size", info->new_chunk) != 0) {
+				fprintf(stderr, Name ": failed to set chunk size\n");
+				rv = 1;
+			} else if (!quiet)
+				printf("chunk size for %s set to %d\n",
+				       devname, info->array.chunk_size);
+		}
+		unfreeze(st);
+		return rv;
+	}
+
 	/* reload metadat as it is possible to change made by monitor
 	 */
 	if ((cfd >= 0) &&
@@ -1718,44 +1761,6 @@ static int reshape_array(char *container, int cfd, int fd, char *devname,
 		}
 	}
 
-	if (reshape.backup_blocks == 0) {
-		/* No restriping needed, but we might need to impose
-		 * some more changes: layout, raid_disks, chunk_size
-		 */
-		if (info->new_layout != UnSet &&
-		    info->new_layout != info->array.layout) {
-			info->array.layout = info->new_layout;
-			if (ioctl(fd, SET_ARRAY_INFO, &info->array) != 0) {
-				fprintf(stderr, Name ": failed to set new layout\n");
-				rv = 1;
-			} else if (!quiet)
-				printf("layout for %s set to %d\n",
-				       devname, info->array.layout);
-		}
-		if (info->delta_disks != UnSet &&
-		    info->delta_disks != 0) {
-			info->array.raid_disks += info->delta_disks;
-			if (ioctl(fd, SET_ARRAY_INFO, &info->array) != 0) {
-				fprintf(stderr, Name ": failed to set raid disks\n");
-				rv = 1;
-			} else if (!quiet)
-				printf("raid_disks for %s set to %d\n",
-				       devname, info->array.raid_disks);
-		}
-		if (info->new_chunk != 0 &&
-		    info->new_chunk != info->array.chunk_size) {
-			if (sysfs_set_num(info, NULL,
-					  "chunk_size", info->new_chunk) != 0) {
-				fprintf(stderr, Name ": failed to set chunk size\n");
-				rv = 1;
-			} else if (!quiet)
-				printf("chunk size for %s set to %d\n",
-				       devname, info->array.chunk_size);
-		}
-		unfreeze(st);
-		return rv;
-	}
-
 	/*
 	 * There are three possibilities.
 	 * 1/ The array will shrink.


  reply	other threads:[~2011-01-19 16:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 16:23 [PATCH 0/6] A few fixes connected with raid0<->raid10 takeover Krzysztof Wojcik
2011-01-19 16:23 ` Krzysztof Wojcik [this message]
2011-01-26  1:01   ` [PATCH 1/6] Limit no-restriping operations only for raid5 Neil Brown
2011-01-26 11:56     ` Wojcik, Krzysztof
2011-01-19 16:23 ` [PATCH 2/6] FIX: Ping manager after level change Krzysztof Wojcik
2011-01-19 16:23 ` [PATCH 3/6] Check number of failed disks durig raid10->raid0 takeover Krzysztof Wojcik
2011-01-19 16:23 ` [PATCH 4/6] FIX: Remove disks in mdmon for external metadata Krzysztof Wojcik
2011-01-26  1:04   ` Neil Brown
2011-01-26 13:00     ` Wojcik, Krzysztof
2011-01-19 16:23 ` [PATCH 5/6] FIX: Reset disk state if disk is missing Krzysztof Wojcik
2011-01-19 16:23 ` [PATCH 6/6] FIX: Unblock disk in kernel only if it is blocked Krzysztof Wojcik
2011-01-26  1:06   ` Neil Brown
2011-01-26 14:22     ` Wojcik, Krzysztof

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=20110119162308.8738.44079.stgit@gklab-128-111.igk.intel.com \
    --to=krzysztof.wojcik@intel.com \
    --cc=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.