]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Add 'force' flag to *hot_remove_disk().
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
old mode 100755 (executable)
new mode 100644 (file)
index 41a4494..cebc0c0
--- a/mdadm.h
+++ b/mdadm.h
@@ -237,6 +237,17 @@ struct dlm_lksb {
 
 extern const char Name[];
 
+struct md_bb_entry {
+       unsigned long long sector;
+       int length;
+};
+
+struct md_bb {
+       int supported;
+       int count;
+       struct md_bb_entry *entries;
+};
+
 /* general information that might be extracted from a superblock */
 struct mdinfo {
        mdu_array_info_t        array;
@@ -300,6 +311,8 @@ struct mdinfo {
        /* Device info for mdmon: */
        int recovery_fd;
        int state_fd;
+       int bb_fd;
+       int ubb_fd;
        #define DS_FAULTY       1
        #define DS_INSYNC       2
        #define DS_WRITE_MOSTLY 4
@@ -311,6 +324,8 @@ struct mdinfo {
 
        /* info read from sysfs */
        char            sysfs_array_state[20];
+
+       struct md_bb bb;
 };
 
 struct createinfo {
@@ -383,6 +398,8 @@ enum special_options {
        ConfigFile,
        ChunkSize,
        WriteMostly,
+       FailFast,
+       NoFailFast,
        Layout,
        Auto,
        Force,
@@ -422,6 +439,10 @@ enum bitmap_update {
     NodeNumUpdate,
 };
 
+enum flag_mode {
+       FlagDefault, FlagSet, FlagClear,
+};
+
 /* structures read from config file */
 /* List of mddevice names and identifiers
  * Identifiers can be:
@@ -515,7 +536,8 @@ struct mddev_dev {
                                 * 'A' for re_add.
                                 * Not set for names read from .config
                                 */
-       char writemostly;       /* 1 for 'set writemostly', 2 for 'clear writemostly' */
+       enum flag_mode writemostly;
+       enum flag_mode failfast;
        int used;               /* set when used */
        long long data_offset;
        struct mddev_dev *next;
@@ -530,7 +552,7 @@ struct mdstat_ent {
        char            devnm[32];
        int             active;
        char            *level;
-       char            *pattern; /* U or up, _ for down */
+       char            *pattern; /* U for up, _ for down */
        int             percent; /* -1 if no resync */
        int             resync; /* 3 if check, 2 if reshape, 1 if resync, 0 if recovery */
        int             devcnt;
@@ -720,7 +742,7 @@ struct reshape {
        unsigned long long new_size; /* New size of array in sectors */
 };
 
-/* A superswitch provides entry point the a metadata handler.
+/* A superswitch provides entry point to a metadata handler.
  *
  * The superswitch primarily operates on some "metadata" that
  * is accessed via the 'supertype'.
@@ -821,6 +843,8 @@ extern struct superswitch {
         *   linear-grow-update - now change the size of the array.
         *   writemostly - set the WriteMostly1 bit in the superblock devflags
         *   readwrite - clear the WriteMostly1 bit in the superblock devflags
+        *   failfast - set the FailFast1 bit in the superblock
+        *   nofailfast - clear the FailFast1 bit
         *   no-bitmap - clear any record that a bitmap is present.
         *   bbl       - add a bad-block-log if possible
         *   no-bbl    - remove any bad-block-log is it is empty.
@@ -1035,6 +1059,17 @@ extern struct superswitch {
        /* validate container after assemble */
        int (*validate_container)(struct mdinfo *info);
 
+       /* records new bad block in metadata */
+       int (*record_bad_block)(struct active_array *a, int n,
+                                       unsigned long long sector, int length);
+
+       /* clears bad block from metadata */
+       int (*clear_bad_block)(struct active_array *a, int n,
+                                       unsigned long long sector, int length);
+
+       /* get list of bad blocks from metadata */
+       struct md_bb *(*get_bad_blocks)(struct active_array *a, int n);
+
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
        const char *name; /* canonical metadata name */
@@ -1112,6 +1147,7 @@ static inline struct supertype *guess_super(int fd) {
 }
 extern struct supertype *dup_super(struct supertype *st);
 extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
+extern int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep);
 extern int must_be_container(int fd);
 extern int dev_size_from_id(dev_t id, unsigned long long *size);
 void wait_for(char *dev, int fd);
@@ -1440,6 +1476,8 @@ extern int add_disk(int mdfd, struct supertype *st,
                    struct mdinfo *sra, struct mdinfo *info);
 extern int remove_disk(int mdfd, struct supertype *st,
                       struct mdinfo *sra, struct mdinfo *info);
+extern int hot_remove_disk(int mdfd, unsigned long dev, int force);
+extern int sys_hot_remove_disk(int statefd, int force);
 extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
 unsigned long long min_recovery_start(struct mdinfo *array);