Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / raid / md_p.h
index 8ba95d6..f1fbae7 100644 (file)
 #define MD_DISK_SYNC           2 /* disk is in sync with the raid set */
 #define MD_DISK_REMOVED                3 /* disk is in sync with the raid set */
 
+#define        MD_DISK_WRITEMOSTLY     9 /* disk is "write-mostly" is RAID1 config.
+                                  * read requests will only be sent here in
+                                  * dire need
+                                  */
+
 typedef struct mdp_device_descriptor_s {
        __u32 number;           /* 0 Device number in the entire set          */
        __u32 major;            /* 1 Device major number                      */
@@ -96,6 +101,19 @@ typedef struct mdp_device_descriptor_s {
 #define MD_SB_CLEAN            0
 #define MD_SB_ERRORS           1
 
+#define        MD_SB_BITMAP_PRESENT    8 /* bitmap may be present nearby */
+
+/*
+ * Notes:
+ * - if an array is being reshaped (restriped) in order to change the
+ *   the number of active devices in the array, 'raid_disks' will be
+ *   the larger of the old and new numbers.  'delta_disks' will
+ *   be the "new - old".  So if +ve, raid_disks is the new value, and
+ *   "raid_disks-delta_disks" is the old.  If -ve, raid_disks is the
+ *   old value and "raid_disks+delta_disks" is the new (smaller) value.
+ */
+
+
 typedef struct mdp_superblock_s {
        /*
         * Constant generic information
@@ -140,7 +158,13 @@ typedef struct mdp_superblock_s {
        __u32 cp_events_hi;     /* 10 high-order of checkpoint update count   */
 #endif
        __u32 recovery_cp;      /* 11 recovery checkpoint sector count        */
-       __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 12];
+       /* There are only valid for minor_version > 90 */
+       __u64 reshape_position; /* 12,13 next address in array-space for reshape */
+       __u32 new_level;        /* 14 new level we are reshaping to           */
+       __u32 delta_disks;      /* 15 change in number of raid_disks          */
+       __u32 new_layout;       /* 16 new layout                              */
+       __u32 new_chunk;        /* 17 new chunk size (bytes)                  */
+       __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
 
        /*
         * Personality information
@@ -184,7 +208,7 @@ struct mdp_superblock_1 {
        /* constant array information - 128 bytes */
        __u32   magic;          /* MD_SB_MAGIC: 0xa92b4efc - little endian */
        __u32   major_version;  /* 1 */
-       __u32   feature_map;    /* 0 for now */
+       __u32   feature_map;    /* bit 0 set if 'bitmap_offset' is meaningful */
        __u32   pad0;           /* always set to 0 when writing */
 
        __u8    set_uuid[16];   /* user-space generated. */
@@ -192,12 +216,23 @@ struct mdp_superblock_1 {
 
        __u64   ctime;          /* lo 40 bits are seconds, top 24 are microseconds or 0*/
        __u32   level;          /* -4 (multipath), -1 (linear), 0,1,4,5 */
-       __u32   layout;         /* only for raid5 currently */
+       __u32   layout;         /* only for raid5 and raid10 currently */
        __u64   size;           /* used size of component devices, in 512byte sectors */
 
        __u32   chunksize;      /* in 512byte sectors */
        __u32   raid_disks;
-       __u8    pad1[128-96];   /* set to 0 when written */
+       __u32   bitmap_offset;  /* sectors after start of superblock that bitmap starts
+                                * NOTE: signed, so bitmap can be before superblock
+                                * only meaningful of feature_map[0] is set.
+                                */
+
+       /* These are only valid with feature bit '4' */
+       __u32   new_level;      /* new level we are reshaping to                */
+       __u64   reshape_position;       /* next address in array-space for reshape */
+       __u32   delta_disks;    /* change in number of raid_disks               */
+       __u32   new_layout;     /* new layout                                   */
+       __u32   new_chunk;      /* new chunk size (bytes)                       */
+       __u8    pad1[128-124];  /* set to 0 when written */
 
        /* constant this-device information - 64 bytes */
        __u64   data_offset;    /* sector start of data, often 0 */
@@ -207,7 +242,9 @@ struct mdp_superblock_1 {
        __u32   dev_number;     /* permanent identifier of this  device - not role in raid */
        __u32   cnt_corrected_read; /* number of read errors that were corrected by re-writing */
        __u8    device_uuid[16]; /* user-space setable, ignored by kernel */
-       __u8    pad2[64-56];    /* set to 0 when writing */
+       __u8    devflags;       /* per-device flags.  Only one defined...*/
+#define        WriteMostly1    1       /* mask for writemostly flag in above */
+       __u8    pad2[64-57];    /* set to 0 when writing */
 
        /* array state information - 64 bytes */
        __u64   utime;          /* 40 bits second, 24 btes microseconds */
@@ -226,5 +263,11 @@ struct mdp_superblock_1 {
        __u16   dev_roles[0];   /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
 };
 
+/* feature_map bits */
+#define MD_FEATURE_BITMAP_OFFSET       1
+#define        MD_FEATURE_RESHAPE_ACTIVE       4
+
+#define        MD_FEATURE_ALL                  5
+
 #endif