]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Compile-time switch to enable 0.9 metadata as default
authormartin f. krafft <madduck@debian.org>
Fri, 28 May 2010 12:12:41 +0000 (14:12 +0200)
committerNeilBrown <neilb@suse.de>
Mon, 31 May 2010 02:52:37 +0000 (12:52 +1000)
This commit introduces DEFAULT_OLD_METADATA as a preprocessor
definition. If defined, it causes mdadm to assume metadata version 0.9
as default. If not defined, version 1.x (currently 1.2) is used as
default.

The man page mdadm.8 is also modified to reflect the chosen default.

The selftests will not work if the old default is chosen.

This patch was requested by Debian so they could distribute a current
mdadm together with boot loaders that only understand 0.90 metadata
for md-raid.

Preferred usage is simply
   make DEFAULT_OLD_METADATA=yes

Signed-off-by: martin f. krafft <madduck@debian.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Makefile
mdadm.8.in [moved from mdadm.8 with 99% similarity]
super0.c
super1.c

index 2517f75e05633ee504f11126d41f91545a46e56f..3af16650afe1d65a0082b47041aca9812136a29e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,9 +48,15 @@ CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O
 endif
 
 ifdef DEBIAN
-CPPFLAGS= -DDEBIAN
+CPPFLAGS := -DDEBIAN
 else
-CPPFLAGS=
+CPPFLAGS :=
+endif
+ifdef DEFAULT_OLD_METADATA
+ CPPFLAG += -DDEFAULT_OLD_METADATA
+ DEFAULT_METADATA=0.90
+else
+ DEFAULT_METADATA=1.2
 endif
 
 SYSCONFDIR = /etc
@@ -180,6 +186,9 @@ mdassemble.klibc : $(ASSEMBLE_SRCS) mdadm.h
        rm -f $(OBJS)
        $(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
 
+mdadm.8 : mdadm.8.in
+       sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' mdadm.8.in > mdadm.8
+
 mdadm.man : mdadm.8
        nroff -man mdadm.8 > mdadm.man
 
similarity index 99%
rename from mdadm.8
rename to mdadm.8.in
index 90470d9db514eb0806d7a353a779f1b57cd73c21..da1a0a90784c719659c917383b3e4214dde97d72 100644 (file)
--- a/mdadm.8
@@ -299,7 +299,7 @@ says to get a list of array devices from
 .TP
 .BR \-e ", " \-\-metadata=
 Declare the style of RAID metadata (superblock) to be used.  The
-default is 1.2 for
+default is {DEFAULT_METADATA} for
 .BR \-\-create ,
 and to guess for other operations.
 The default can be overridden by setting the
@@ -311,16 +311,24 @@ keyword in
 
 Options are:
 .RS
+.ie '{DEFAULT_METADATA}'0.90'
+.IP "0, 0.90, default"
+.el
 .IP "0, 0.90"
+..
 Use the original 0.90 format superblock.  This format limits arrays to
 28 component devices and limits component devices of levels 1 and
 greater to 2 terabytes.
+.ie '{DEFAULT_METADATA}'0.90'
+.IP "1, 1.0, 1.1, 1.2"
+.el
 .IP "1, 1.0, 1.1, 1.2 default"
+..
 Use the new version-1 format superblock.  This has few restrictions.
 The different sub-versions store the superblock at different locations
 on the device, either at the end (for 1.0), at the start (for 1.1) or
-4K from the start (for 1.2).  '1' is equivalent to '1.0', 'default' is
-equivalent to '1.2'.
+4K from the start (for 1.2).  "1" is equivalent to "1.0".
+'if '{DEFAULT_METADATA}'1.2'  "default" is equivalent to "1.2".
 .IP ddf
 Use the "Industry Standard" DDF (Disk Data Format) format defined by
 SNIA.
index a0c7eb4f15db90063ccffdf9055ff0ac70e9bf05..83600cbf34e2a91a8a9b92c4802ff6cb0fce93d6 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -922,6 +922,9 @@ static struct supertype *match_metadata_desc0(char *arg)
        while (arg[0] == '0' && arg[1] == '0')
                arg++;
        if (strcmp(arg, "0") == 0 ||
+#ifdef DEFAULT_OLD_METADATA /* ifndef in super1.c */
+           strcmp(arg, "default") == 0 ||
+#endif /* DEFAULT_OLD_METADATA */
            strcmp(arg, "0.90") == 0 ||
            strcmp(arg, "") == 0 /* no metadata  - i.e. non_persistent */
                )
index 8fa074531fbacf6ed7efec9d86b2885264d8e9da..216690d4893216b30a974cbdc3a20dacbeacd6a5 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1381,7 +1381,9 @@ static struct supertype *match_metadata_desc1(char *arg)
                return st;
        }
        if (strcmp(arg, "1.2") == 0 ||
+#ifndef DEFAULT_OLD_METADATA /* ifdef in super0.c */
            strcmp(arg, "default") == 0 ||
+#endif /* DEFAULT_OLD_METADATA */
            strcmp(arg, "1.02") == 0) {
                st->minor_version = 2;
                return st;