linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Grow_continue() prepare for usage in assembly
@ 2011-02-28 15:06 Adam Kwolek
  2011-02-28 15:07 ` [PATCH 1/5] FIX: Spelling error in dprintf output Adam Kwolek
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:06 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

This is first part of reshape continuation. This patch series makes (mainly) some changes to Grow_continue()
for use for reshape continuation during array assembling.

It runs reshape_array() in background (for container operation it should be also ok, as we can have only one
metadata marked for reshape at the time).
For external metadata reshape_array requires container name parameter.

For reshape invoked from assembly reshape_array cannot start reshape (this would push md to call i.e. start_reshape
vector from personality). Staring reshape is based on run() mechanism in md so reshape_array should not configure or start reshape.
It should monitor check-pointing only.


BR
Adam


---

Adam Kwolek (5):
      FIX: Do not configure and start, already started reshape
      FIX: Continue reshape in the background
      FIX: Set readonly state in Grow_continue() when necessary
      FIX: Pass container name to reshape array for external meta data
      FIX: Spelling error in dprintf output


 Grow.c |   53 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 13 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] FIX: Spelling error in dprintf output
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
@ 2011-02-28 15:07 ` Adam Kwolek
  2011-02-28 15:07 ` [PATCH 2/5] FIX: Pass container name to reshape array for external meta data Adam Kwolek
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

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

 Grow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Grow.c b/Grow.c
index 424d489..e4fa196 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1648,7 +1648,7 @@ static int reshape_array(char *container, int fd, char *devname,
 		goto release;
 	}
 	if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
-		dprintf("Canot get array information.\n");
+		dprintf("Cannot get array information.\n");
 		goto release;
 	}
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] FIX: Pass container name to reshape array for external meta data
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
  2011-02-28 15:07 ` [PATCH 1/5] FIX: Spelling error in dprintf output Adam Kwolek
@ 2011-02-28 15:07 ` Adam Kwolek
  2011-02-28 15:07 ` [PATCH 3/5] FIX: Set readonly state in Grow_continue() when necessary Adam Kwolek
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

When calling reshape_array() for external metadata 'container name'
parameter have to be passed.
Find and pass container name in external metadata case.

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

 Grow.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Grow.c b/Grow.c
index e4fa196..cb52cc5 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3323,10 +3323,18 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
 int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
 		  char *backup_file)
 {
+	char buf[40];
+	char *container = NULL;
 	int err = sysfs_set_str(info, NULL, "array_state", "readonly");
 	if (err)
 		return err;
-	return reshape_array(NULL, mdfd, "array", st, info, 1, backup_file, 0, 0, 1);
+
+	if (st->ss->external) {
+		fmt_devname(buf, st->container_dev);
+		container = buf;
+	}
+	return reshape_array(container, mdfd, "array", st, info, 1,
+			     backup_file, 0, 0, 1);
 }
 
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] FIX: Set readonly state in Grow_continue() when necessary
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
  2011-02-28 15:07 ` [PATCH 1/5] FIX: Spelling error in dprintf output Adam Kwolek
  2011-02-28 15:07 ` [PATCH 2/5] FIX: Pass container name to reshape array for external meta data Adam Kwolek
@ 2011-02-28 15:07 ` Adam Kwolek
  2011-02-28 15:07 ` [PATCH 4/5] FIX: Continue reshape in the background Adam Kwolek
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

When assembling array using assemble_container_content() for external
metadata case, array is in 'readonly' state already.
There is not necessary to duplicate this operation.

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

 Grow.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Grow.c b/Grow.c
