summaryrefslogtreecommitdiff
path: root/include/linux/raid
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/md.h8
-rw-r--r--include/linux/raid/md_k.h36
-rw-r--r--include/linux/raid/md_p.h53
-rw-r--r--include/linux/raid/multipath.h1
-rw-r--r--include/linux/raid/raid1.h2
-rw-r--r--include/linux/raid/raid5.h2
6 files changed, 82 insertions, 20 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index d7834b08cc88..3d4faa9f7171 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/hdreg.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <net/checksum.h>
@@ -68,13 +69,14 @@ extern inline char * bdev_partition_name (struct block_device *bdev)
}
extern int register_md_personality (int p_num, mdk_personality_t *p);
extern int unregister_md_personality (int p_num);
-extern mdk_thread_t * md_register_thread (void (*run) (void *data),
- void *data, const char *name);
+extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
+ mddev_t *mddev, const char *name);
extern void md_unregister_thread (mdk_thread_t *thread);
extern void md_wakeup_thread(mdk_thread_t *thread);
+extern void md_check_recovery(mddev_t *mddev);
extern void md_interrupt_thread (mdk_thread_t *thread);
extern void md_write_start(mddev_t *mddev);
-extern void md_write_end(mddev_t *mddev, mdk_thread_t *thread);
+extern void md_write_end(mddev_t *mddev);
extern void md_handle_safemode(mddev_t *mddev);
extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
extern void md_sync_acct(mdk_rdev_t *rdev, unsigned long nr_sectors);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 6426a2c3fe8f..02bdf9db2ae2 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -155,6 +155,7 @@ struct mdk_rdev_s
struct page *sb_page;
int sb_loaded;
+ sector_t data_offset; /* start of data in array */
sector_t sb_offset;
int preferred_minor; /* autorun support */
@@ -206,22 +207,31 @@ struct mddev_s
char uuid[16];
+ struct mdk_thread_s *thread; /* management thread */
struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
unsigned long curr_resync; /* blocks scheduled */
unsigned long resync_mark; /* a recent timestamp */
unsigned long resync_mark_cnt;/* blocks written at resync_mark */
- /* recovery_running is 0 for no recovery/resync,
- * 1 for active recovery
- * 2 for active resync
- * -error for an error (e.g. -EINTR)
- * it can only be set > 0 under reconfig_sem
+
+ /* recovery/resync flags
+ * NEEDED: we might need to start a resync/recover
+ * RUNNING: a thread is running, or about to be started
+ * SYNC: actually doing a resync, not a recovery
+ * ERR: and IO error was detected - abort the resync/recovery
+ * INTR: someone requested a (clean) early abort.
+ * DONE: thread is done and is waiting to be reaped
*/
- int recovery_running;
- int recovery_error; /* error from recovery write */
+#define MD_RECOVERY_RUNNING 0
+#define MD_RECOVERY_SYNC 1
+#define MD_RECOVERY_ERR 2
+#define MD_RECOVERY_INTR 3
+#define MD_RECOVERY_DONE 4
+#define MD_RECOVERY_NEEDED 5
+ unsigned long recovery;
+
int in_sync; /* know to not need resync */
struct semaphore reconfig_sem;
atomic_t active;
- int spares;
int degraded; /* whether md should consider
* adding a spare
@@ -230,9 +240,11 @@ struct mddev_s
atomic_t recovery_active; /* blocks scheduled, but not written */
wait_queue_head_t recovery_wait;
sector_t recovery_cp;
- int safemode; /* if set, update "clean" superblock
+ unsigned int safemode; /* if set, update "clean" superblock
* when no writes pending.
*/
+ unsigned int safemode_delay;
+ struct timer_list safemode_timer;
atomic_t writes_pending;
request_queue_t queue; /* for plugging ... */
@@ -245,7 +257,7 @@ struct mdk_personality_s
int (*make_request)(request_queue_t *q, struct bio *bio);
int (*run)(mddev_t *mddev);
int (*stop)(mddev_t *mddev);
- int (*status)(char *page, mddev_t *mddev);
+ void (*status)(struct seq_file *seq, mddev_t *mddev);
/* error_handler must set ->faulty and clear ->in_sync
* if appropriate, and should abort recovery if needed
*/
@@ -292,8 +304,8 @@ extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr);
ITERATE_RDEV_GENERIC(pending_raid_disks,rdev,tmp)
typedef struct mdk_thread_s {
- void (*run) (void *data);
- void *data;
+ void (*run) (mddev_t *mddev);
+ mddev_t *mddev;
wait_queue_head_t wqueue;
unsigned long flags;
struct completion *event;
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index cb002ba3556f..022b607bf9d8 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -173,5 +173,58 @@ static inline __u64 md_event(mdp_super_t *sb) {
return (ev<<32)| sb->events_lo;
}
+/*
+ * The version-1 superblock :
+ * All numeric fields are little-endian.
+ *
+ * total size: 256 bytes plus 2 per device.
+ * 1K allows 384 devices.
+ */
+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 pad0; /* always set to 0 when writing */
+
+ __u8 set_uuid[16]; /* user-space generated. */
+ char set_name[32]; /* set and interpreted by user-space */
+
+ __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 */
+ __u64 size; /* used size of component devices, in 512byte sectors */
+
+ __u32 chunksize; /* in 512byte sectors */
+ __u32 raid_disks;
+ __u8 pad1[128-92]; /* set to 0 when written */
+
+ /* constant this-device information - 64 bytes */
+ __u64 data_offset; /* sector start of data, often 0 */
+ __u64 data_size; /* sectors in this device that can be used for data */
+ __u64 super_offset; /* sector start of this superblock */
+ __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
+ __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 */
+
+ /* array state information - 64 bytes */
+ __u64 utime; /* 40 bits second, 24 btes microseconds */
+ __u64 events; /* incremented when superblock updated */
+ __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
+ __u32 sb_csum; /* checksum upto devs[max_dev] */
+ __u32 max_dev; /* size of devs[] array to consider */
+ __u8 pad3[64-40]; /* set to 0 when writing */
+
+ /* device state information. Indexed by dev_number.
+ * 2 bytes per device
+ * Note there are no per-device state flags. State information is rolled
+ * into the 'roles' value. If a device is spare or faulty, then it doesn't
+ * have a meaningful role.
+ */
+ __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
+};
+
#endif
diff --git a/include/linux/raid/multipath.h b/include/linux/raid/multipath.h
index 50db7f3c8c57..42d040ea63df 100644
--- a/include/linux/raid/multipath.h
+++ b/include/linux/raid/multipath.h
@@ -13,7 +13,6 @@ struct multipath_private_data {
struct multipath_info multipaths[MD_SB_DISKS];
int raid_disks;
int working_disks;
- mdk_thread_t *thread;
spinlock_t device_lock;
mempool_t *pool;
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 9ed30f4d0748..cc7aa899a613 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -19,7 +19,6 @@ struct r1_private_data_s {
int working_disks;
int last_used;
sector_t next_seq_sect;
- mdk_thread_t *thread;
spinlock_t device_lock;
/* for use when syncing mirrors: */
@@ -34,7 +33,6 @@ struct r1_private_data_s {
mempool_t *r1bio_pool;
mempool_t *r1buf_pool;
- char thread_name[MD_THREAD_NAME_MAX];
};
typedef struct r1_private_data_s conf_t;
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 636e10b84502..c9eea7c884d0 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -203,7 +203,6 @@ struct disk_info {
struct raid5_private_data {
struct stripe_head **stripe_hashtbl;
mddev_t *mddev;
- mdk_thread_t *thread;
struct disk_info disks[MD_SB_DISKS];
struct disk_info *spare;
int chunk_size, level, algorithm;
@@ -226,7 +225,6 @@ struct raid5_private_data {
* waiting for 25% to be free
*/
spinlock_t device_lock;
- char thread_name[MD_THREAD_NAME_MAX];
};
typedef struct raid5_private_data raid5_conf_t;