]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Grow.c
Increment version for clustered bitmaps
[thirdparty/mdadm.git] / Grow.c
diff --git a/Grow.c b/Grow.c
index f7dcbdb570a6d94ba8754c2459782d77fc2c7c9f..80d7b223e8ac0700ce9d43c7abc070ec5d36561c 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -297,6 +297,9 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                        "  between different architectures.  Consider upgrading the Linux kernel.\n");
        }
 
+       if (s->bitmap_file && strcmp(s->bitmap_file, "clustered") == 0)
+               major = BITMAP_MAJOR_CLUSTERED;
+
        if (ioctl(fd, GET_BITMAP_FILE, &bmf) != 0) {
                if (errno == ENOMEM)
                        pr_err("Memory allocation failure.\n");
@@ -330,8 +333,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                        }
                        return 0;
                }
-               pr_err("Internal bitmap already present on %s\n",
-                       devname);
+               pr_err("%s bitmap already present on %s\n", s->bitmap_file, devname);
                return 1;
        }
 
@@ -375,7 +377,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                free(st);
                return 1;
        }
-       if (strcmp(s->bitmap_file, "internal") == 0) {
+       if (strcmp(s->bitmap_file, "internal") == 0 ||
+           strcmp(s->bitmap_file, "clustered") == 0) {
                int rv;
                int d;
                int offset_setable = 0;
@@ -384,6 +387,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                        pr_err("Internal bitmaps not supported with %s metadata\n", st->ss->name);
                        return 1;
                }
+               st->nodes = c->nodes;
+               st->cluster_name = c->homecluster;
                mdi = sysfs_read(fd, NULL, GET_BITMAP_LOCATION);
                if (mdi)
                        offset_setable = 1;
@@ -410,7 +415,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                                                    bitmapsize, offset_setable,
                                                    major)
                                                )
-                                               st->ss->write_bitmap(st, fd2);
+                                               st->ss->write_bitmap(st, fd2, NoUpdate);
                                        else {
                                                pr_err("failed to create internal bitmap - chunksize problem.\n");
                                                close(fd2);
@@ -426,6 +431,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                        rv = sysfs_set_num_signed(mdi, NULL, "bitmap/location",
                                                  mdi->bitmap_offset);
                } else {
+                       if (strcmp(s->bitmap_file, "clustered") == 0)
+                               array.state |= (1<<MD_SB_CLUSTERED);
                        array.state |= (1<<MD_SB_BITMAP_PRESENT);
                        rv = ioctl(fd, SET_ARRAY_INFO, &array);
                }
@@ -612,10 +619,8 @@ static void unfreeze(struct supertype *st)
 
                if (sra &&
                    sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0
-                   && strcmp(buf, "frozen\n") == 0) {
-                       printf("unfreeze\n");
+                   && strcmp(buf, "frozen\n") == 0)
                        sysfs_set_str(sra, NULL, "sync_action", "idle");
-               }
                sysfs_free(sra);
        }
 }