index cb52cc5..e321a39 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3325,11 +3325,13 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
 {
 	char buf[40];
 	char *container = NULL;
-	int err = sysfs_set_str(info, NULL, "array_state", "readonly");
-	if (err)
-		return err;
+	int err;
 
-	if (st->ss->external) {
+	if (!st->ss->external) {
+		err = sysfs_set_str(info, NULL, "array_state", "readonly");
+		if (err)
+			return err;
+	} else {
 		fmt_devname(buf, st->container_dev);
 		container = buf;
 	}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] FIX: Continue reshape in the background
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
                   ` (2 preceding siblings ...)
  2011-02-28 15:07 ` [PATCH 3/5] FIX: Set readonly state in Grow_continue() when necessary Adam Kwolek
@ 2011-02-28 15:07 ` Adam Kwolek
  2011-02-28 15:07 ` [PATCH 5/5] FIX: Do not configure and start, already started reshape Adam Kwolek
  2011-03-02  0:57 ` [PATCH 0/5] Grow_continue() prepare for usage in assembly NeilBrown
  5 siblings, 0 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

For external metadada, reshape will be continue in the background.
It is possible that background array reshape should be used for native
metadata also.

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

 Grow.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Grow.c b/Grow.c
index e321a39..a5041de 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3334,7 +3334,19 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
 	} else {
 		fmt_devname(buf, st->container_dev);
 		container = buf;
+		switch (fork()) {
+		case -1:
+			fprintf(stderr, Name ": Cannot run child to "
+				"monitor reshape: %s\n", strerror(errno));
+			return 1;
+		default:
+			return 0;
+		case 0:
+			dprintf(Name ": Continue bacground reshape "
+				"after assemblation\n");
+		}
 	}
+
 	return reshape_array(container, mdfd, "array", st, info, 1,
 			     backup_file, 0, 0, 1);
 }


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] FIX: Do not configure and start, already started reshape
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
                   ` (3 preceding siblings ...)
  2011-02-28 15:07 ` [PATCH 4/5] FIX: Continue reshape in the background Adam Kwolek
@ 2011-02-28 15:07 ` Adam Kwolek
  2011-03-02  0:57 ` [PATCH 0/5] Grow_continue() prepare for usage in assembly NeilBrown
  5 siblings, 0 replies; 9+ messages in thread
From: Adam Kwolek @ 2011-02-28 15:07 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

When Grow_continue() calls reshape_array(), reshape is configured
and it is started with array together.
We cannot start it again.

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

 Grow.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Grow.c b/Grow.c
index a5041de..47b8809 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1965,7 +1965,7 @@ started:
 		 * metadata, and for kernels before 2.6.38 we can
 		 * fail if we try.
 		 */
-	} else {
+	} else if (!restart) {
 		/* set them all just in case some old 'new_*' value
 		 * persists from some earlier problem.
 		 * We even set them when restarting in the middle.  They will
@@ -1995,13 +1995,18 @@ started:
 		}
 	}
 
-	err = start_reshape(sra, (info->reshape_active && !st->ss->external));
-	if (err) {
-		fprintf(stderr, Name ": Cannot start reshape for %s\n",
-			devname);
-		goto release;
-	}
-	if (restart)
+	/* if reshape is already started,
+	 * there is no need to do this again
+	 */
+	if (!restart) {
+		err = start_reshape(sra,
+				   (info->reshape_active && !st->ss->external));
+		if (err) {
+			fprintf(stderr, Name ": Cannot start reshape for %s\n",
+				devname);
+			goto release;
+		}
+	} else
 		sysfs_set_str(sra, NULL, "array_state", "active");
 
 	/* Now we just need to kick off the reshape and watch, while


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] Grow_continue() prepare for usage in assembly
  2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
                   ` (4 preceding siblings ...)
  2011-02-28 15:07 ` [PATCH 5/5] FIX: Do not configure and start, already started reshape Adam Kwolek
@ 2011-03-02  0:57 ` NeilBrown
  2011-03-02  7:37   ` Kwolek, Adam
  2011-03-02  8:43   ` Kwolek, Adam
  5 siblings, 2 replies; 9+ messages in thread
From: NeilBrown @ 2011-03-02  0:57 UTC (permalink / raw)
  To: Adam Kwolek
  Cc: linux-raid, dan.j.williams, ed.ciechanowski, wojciech.neubauer

On Mon, 28 Feb 2011 16:06:55 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> This is first part of reshape continuation. This patch series makes (mainly) some changes to Grow_continue()
> for use for reshape continuation during array assembling.
> 
> It runs reshape_array() in background (for container operation it should be also ok, as we can have only one
> metadata marked for reshape at the time).

This is the 4th patch I assume...
That fork should not be needed.  We pass '0' as the 'forked' parameter to
'reshape_array', so reshape_array will fork and continue in the background.
Why does Grow_continue need to fork as well??


> For external metadata reshape_array requires container name parameter.

Yep.

> 
> For reshape invoked from assembly reshape_array cannot start reshape (this would push md to call i.e. start_reshape
> vector from personality). Staring reshape is based on run() mechanism in md so reshape_array should not configure or start reshape.

I think you just need to change the call:
-       err = start_reshape(sra, (info->reshape_active && !st->ss->external));

to

+       err = start_reshape(sra, info->reshape_active);

to fix that, don't you?


> It should monitor check-pointing only.
> 
> 
> BR
> Adam
> 
> 
> ---
> 
> Adam Kwolek (5):
>       FIX: Do not configure and start, already started reshape
>       FIX: Continue reshape in the background

The above 2 I have not applied.

>       FIX: Set readonly state in Grow_continue() when necessary
>       FIX: Pass container name to reshape array for external meta data
>       FIX: Spelling error in dprintf output

There 3 I have applied.

Thanks,
NeilBrown

> 
> 
>  Grow.c |   53 ++++++++++++++++++++++++++++++++++++++++-------------
>  1 files changed, 40 insertions(+), 13 deletions(-)
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/5] Grow_continue() prepare for usage in assembly
  2011-03-02  0:57 ` [PATCH 0/5] Grow_continue() prepare for usage in assembly NeilBrown
@ 2011-03-02  7:37   ` Kwolek, Adam
  2011-03-02  8:43   ` Kwolek, Adam
  1 sibling, 0 replies; 9+ messages in thread
From: Kwolek, Adam @ 2011-03-02  7:37 UTC (permalink / raw)
  To: NeilBrown
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech



> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of NeilBrown
> Sent: Wednesday, March 02, 2011 1:58 AM
> To: Kwolek, Adam
> Cc: linux-raid@vger.kernel.org; Williams, Dan J; Ciechanowski, Ed;
> Neubauer, Wojciech
> Subject: Re: [PATCH 0/5] Grow_continue() prepare for usage in assembly
> 
> On Mon, 28 Feb 2011 16:06:55 +0100 Adam Kwolek <adam.kwolek@intel.com>
> wrote:
> 
> > This is first part of reshape continuation. This patch series makes
> (mainly) some changes to Grow_continue()
> > for use for reshape continuation during array assembling.
> >
> > It runs reshape_array() in background (for container operation it
> should be also ok, as we can have only one
> > metadata marked for reshape at the time).
> 
> This is the 4th patch I assume...
> That fork should not be needed.  We pass '0' as the 'forked' parameter
> to


fork() is required to support container operation, before calling reshape_array()
Grow_continue() has to have place (forked) to wait for its turn (or exit for not container operation).

Fork flag passed to reshape array, I've corrected in second series.


> 'reshape_array', so reshape_array will fork and continue in the
> background.
> Why does Grow_continue need to fork as well??
> 
> 
> > For external metadata reshape_array requires container name parameter.
> 
> Yep.
> 
> >
> > For reshape invoked from assembly reshape_array cannot start reshape
> (this would push md to call i.e. start_reshape
> > vector from personality). Staring reshape is based on run() mechanism
> in md so reshape_array should not configure or start reshape.
> 
> I think you just need to change the call:
> -       err = start_reshape(sra, (info->reshape_active && !st->ss-
> >external));
> 
> to
> 
> +       err = start_reshape(sra, info->reshape_active);
> 
> to fix that, don't you?

I'll check if this will be enough. Thank.

BR
Adam

> 
> 
> > It should monitor check-pointing only.
> >
> >
> > BR
> > Adam
> >
> >
> > ---
> >
> > Adam Kwolek (5):
> >       FIX: Do not configure and start, already started reshape
> >       FIX: Continue reshape in the background
> 
> The above 2 I have not applied.
> 
> >       FIX: Set readonly state in Grow_continue() when necessary
> >       FIX: Pass container name to reshape array for external meta data
> >       FIX: Spelling error in dprintf output
> 
> There 3 I have applied.
> 
> Thanks,
> NeilBrown
> 
> >
> >
> >  Grow.c |   53 ++++++++++++++++++++++++++++++++++++++++-------------
> >  1 files changed, 40 insertions(+), 13 deletions(-)
> >
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/5] Grow_continue() prepare for usage in assembly
  2011-03-02  0:57 ` [PATCH 0/5] Grow_continue() prepare for usage in assembly NeilBrown
  2011-03-02  7:37   ` Kwolek, Adam
@ 2011-03-02  8:43   ` Kwolek, Adam
  1 sibling, 0 replies; 9+ messages in thread
