From: Jakub Radtke <jakub.radtke@linux.intel.com>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 4/8] imsm: Adding a spare to an existing array with bitmap
Date: Thu, 24 Sep 2020 20:03:00 -0400 [thread overview]
Message-ID: <20200925000304.169728-5-jakub.radtke@linux.intel.com> (raw)
In-Reply-To: <20200925000304.169728-1-jakub.radtke@linux.intel.com>
From: Jakub Radtke <jakub.radtke@intel.com>
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>
Change-Id: Icaced458f4a1dd7777fce60660b749301c8496e8
---
super-intel.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index edb1c60e..eb5d39b9 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -9537,6 +9537,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)
@@ -9961,7 +9994,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;
}
--
2.26.2
next prev parent reply other threads:[~2021-03-05 12:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 0:02 [PATCH 0/8] Write-intent bitmap support for IMSM metadata Jakub Radtke
2020-09-25 0:02 ` [PATCH 1/8] Modify mdstat parsing for volumes with the bitmap Jakub Radtke
2020-09-25 0:02 ` [PATCH 2/8] Enable bitmap support for external metadata Jakub Radtke
2020-09-25 0:02 ` [PATCH 3/8] imsm: Write-intent bitmap support Jakub Radtke
2020-09-25 0:03 ` Jakub Radtke [this message]
2020-09-25 0:03 ` [PATCH 5/8] Add "bitmap" to allowed command-line values Jakub Radtke
2020-09-25 0:03 ` [PATCH 6/8] imsm: Update-subarray for write-intent bitmap Jakub Radtke
2020-09-25 0:03 ` [PATCH 7/8] Create: Block automatic enabling bitmap for external metadata Jakub Radtke
2020-09-25 0:03 ` [PATCH 8/8] Grow: Block reshape when external metadata and write-intent bitmap Jakub Radtke
2021-01-15 5:46 [PATCH 0/8] Write-intent bitmap support for IMSM metadata Jakub Radtke
2021-01-15 5:46 ` [PATCH 4/8] imsm: Adding a spare to an existing array with bitmap Jakub Radtke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200925000304.169728-5-jakub.radtke@linux.intel.com \
--to=jakub.radtke@linux.intel.com \
--cc=jes@trained-monkey.org \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).