]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Support adding a spare to a degraded array.
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index b6102aaa3acf4147446d46573184432989ce2e07..79ec5e294bc22bb7ebae7bf8e8f22ff6ed709085 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -154,7 +154,10 @@ struct mdinfo {
        int                     cache_size; /* size of raid456 stripe cache*/
        int                     mismatch_cnt;
        char                    text_version[50];
-       int container_member; /* for assembling external-metatdata arrays */
+
+       int container_member; /* for assembling external-metatdata arrays
+                              * This is to be used internally by metadata
+                              * handler only */
 
        char            sys_name[20];
        struct mdinfo *devs;
@@ -369,6 +372,7 @@ extern mapping_t r5layout[], pers[], modes[], faultylayout[];
 extern char *map_dev(int major, int minor, int create);
 
 struct active_array;
+struct metadata_update;
 
 extern struct superswitch {
        void (*examine_super)(struct supertype *st, char *homehost);
@@ -410,7 +414,8 @@ extern struct superswitch {
        struct mdinfo *(*container_content)(struct supertype *st);
 
 /* for mdmon */
-       int (*open_new)(struct supertype *c, struct active_array *a, int inst);
+       int (*open_new)(struct supertype *c, struct active_array *a,
+                       char *inst);
 
        /* Tell the metadata handler the current state of the array.
         * This covers whether it is known to be consistent (no pending writes)
@@ -429,11 +434,21 @@ extern struct superswitch {
         * not in fact changed.
         */
        void (*set_disk)(struct active_array *a, int n, int state);
-       void (*sync_metadata)(struct active_array *a);
-
+       void (*sync_metadata)(struct supertype *st);
+       void (*process_update)(struct supertype *st,
+                              struct metadata_update *update);
+
+       /* activate_spare will check if the array is degraded and, if it
+        * is, try to find some spare space in the container.
+        * On success, it add appropriate updates (For process_update) to
+        * to the 'updates' list and returns a list of 'mdinfo' identifying
+        * the device, or devices as there might be multiple missing
+        * devices and multiple spares available.
+        */
+       struct mdinfo *(*activate_spare)(struct active_array *a,
+                                        struct metadata_update **updates);
 
        int major;
-       char *text_version;
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
 } super0, super1, super_ddf, super_ddf_bvd, super_ddf_svd, *superlist[];
@@ -445,7 +460,6 @@ struct supertype {
        int minor_version;
        int max_devs;
        int container_dev;    /* devnum of container */
-       int container_member; /* numerical position in container */
        void *sb;
        void *info;