Skip to contentSkip to conversation

Check and remove bitmap first when reshape to raid0

PATCH Applied Xiao Ni 2 participants 2 messages Dec 22, 2015 MD RAID

lore
Share & tools
lore

Xiao Ni

author
#0 lore raw

PATCH 1/1 Check and remove bitmap first when reshape to raid0

If reshape one raid device with bitmap to raid0, the reshape progress will start. But it'll fail and lose some components. So it should remove bitmap first.

---
 Grow.c | 9 +++++++++
 1 file changed, 9 insertions(+)
Grow.c +9 -0
index 6dfb9c9..db4daa8 100755
@@ -1590,6 +1590,15 @@ int Grow_reshape(char *devname, int fd,
 		pr_err("Cannot increase raid-disks on this array beyond %d\n", st->max_devs);
 		return 1;
 	}
+	if (s->level == 0 && 
+	    (array.state & (1<<MD_SB_BITMAP_PRESENT)) && 
+	    !(array.state & (1<<MD_SB_CLUSTERED))) {
+                array.state &= ~(1<<MD_SB_BITMAP_PRESENT);
+                if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
+                        pr_err("failed to remove internal bitmap.\n");
+                        return 1;
+                }
+        }
 
 	/* in the external case we need to check that the requested reshape is
 	 * supported, and perform an initial check that the container holds the
Signature · 1 line
2.4.3
Applied
#1 lore raw
Quoted 19 lines · Xiao Ni

If reshape one raid device with bitmap to raid0, the reshape progress will start. But it'll fail and lose some components. So it should remove bitmap first.

---
 Grow.c | 9 +++++++++
 1 file changed, 9 insertions(+)
Grow.c +2 -0
index 6dfb9c9..db4daa8 100755
@@ -1590,6 +1590,15 @@ int Grow_reshape(char *devname, int fd,
 		pr_err("Cannot increase raid-disks on this array beyond %d\n", st->max_devs);
 		return 1;
 	}
+	if (s->level == 0 && 
+	    (array.state & (1<<MD_SB_BITMAP_PRESENT)) && 

Grow.c int Grow_reshape(char *devname, int fd, · line 1604

Quoted 10 lines
Grow.c +7 -0
+	    !(array.state & (1<<MD_SB_CLUSTERED))) {
+                array.state &= ~(1<<MD_SB_BITMAP_PRESENT);
+                if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
+                        pr_err("failed to remove internal bitmap.\n");
+                        return 1;
+                }
+        }
 
 	/* in the external case we need to check that the requested reshape is
 	 * supported, and perform an initial check that the container holds the

applied, thanks.

NeilBrown