diff options
author | Jakub Radtke <jakub.radtke@intel.com> | 2021-01-15 06:46:59 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2021-03-09 23:17:59 +0100 |
commit | 19ad203ecbceca51120a8b8cabc202e1053f41b4 (patch) | |
tree | 3ccb5379d54a939f17d79b6277432ac0d95fca8c | |
parent | Add "bitmap" to allowed command-line values (diff) | |
download | mdadm-19ad203ecbceca51120a8b8cabc202e1053f41b4.tar.xz mdadm-19ad203ecbceca51120a8b8cabc202e1053f41b4.zip |
imsm: Update-subarray for write-intent bitmap
The patch updates the current bitmap functionality to handle adding
the bitmap on existing volumes.
Signed-off-by: Jakub Radtke <jakub.radtke@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r-- | super-intel.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/super-intel.c b/super-intel.c index 4284ddea..65b44e62 100644 --- a/super-intel.c +++ b/super-intel.c @@ -7772,6 +7772,19 @@ static int kill_subarray_imsm(struct supertype *st, char *subarray_id) return 0; } +static int get_rwh_policy_from_update(char *update) +{ + if (strcmp(update, "ppl") == 0) + return RWH_MULTIPLE_DISTRIBUTED; + else if (strcmp(update, "no-ppl") == 0) + return RWH_MULTIPLE_OFF; + else if (strcmp(update, "bitmap") == 0) + return RWH_BITMAP; + else if (strcmp(update, "no-bitmap") == 0) + return RWH_OFF; + return -1; +} + static int update_subarray_imsm(struct supertype *st, char *subarray, char *update, struct mddev_ident *ident) { @@ -7818,8 +7831,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, } super->updates_pending++; } - } else if (strcmp(update, "ppl") == 0 || - strcmp(update, "no-ppl") == 0) { + } else if (get_rwh_policy_from_update(update) != -1) { int new_policy; char *ep; int vol = strtoul(subarray, &ep, 10); @@ -7827,10 +7839,7 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, if (*ep != '\0' || vol >= super->anchor->num_raid_devs) return 2; - if (strcmp(update, "ppl") == 0) - new_policy = RWH_MULTIPLE_DISTRIBUTED; - else - new_policy = RWH_MULTIPLE_OFF; + new_policy = get_rwh_policy_from_update(update); if (st->update_tail) { struct imsm_update_rwh_policy *u = xmalloc(sizeof(*u)); @@ -7846,6 +7855,8 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, dev->rwh_policy = new_policy; super->updates_pending++; } + if (new_policy == RWH_BITMAP) + return write_init_bitmap_imsm_vol(st, vol); } else return 2; |