]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
examine: allows to examine a disk metadata on non-metadata compliant systems
authorLabun, Marcin <Marcin.Labun@intel.com>
Wed, 23 Mar 2011 01:04:46 +0000 (12:04 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 23 Mar 2011 01:04:46 +0000 (12:04 +1100)
Allow for loading metadata from disk attached to non-metadata compliant
system. Affects mdadm --examine and guess_super.

Added ignore_hw_compat in supertype to pass information to load_super
handler. If ignore_hw_compat is set the handler should load metadata
also from disks that do not comply with metadata requirements (i.e. disk is not
attached to native controller, etc).

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Examine.c
mdadm.h
util.c

index f949646f48aea561e8b68545b5e0f9d1dd13af67..5d71e537edd3dcd33e035951c34aeb184a22ba86 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -87,6 +87,7 @@ int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
                                st = guess_super(fd);
                        if (st) {
                                err = 1;
+                               st->ignore_hw_compat = 1;
                                if (!container)
                                        err = st->ss->load_super(st, fd,
                                                                 (brief||scan) ? NULL
@@ -98,6 +99,7 @@ int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
                                        if (!err)
                                                have_container = 1;
                                }
+                               st->ignore_hw_compat = 0;
                        } else {
                                if (!brief) {
                                        fprintf(stderr, Name ": No md superblock detected on %s.\n", devlist->devname);
diff --git a/mdadm.h b/mdadm.h
index fa5af3ae7a65de575bdc989081747f2a7b05f613..8277594bdb82cef41c1ed6c7ae85609e9ab46178 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -827,7 +827,11 @@ struct supertype {
        int container_dev;    /* devnum of container */
        void *sb;
        void *info;
-
+       int ignore_hw_compat; /* used to inform metadata handlers that it should ignore
+                                HW/firmware related incompatability to load metadata.
+                                Used when examining metadata to display content of disk
+                                when user has no hw/firmare compatible system.
+                             */
        struct metadata_update *updates;
        struct metadata_update **update_tail;
 
diff --git a/util.c b/util.c
index 8e1b73717650cef31fc79cf0365c59a9a8946889..ef4406a13304cc3d08ca077b87f3a16a9bfe62ec 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1196,6 +1196,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
                if (guess_type == guess_partitions && ss->add_to_super != NULL)
                        continue;
                memset(st, 0, sizeof(*st));
+               st->ignore_hw_compat = 1;
                rv = ss->load_super(st, fd, NULL);
                if (rv == 0) {
                        struct mdinfo info;
@@ -1211,9 +1212,11 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
        if (bestsuper != -1) {
                int rv;
                memset(st, 0, sizeof(*st));
+               st->ignore_hw_compat = 1;
                rv = superlist[bestsuper]->load_super(st, fd, NULL);
                if (rv == 0) {
                        superlist[bestsuper]->free_super(st);
+                       st->ignore_hw_compat = 0;
                        return st;
                }
        }