From: Kwolek, Adam @ 2011-03-02  8:43 UTC (permalink / raw)
  To: NeilBrown
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech



> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of NeilBrown
> Sent: Wednesday, March 02, 2011 1:58 AM
> To: Kwolek, Adam
> Cc: linux-raid@vger.kernel.org; Williams, Dan J; Ciechanowski, Ed;
> Neubauer, Wojciech
> Subject: Re: [PATCH 0/5] Grow_continue() prepare for usage in assembly
> 
> On Mon, 28 Feb 2011 16:06:55 +0100 Adam Kwolek <adam.kwolek@intel.com>
> wrote:
> 
> > This is first part of reshape continuation. This patch series makes
> (mainly) some changes to Grow_continue()
> > for use for reshape continuation during array assembling.
> >
> > It runs reshape_array() in background (for container operation it
> should be also ok, as we can have only one
> > metadata marked for reshape at the time).
> 
> This is the 4th patch I assume...
> That fork should not be needed.  We pass '0' as the 'forked' parameter
> to
> 'reshape_array', so reshape_array will fork and continue in the
> background.
> Why does Grow_continue need to fork as well??
> 
> 
> > For external metadata reshape_array requires container name parameter.
> 
> Yep.
> 
> >
> > For reshape invoked from assembly reshape_array cannot start reshape
> (this would push md to call i.e. start_reshape
> > vector from personality). Staring reshape is based on run() mechanism
> in md so reshape_array should not configure or start reshape.
> 
> I think you just need to change the call:
> -       err = start_reshape(sra, (info->reshape_active && !st->ss-
> >external));
> 
> to
> 
> +       err = start_reshape(sra, info->reshape_active);
> 
> to fix that, don't you?


