Compile-time switch to enable 0.9 metadata as default

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>
This commit is contained in:
martin f. krafft 2010-05-28 14:12:41 +02:00 committed by NeilBrown
parent 5082750467
commit 26f467a954
4 changed files with 27 additions and 5 deletions

View File

@ -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

View File

@ -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.

View File

@ -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 */
)

View File

@ -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;