linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Radtke <jakub.radtke@linux.intel.com>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 6/8] imsm: Update-subarray for write-intent bitmap
Date: Thu, 24 Sep 2020 20:03:02 -0400	[thread overview]
Message-ID: <20200925000304.169728-7-jakub.radtke@linux.intel.com> (raw)
In-Reply-To: <20200925000304.169728-1-jakub.radtke@linux.intel.com>

From: Jakub Radtke <jakub.radtke@intel.com>

The patch updates the current bitmap functionality to handle adding
the bitmap on existing volumes.

Change-Id: I75c4a2a450858204457f45b4daeecfd807c83834
Signed-off-by: Jakub Radtke <jakub.radtke@intel.com>
---
 super-intel.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index eb5d39b9..0f3bbdf2 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -7783,6 +7783,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)
 {
@@ -7829,8 +7842,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);
@@ -7838,10 +7850,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));
@@ -7857,6 +7866,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;
 
-- 
2.26.2


  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 ` [PATCH 4/8] imsm: Adding a spare to an existing array with bitmap Jakub Radtke
2020-09-25  0:03 ` [PATCH 5/8] Add "bitmap" to allowed command-line values Jakub Radtke
2020-09-25  0:03 ` Jakub Radtke [this message]
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 6/8] imsm: Update-subarray for write-intent 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-7-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).