]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Support 'bitmap=' in mdadm.conf for auto-assembling arrays with write-intent bitmaps...
authorNeil Brown <neilb@suse.de>
Wed, 29 Mar 2006 02:57:48 +0000 (02:57 +0000)
committerNeil Brown <neilb@suse.de>
Wed, 29 Mar 2006 02:57:48 +0000 (02:57 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
Assemble.c
ChangeLog
config.c
mdadm.c
mdadm.conf.5
mdadm.h

index f38b1a14d6e26ab09d9eaeb24a718420b3943810..a856456cee8041ecc81d7f00854fce32cfef49c5 100644 (file)
@@ -623,8 +623,22 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                                fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
                                return 1;
                        }
+               } else if (ident->bitmap_file) {
+                       /* From config file */
+                       int bmfd = open(ident->bitmap_file, O_RDWR);
+                       if (bmfd < 0) {
+                               fprintf(stderr, Name ": Could not open bitmap file %s\n",
+                                       ident->bitmap_file);
+                               return 1;
+                       }
+                       if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
+                               fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
+                               close(bmfd);
+                               return 1;
+                       }
+                       close(bmfd);
                }
-                                       
+
                /* First, add the raid disks, but add the chosen one last */
                for (i=0; i<= bestcnt; i++) {
                        int j;
index ae7ea25b0e311ffe5dd283aee6e3e21efe8e24fd..3b7c62efcfe19b304fc6eca366a1ed5a03594270 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@ Changes Prior to 2.4 release
     -   Handle symlinks in /dev better
     -   Fix mess in --detail output which a device is missing.
     -   Manpage tidyup
+    -   Support 'bitmap=' in mdadm.conf for auto-assembling arrays with
+       write-intent bitmaps in separate files.
 
 Changes Prior to 2.3.1 release
     -   Fixed -O2 compile so I could make and RPM.
index 1408b252d22d53110dda3f7f3ea9a4ee2548b2ec..bb22b0ebac2d2b4e76821f3dbb4df8b6429b30b6 100644 (file)
--- a/config.c
+++ b/config.c
@@ -281,6 +281,7 @@ void arrayline(char *line)
        mis.next = NULL;
        mis.st = NULL;
        mis.bitmap_fd = -1;
+       mis.bitmap_file = NULL;
        mis.name[0] = 0;
 
        for (w=dl_next(line); w!=line; w=dl_next(w)) {
@@ -321,6 +322,13 @@ void arrayline(char *line)
                        else
                                strcpy(mis.name, w+5);
 
+               } else if (strncasecmp(w, "bitmap=", 7) == 0) {
+                       if (mis.bitmap_file)
+                               fprintf(stderr, Name ": only specify bitmap file once. %s ignored\n",
+                                       w);
+                       else
+                               mis.bitmap_file = w+7;
+
                } else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
                        if (mis.devices)
                                fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
diff --git a/mdadm.c b/mdadm.c
index 6a5fac3f2e3fc28ebc820022cfb0b2243984a20e..05784e1d3be0873f1946a12d98b4e52f0f429f9b 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -112,6 +112,7 @@ int main(int argc, char *argv[])
        ident.autof = 0;
        ident.st = NULL;
        ident.bitmap_fd = -1;
+       ident.bitmap_file = NULL;
        ident.name[0] = 0;
 
        while ((option_index = -1) ,
index 09e913274e44a0d2069046f29e47df0364e65952..91814650792cde5b6f40e6539a4ac476d40c7dd1 100644 (file)
@@ -151,6 +151,18 @@ also have a number appended to indicate how many partitions to create
 device files for, e.g.
 .BR auto=mdp5 .
 The default is 4.
+
+.TP
+.B bitmap=
+The option specifies a file in which a write-intent bitmap should be
+found.  When assembling the array,
+.I mdadm
+will provide this file to the
+.B md
+driver as the bitmap file.  This has the same function as the
+.B --bitmap-file
+option to
+.BR --assemble .
 .RE
 
 .TP
diff --git a/mdadm.h b/mdadm.h
index b16c75a99759be347d7c78fb35ede31e599d5c46..74672f7c683b201f6f1f65c1b20f8b798c4022fb 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -147,6 +147,7 @@ typedef struct mddev_ident_s {
        struct supertype *st;
        int     autof;          /* 1 for normal, 2 for partitioned */
        char    *spare_group;
+       char    *bitmap_file;
        int     bitmap_fd;
 
        struct mddev_ident_s *next;