]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Allow default metadata to be specified in mdadm.conf
authorNeil Brown <neilb@suse.de>
Fri, 2 Jun 2006 05:33:40 +0000 (05:33 +0000)
committerNeil Brown <neilb@suse.de>
Fri, 2 Jun 2006 05:33:40 +0000 (05:33 +0000)
CREATE metadata=1
in mdadm.conf will cause version-1 superblocks to be the default.

Signed-off-by: Neil Brown <neilb@suse.de>
Create.c
config.c
mdadm.conf.5
mdadm.h

index b07e04408930e007924b5759cd4f66dec2d9e0cc..8149d275ded5d03906b38c42e5e76b55dd1a0e46 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -214,6 +214,11 @@ int Create(struct supertype *st, char *mddev, int mdfd,
                        ldsize = dsize;
                        ldsize <<= 9;
                }
+               if (st == NULL) {
+                       struct createinfo *ci = conf_get_create_info(NULL);
+                       if (ci)
+                               st = ci->supertype;
+               }
                if (st == NULL) {
                        /* Need to choose a default metadata, which is different
                         * depending on the sizes of devices
index 5accf15c417370e64a443c09c765ffdc9b7bbc7a..20dc725849682ded3f51e010c5ced357e1428001 100644 (file)
--- a/config.c
+++ b/config.c
@@ -354,6 +354,16 @@ static void createline(char *line)
                                fprintf(stderr, Name ": unrecognised CREATE mode %s\n",
                                        w+5);
                        }
+               } else if (strncasecmp(w, "metadata=", 9) == 0) {
+                       /* style of metadata to use by default */
+                       int i;
+                       for (i=0; superlist[i] && !createinfo.supertype; i++)
+                               createinfo.supertype =
+                                       superlist[i]->match_metadata_desc(w+9);
+                       if (!createinfo.supertype)
+                               fprintf(stderr, Name ": metadata format %s unknown, ignoring\n",
+                                       w+9);
+
                } else {
                        fprintf(stderr, Name ": unrecognised word on CREATE line: %s\n",
                                w);
index b9beffa12cb4e40f05919e7139fe4b6642d05c69..6ae68023c125d322c3ebf5f24374c46939571713 100644 (file)
@@ -126,6 +126,17 @@ this is mainly for compatibility with the output of
 
 .BR "mdadm --examine --scan" .
 
+.TP
+.B spares=
+The value is a number of spare devices to expect the array to have.
+.I mdadm --monitor
+will report an array if it is found to have fewer than this number of
+spares when
+.B --monitor
+starts or when
+.B --oneshot
+is used.
+
 .TP
 .B spare-group=
 The value is a textual name for a group of arrays.  All arrays with
@@ -165,6 +176,13 @@ driver as the bitmap file.  This has the same function as the
 .B --bitmap-file
 option to
 .BR --assemble .
+
+.TP
+.B metadata=
+Specify the metadata format that the array has.  This is mainly
+recognised for comparability with the output of
+.IR "mdadm -Es" .
+
 .RE
 
 .TP
@@ -217,7 +235,7 @@ line and it should be give only one program.
 .B CREATE
 The
 .B create
-line gives default values to be used when creating device entries for
+line gives default values to be used when creating arrays and device entries for
 arrays.
 These include:
 
@@ -244,6 +262,11 @@ flag to mdadm.  Give
 - possibly followed by a number of partitions - to indicate how
 missing device entries should be created.
 
+.TP
+.B metadata=
+The name of the metadata format to use if none is explicitly given.
+This can be useful to impose a system-wide default of version-1 superblocks.
+
 .RE
 
 
diff --git a/mdadm.h b/mdadm.h
index b7ae9671e0a9b89c25195e9c9f5c32dd45bca05f..445af3233749abab80ca4a720d084cc8cfdbd6f2 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -116,6 +116,7 @@ struct createinfo {
        int     gid;
        int     autof;
        int     mode;
+       struct supertype *supertype;
 };
 
 #define Name "mdadm"