[PATCH 0/4] Prepare assembled array for reshape (expansion)
[PATCH 0/4] Prepare assembled array for reshape (expansion)
am 23.02.2011 14:51:31 von adam.kwolek
When array with expansion in progress is being assembled, assembled array state is inactive.
If array state would be read-only, 2 things happens:
1. md starts reshape automatically (for externally controlled metadata)
2. mdmon sets array state to active.
This is not correct.
Array should meet the following criteria after assembly to be ready for reshape:
1. array should be in read-only state. Array is assembled with fewer devices
than stripes on array 'begin' requires. To avoid data corruption read-only state
is required until md will be informed about reshape (reshape configuration occures also).
2. mdmon cannot push array in to active state.
For this reason mdmon should be temporary blocked from monitoring this array (freeze).
3. md cannot automatically start reshape when it founds reshape position different to MAX_SECTORS.
For this reason reshape position has to be configured later (reshape_active flag is temporary cleared).
Above points are addressed by patches:
FIX: Block monitor when starting array with reshape in progress
FIX: Prevent reshape auto start during assembly for external metadata
FIX: disks added beyond array should be counted during reshape
The last patch:
TBD: continue reshape after assembling array
shows development direction.
I'm interested in your opinion about it.
In current code Grow_restart() is never called for imsm/external case.
Do you think that putting additional array configuration and Grow_restart() at pointed place is ok?
BR
Adam
---
Adam Kwolek (4):
TBD: continue reshape after assembling array
FIX: Block monitor when starting array with reshape in progress
FIX: Prevent reshape auto start during assembly for external metadata
FIX: disks added beyond array should be counted during reshape
Assemble.c | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 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/4] FIX: disks added beyond array should be counted during
am 23.02.2011 14:51:39 von adam.kwolek
During expansion there is more working disks that array can have.
Disks with set raid_disk (not a spare disk) during reshape should be counted
to allow array state transition to read_only state.
Array reconfiguration to new geometry should be done before reshape will
be started.
Signed-off-by: Adam Kwolek
---
Assemble.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 317be8b..4d41081 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1504,6 +1504,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
{
struct mdinfo *dev, *sra;
int working = 0, preexist = 0;
+ int expansion = 0;
struct map_ent *map = NULL;
sysfs_init(content, mdfd, 0);
@@ -1522,6 +1523,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
working++;
else if (errno == EEXIST)
preexist++;
+ else if (dev->disk.raid_disk >= content->array.raid_disks &&
+ content->reshape_active)
+ expansion++;
if (working == 0) {
close(mdfd);
return 1;/* Nothing new, don't try to start */
@@ -1532,7 +1536,8 @@ int assemble_container_content(struct supertype *st, int mdfd,
content->uuid, chosen_name);
if (runstop > 0 ||
- (working + preexist) >= content->array.working_disks) {
+ (working + preexist + expansion) >=
+ content->array.working_disks) {
int err;
switch(content->array.level) {
@@ -1566,6 +1571,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
chosen_name, working + preexist);
if (preexist)
fprintf(stderr, " (%d new)", working);
+ if (expansion)
+ fprintf(stderr, " ( + %d for expansion)",
+ expansion);
fprintf(stderr, "\n");
}
if (!err)
--
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/4] FIX: Prevent reshape auto start during assembly for
am 23.02.2011 14:51:48 von adam.kwolek
When md starts array and reshape position is set, md continues reshape
automatically. To prevent doing this for external metadata to allow
for later reshape configuration, clear temporary reshape_active flag
this causes that reshape parameters will not be set to array and md
will not start reshape.
Signed-off-by: Adam Kwolek
---
Assemble.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 4d41081..bffbbf0 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1506,15 +1506,18 @@ int assemble_container_content(struct supertype *st, int mdfd,
int working = 0, preexist = 0;
int expansion = 0;
struct map_ent *map = NULL;
+ int reshape_active;
sysfs_init(content, mdfd, 0);
-
+ reshape_active = content->reshape_active;
+ content->reshape_active = 0;
sra = sysfs_read(mdfd, 0, GET_VERSION);
if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0)
if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
close(mdfd);
return 1;
}
+ content->reshape_active = reshape_active;
if (sra)
sysfs_free(sra);
--
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/4] FIX: Block monitor when starting array with reshape in
am 23.02.2011 14:51:56 von adam.kwolek
To allow for array reconfiguration, mdmon cannot push array in to active
state. Assemble should block monitor for external metadata to allow
for reshape configuration and restart.
Signed-off-by: Adam Kwolek
---
Assemble.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index bffbbf0..bdbe50a 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1518,6 +1518,12 @@ int assemble_container_content(struct supertype *st, int mdfd,
return 1;
}
content->reshape_active = reshape_active;
+ if (content->reshape_active) {
+ char buf[64];
+ sprintf(buf, "external:%s\n", content->text_version);
+ buf[9] = '-';
+ sysfs_set_str(sra, NULL, "metadata_version", buf);
+ }
if (sra)
sysfs_free(sra);
--
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/4] TBD: continue reshape after assembling array
am 23.02.2011 14:52:04 von adam.kwolek
Shows direction of next patches for reshape continuation
when array is assembled.
Signed-off-by: Adam Kwolek
---
Assemble.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index bdbe50a..0aafdaf 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -696,8 +696,15 @@ int Assemble(struct supertype *st, char *mddev,
#ifndef MDASSEMBLE
if (content != &info) {
/* This is a member of a container. Try starting the array. */
- return assemble_container_content(st, mdfd, content, runstop,
- chosen_name, verbose);
+ int rv = assemble_container_content(st, mdfd, content, runstop,
+ chosen_name, verbose);
+ dprintf(Name ": assemble_container_content() "
+ "returns status = %i\n", rv);
+ if (rv || content->reshape_active == 0)
+ return rv;
+ dprintf(Name ": Continue reshape after assemblation ...\n");
+ /* tbd: call Grow_restart() here */
+ return rv;
}
#endif
/* Ok, no bad inconsistancy, we can try updating etc */
--
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