[PATCH 0/5] Grow_continue() prepare for usage in assembly
[PATCH 0/5] Grow_continue() prepare for usage in assembly
am 28.02.2011 16:06:55 von adam.kwolek
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
--
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
[PATCH 1/5] FIX: Spelling error in dprintf output
am 28.02.2011 16:07:03 von adam.kwolek
Signed-off-by: Adam Kwolek
---
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;
}
--
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
[PATCH 2/5] FIX: Pass container name to reshape array for external
am 28.02.2011 16:07:11 von adam.kwolek
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
---
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);
}
--
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
[PATCH 3/5] FIX: Set readonly state in Grow_continue() when necessary
am 28.02.2011 16:07:19 von adam.kwolek
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
---
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;
}
--
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
[PATCH 4/5] FIX: Continue reshape in the background
am 28.02.2011 16:07:27 von adam.kwolek
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
---
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);
}
--
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
[PATCH 5/5] FIX: Do not configure and start, already started reshape
am 28.02.2011 16:07:35 von adam.kwolek
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
---
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
--
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
Re: [PATCH 0/5] Grow_continue() prepare for usage in assembly
am 02.03.2011 01:57:34 von NeilBrown
On Mon, 28 Feb 2011 16:06:55 +0100 Adam Kwolek 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(-)
>
--
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
RE: [PATCH 0/5] Grow_continue() prepare for usage in assembly
am 02.03.2011 08:37:19 von adam.kwolek
> -----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
> 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
--
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
RE: [PATCH 0/5] Grow_continue() prepare for usage in assembly
am 02.03.2011 09:43:58 von adam.kwolek
> -----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
> 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
--
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