[PATCH 04/23] Reconfigure mdmon on reshape start when disks number grows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Online Capacity Expansion for IMSM)
Mdadm configures greater disks number and starts reshape.
Mdmon learns it by reading mdstat information.
Mdmon calls grow_array() to be ready for new configuration update that will be send by mdadm and new disks maintain. grow_array() prepares active_array structure for those activities.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 managemon.c |   25 ++++++++++++++++++++++++-
 mdadm.h     |    2 ++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/managemon.c b/managemon.c
index c279664..7288aa8 100644
--- a/managemon.c
+++ b/managemon.c
@@ -381,7 +381,6 @@ static void manage_member(struct mdstat_ent *mdstat,
 	 * We do that whenever the monitor tells us too.
 	 */
 	// FIXME
-	a->info.array.raid_disks = mdstat->raid_disks;
 	a->info.array.chunk_size = mdstat->chunk_size;
 	// MORE
 
@@ -393,7 +392,30 @@ static void manage_member(struct mdstat_ent *mdstat,
 		newa->info.array.level = level;
 		replace_array(a->container, a, newa);
 		a = newa;
+	} else {
+		/* not takeover fo maybe OLCE
+		 * accept OLCE during reshape only
+		 */
+		if ((a->info.array.raid_disks < mdstat->raid_disks) &&
+		    (a->info.array.raid_disks > 0)) {
+			/* Yes - online capacity expanssion
+			 */
+			if (a->container->ss->grow_array) {
+				newa = duplicate_aa(a);
+				if (newa) {
+					int to_add;
+					to_add = a->container->ss->grow_array(newa, mdstat->raid_disks);
+					if (to_add) {
+						replace_array(a->container, a, newa);
+						a = newa;
+					} else {
+						free_aa(newa);
+					}
+				}
+			}
+		}
 	}
+	a->info.array.raid_disks = mdstat->raid_disks;
 
 	if (a->check_degraded) {
 		struct metadata_update *updates = NULL; @@ -559,6 +581,7 @@ static void manage_new(struct mdstat_ent *mdstat,
 	new->info.state_fd = sysfs_open(new->devnum, NULL, "array_state");
 	new->resync_start_fd = sysfs_open(new->devnum, NULL, "resync_start");
 	new->metadata_fd = sysfs_open(new->devnum, NULL, "metadata_version");
+
 	dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
 		new->action_fd, new->info.state_fd);
 
diff --git a/mdadm.h b/mdadm.h
index ba01e34..a846098 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -649,6 +649,8 @@ extern struct superswitch {
 	struct mdinfo *(*activate_spare)(struct active_array *a,
 					 struct metadata_update **updates);
 
+	int (*grow_array)(struct active_array *a, int new_raid_disks);
+
 	int swapuuid; /* true if uuid is bigending rather than hostendian */
 	int external;
 	const char *name; /* canonical metadata name */

��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux