]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
mdadm: bad block support for external metadata - initialization
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
old mode 100755 (executable)
new mode 100644 (file)
index 0516c82..62a373b
--- 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;
@@ -311,6 +322,8 @@ struct mdinfo {
 
        /* info read from sysfs */
        char            sysfs_array_state[20];
+
+       struct md_bb bb;
 };
 
 struct createinfo {
@@ -383,6 +396,8 @@ enum special_options {
        ConfigFile,
        ChunkSize,
        WriteMostly,
+       FailFast,
+       NoFailFast,
        Layout,
        Auto,
        Force,
@@ -516,6 +531,7 @@ struct mddev_dev {
                                 * Not set for names read from .config
                                 */
        char writemostly;       /* 1 for 'set writemostly', 2 for 'clear writemostly' */
+       char failfast;          /* Ditto but for 'failfast' flag */
        int used;               /* set when used */
        long long data_offset;
        struct mddev_dev *next;
@@ -821,6 +837,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.
@@ -1112,6 +1130,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);
@@ -1331,7 +1350,14 @@ extern int CreateBitmap(char *filename, int force, char uuid[16],
 extern int ExamineBitmap(char *filename, int brief, struct supertype *st);
 extern int Write_rules(char *rule_name);
 extern int bitmap_update_uuid(int fd, int *uuid, int swap);
-extern unsigned long bitmap_sectors(struct bitmap_super_s *bsb);
+
+/* calculate the size of the bitmap given the array size and bitmap chunksize */
+static inline unsigned long long
+bitmap_bits(unsigned long long array_size, unsigned long chunksize)
+{
+       return (array_size * 512 + chunksize - 1) / chunksize;
+}
+
 extern int Dump_metadata(char *dev, char *dir, struct context *c,
                         struct supertype *st);
 extern int Restore_metadata(char *dev, char *dir, struct context *c,