dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/imsm-switch-to-multiple-ppls-automatically-during-as.patch

2c1b57
From 54148aba7c1a02bf018ae777bebc7f16e6cd3195 Mon Sep 17 00:00:00 2001
2c1b57
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
2c1b57
Date: Thu, 28 Sep 2017 14:41:12 +0200
2c1b57
Subject: [PATCH 06/12] imsm: switch to multiple ppls automatically
2c1b57
 during assemble
2c1b57
2c1b57
If user has array with single ppl -
2c1b57
update the metadata to use multiple ppls.
2c1b57
2c1b57
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
2c1b57
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
2c1b57
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2c1b57
---
2c1b57
 super-intel.c | 30 ++++++++++++++++++++++++++++++
2c1b57
 1 file changed, 30 insertions(+)
2c1b57
2c1b57
diff --git a/super-intel.c b/super-intel.c
2c1b57
index 65cdc92..630fb6e 100644
2c1b57
--- a/super-intel.c
2c1b57
+++ b/super-intel.c
2c1b57
@@ -6184,6 +6184,36 @@ static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info,
2c1b57
 out:
2c1b57
 	free(buf);
2c1b57
 
2c1b57
+	/*
2c1b57
+	 * Update metadata to use mutliple PPLs area (1MB).
2c1b57
+	 * This is done once for all RAID members
2c1b57
+	 */
2c1b57
+	if (info->consistency_policy == CONSISTENCY_POLICY_PPL &&
2c1b57
+	    info->ppl_size != (MULTIPLE_PPL_AREA_SIZE_IMSM >> 9)) {
2c1b57
+		char subarray[20];
2c1b57
+		struct mdinfo *member_dev;
2c1b57
+
2c1b57
+		sprintf(subarray, "%d", info->container_member);
2c1b57
+
2c1b57
+		if (mdmon_running(st->container_devnm))
2c1b57
+			st->update_tail = &st->updates;
2c1b57
+
2c1b57
+		if (st->ss->update_subarray(st, subarray, "ppl", NULL)) {
2c1b57
+			pr_err("Failed to update subarray %s\n",
2c1b57
+			      subarray);
2c1b57
+		} else {
2c1b57
+			if (st->update_tail)
2c1b57
+				flush_metadata_updates(st);
2c1b57
+			else
2c1b57
+				st->ss->sync_metadata(st);
2c1b57
+			info->ppl_size = (MULTIPLE_PPL_AREA_SIZE_IMSM >> 9);
2c1b57
+			for (member_dev = info->devs; member_dev;
2c1b57
+			     member_dev = member_dev->next)
2c1b57
+				member_dev->ppl_size =
2c1b57
+				    (MULTIPLE_PPL_AREA_SIZE_IMSM >> 9);
2c1b57
+		}
2c1b57
+	}
2c1b57
+
2c1b57
 	if (ret == 1 && map->map_state == IMSM_T_STATE_UNINITIALIZED)
2c1b57
 		return st->ss->write_init_ppl(st, info, d->fd);
2c1b57
 
2c1b57
-- 
2c1b57
2.7.4
2c1b57