For regular reshape start (not restart from checkpoint) info->reshape_active is set also.
This flag is set to 1 for reshape start and continuation, based on this flag.
I think that using flags in this call, change can look like this:

+       err = start_reshape(sra, (info->reshape_active && !st->ss->external && !restart));

... and yes, this looks better ;)
This fix can be correct if restart flag has meaning "monitor only".

BR
Adam



> 
> 
> > It should monitor check-pointing only.
> >
> >
> > BR
> > Adam
> >
> >
> > ---
> >
> > Adam Kwolek (5):
> >       FIX: Do not configure and start, already started reshape
> >       FIX: Continue reshape in the background
> 
> The above 2 I have not applied.
> 
> >       FIX: Set readonly state in Grow_continue() when necessary
> >       FIX: Pass container name to reshape array for external meta data
> >       FIX: Spelling error in dprintf output
> 
> There 3 I have applied.
> 
> Thanks,
> NeilBrown
> 
> >
> >
> >  Grow.c |   53 ++++++++++++++++++++++++++++++++++++++++-------------
> >  1 files changed, 40 insertions(+), 13 deletions(-)
> >
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-02  8:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 15:06 [PATCH 0/5] Grow_continue() prepare for usage in assembly Adam Kwolek
2011-02-28 15:07 ` [PATCH 1/5] FIX: Spelling error in dprintf output Adam Kwolek
2011-02-28 15:07 ` [PATCH 2/5] FIX: Pass container name to reshape array for external meta data Adam Kwolek
2011-02-28 15:07 ` [PATCH 3/5] FIX: Set readonly state in Grow_continue() when necessary Adam Kwolek
2011-02-28 15:07 ` [PATCH 4/5] FIX: Continue reshape in the background Adam Kwolek
2011-02-28 15:07 ` [PATCH 5/5] FIX: Do not configure and start, already started reshape Adam Kwolek
2011-03-02  0:57 ` [PATCH 0/5] Grow_continue() prepare for usage in assembly NeilBrown
2011-03-02  7:37   ` Kwolek, Adam
2011-03-02  8:43   ` Kwolek, Adam

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).