]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Support --assume-clean for --create
authorNeil Brown <neilb@suse.de>
Mon, 5 Dec 2005 05:54:48 +0000 (05:54 +0000)
committerNeil Brown <neilb@suse.de>
Mon, 5 Dec 2005 05:54:48 +0000 (05:54 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
ChangeLog
Create.c
mdadm.8
mdadm.c
mdadm.h

index 141e1b2bfeda11e48001376852e73c8a76886e3f..57a8e8283d8864e4cf8b284a53b3bfc3b99cddc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@ Changes Prior to this release
        depending on context.
     -   Allow scanning of devices listed in /proc/partitions even
        if they don't appear in /dev.
+    -   Support --assume-clean in --create mode as well as --build
 
 Changes Prior to 2.1 release
     -   Fix assembling of raid10 array when devices are missing.
index 0fd38a5883f94a2b1e98a32105a34323c2afe298..9a10d166926cde3dfa91a67d7bb0b2ecbd17f466 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -35,7 +35,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
           int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
           char *name,
           int subdevs, mddev_dev_t devlist,
-          int runstop, int verbose, int force,
+          int runstop, int verbose, int force, int assume_clean,
           char *bitmap_file, int bitmap_chunk, int write_behind, int delay)
 {
        /*
@@ -288,7 +288,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
         * as missing, so that a reconstruct happens (faster than re-parity)
         * FIX: Can we do this for raid6 as well?
         */
-       if (force == 0 && first_missing >= raiddisks) {
+       if (assume_clean==0 && force == 0 && first_missing >= raiddisks) {
                switch ( level ) {
                case 5:
                        insert_point = raiddisks-1;
@@ -318,6 +318,8 @@ int Create(struct supertype *st, char *mddev, int mdfd,
               (insert_point < raiddisks || first_missing < raiddisks) )
             ||
             ( level == 6 && missing_disks == 2)
+            ||
+            assume_clean
                )
                array.state = 1; /* clean, but one+ drive will be missing */
        else
diff --git a/mdadm.8 b/mdadm.8
index 45326f62d02159e679611615e41075d034c04324..8e191959294bbfac103f0a9046d0bc63f3197f46 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -476,9 +476,12 @@ which means to choose the largest size that fits on all current drives.
 .BR --assume-clean
 Tell
 .I mdadm
-that the array pre-existed and is known to be clean.  This is only
-really useful for Building RAID1 array.  Only use this if you really
-know what you are doing.  This is currently only supported for --build.
+that the array pre-existed and is known to be clean.  It can be useful
+when trying to recover from a major failure as you can be sure that no
+data will be affected unless you actually write to the array.  It can
+also be used when creating a RAID1 or RAID10 if you want to avoid the
+initial resync, however this practice - while normally safe - is not
+recommended.   Use this ony if you really know what you are doing.
 
 .TP
 .BR -N ", " --name=
diff --git a/mdadm.c b/mdadm.c
index 80873b221697e399232443511927890b6faa5e50..c8087998d116d94a041d31f523df746e54715c35 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -1002,7 +1002,7 @@ int main(int argc, char *argv[])
 
                rv = Create(ss, devlist->devname, mdfd, chunk, level, layout, size<0 ? 0 : size,
                            raiddisks, sparedisks, ident.name,
-                           devs_found-1, devlist->next, runstop, verbose-quiet, force,
+                           devs_found-1, devlist->next, runstop, verbose-quiet, force, assume_clean,
                            bitmap_file, bitmap_chunk, write_behind, delay);
                break;
        case MISC:
diff --git a/mdadm.h b/mdadm.h
index 29bbdc48a3d624b657b90845ae39acd3f4dcbd90..8c5f2f29eabfe16a4ec55c0a205a227298e17679 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -250,7 +250,7 @@ extern int Create(struct supertype *st, char *mddev, int mdfd,
                  int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks,
                  char *name,
                  int subdevs, mddev_dev_t devlist,
-                 int runstop, int verbose, int force,
+                 int runstop, int verbose, int force, int assume_clean,
                  char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
 
 extern int Detail(char *dev, int brief, int test);