Skip to contentSkip to conversation

mdadm: let cluster raid could also add disk within incremental mode

PATCH New Guoqing Jiang 1 participant 2 messages Nov 19, 2015 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mdadm: let cluster raid could also add disk within incremental mode

For cluster raid, the disc.state need to be changed accordingly under incremental mode.

---
 Incremental.c | 4 ++++
 1 file changed, 4 insertions(+)
Incremental.c +4 -0
index 781d27d..7afa7d7 100644
@@ -444,6 +444,10 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
 		/* add disk needs to know about containers */
 		if (st->ss->external)
 			sra->array.level = LEVEL_CONTAINER;
+
+		if (info.array.state & (1 << MD_SB_CLUSTERED))
+			info.disk.state |= (1 << MD_DISK_CLUSTER_ADD);
+
 		err = add_disk(mdfd, st, sra, &info);
 		if (err < 0 && errno == EBUSY) {
 			/* could be another device present with the same
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 mdadm: output info more precisely when change bitmap

When change bitmap to none, the infos could be more accurate based on existed state type.

And s->bitmap_file is passed from cmd "--bitmap=TYPE", so remove s->bitmap_file from err info since it should means change the bitmap to one type failed rather than the type is already present.

---
 Grow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Grow.c +5 -2
index 80d7b22..30ff7f3 100644
@@ -328,12 +328,15 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
 		if (strcmp(s->bitmap_file, "none")==0) {
 			array.state &= ~(1<<MD_SB_BITMAP_PRESENT);
 			if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
-				pr_err("failed to remove internal bitmap.\n");
+				if (array.state & (1<<MD_SB_CLUSTERED))
+					pr_err("failed to remove clustered bitmap.\n");
+				else
+					pr_err("failed to remove internal bitmap.\n");
 				return 1;
 			}
 			return 0;
 		}
-		pr_err("%s bitmap already present on %s\n", s->bitmap_file, devname);
+		pr_err("bitmap already present on %s\n", devname);
 		return 1;
 	}
 
Signature · 1 line
2.1.4