diff options
author | Adam Kwolek <adam.kwolek@intel.com> | 2011-02-03 17:34:27 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-03 17:34:27 +1100 |
commit | 6d4225a131ae1169717e6dd6e4c95ad4f49de64c (patch) | |
tree | 626140cb64bff4e10e28037e940d93ebe60eb67f | |
parent | 5e7b0330669594ee79201d19ff45a7850fa0f951 (diff) |
FIX: Last checkpoint is not set
When reshape is finished monitor has to set last checkpoint
to the array end to allow metatdata for reshape finalization.
Metadata has to know if reshape is finished or it is broken
On reshape finish metadata finalization is required.
When reshape is broken, metadata must remain as is to allow
for reshape restart from checkpoint.
This can be resolved based on reshape_position sysfs entry.
When it is equal to 'none', it means that md finishes work.
In such situation move checkpoint to the end of array.
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | monitor.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -366,6 +366,24 @@ static int read_and_act(struct active_array *a) */ if (sync_completed != 0) a->last_checkpoint = sync_completed; + /* We might need to update last_checkpoint depending on + * the reason that reshape finished. + * if array reshape is really finished: + * set check point to the end, this allows + * set_array_state() to finalize reshape in metadata + * if reshape if broken: do not set checkpoint to the end + * this allows for reshape restart from checkpoint + */ + if ((a->curr_action != reshape) && + (a->prev_action == reshape)) { + char buf[40]; + if ((sysfs_get_str(&a->info, NULL, + "reshape_position", + buf, + sizeof(buf)) >= 0) && + strncmp(buf, "none", 4) == 0) + a->last_checkpoint = a->info.component_size; + } a->container->ss->set_array_state(a, a->curr_state <= clean); a->last_checkpoint = sync_completed; } |