diff options
author | Jakub Radtke <jakub.radtke@intel.com> | 2021-01-15 06:46:57 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2021-03-09 23:17:51 +0100 |
commit | 69d40de44b6b90c498323490b7310399a6833d0d (patch) | |
tree | 9d209fd862bf35fd9841b70e6b2651def36ef217 /super-intel.c | |
parent | imsm: Write-intent bitmap support (diff) | |
download | mdadm-69d40de44b6b90c498323490b7310399a6833d0d.tar.xz mdadm-69d40de44b6b90c498323490b7310399a6833d0d.zip |
imsm: Adding a spare to an existing array with bitmap
When adding a spare to an existing array with bitmap, an additional
initialization (adding bitmap header and preparing the bitmap area)
is required.
Signed-off-by: Jakub Radtke <jakub.radtke@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to '')
-rw-r--r-- | super-intel.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c index 455bdd26..4284ddea 100644 --- a/super-intel.c +++ b/super-intel.c @@ -9526,6 +9526,39 @@ static int apply_size_change_update(struct imsm_update_size_change *u, return ret_val; } +static int prepare_spare_to_activate(struct supertype *st, + struct imsm_update_activate_spare *u) +{ + struct intel_super *super = st->sb; + int prev_current_vol = super->current_vol; + struct active_array *a; + int ret = 1; + + for (a = st->arrays; a; a = a->next) + /* + * Additional initialization (adding bitmap header, filling + * the bitmap area with '1's to force initial rebuild for a whole + * data-area) is required when adding the spare to the volume + * with write-intent bitmap. + */ + if (a->info.container_member == u->array && + a->info.consistency_policy == CONSISTENCY_POLICY_BITMAP) { + struct dl *dl; + + for (dl = super->disks; dl; dl = dl->next) + if (dl == u->dl) + break; + if (!dl) + break; + + super->current_vol = u->array; + if (st->ss->write_bitmap(st, dl->fd, NoUpdate)) + ret = 0; + super->current_vol = prev_current_vol; + } + return ret; +} + static int apply_update_activate_spare(struct imsm_update_activate_spare *u, struct intel_super *super, struct active_array *active_array) @@ -9950,7 +9983,9 @@ static void imsm_process_update(struct supertype *st, } case update_activate_spare: { struct imsm_update_activate_spare *u = (void *) update->buf; - if (apply_update_activate_spare(u, super, st->arrays)) + + if (prepare_spare_to_activate(st, u) && + apply_update_activate_spare(u, super, st->arrays)) super->updates_pending++; break; } |