summaryrefslogtreecommitdiff
path: root/include/linux/raid
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2003-03-14 02:08:54 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-03-14 02:08:54 -0800
commit8eec7ce0744430471c1fce2a503829cd7cd80f11 (patch)
treee9bb6ca5ae6473260ef898ab194437f9692c8869 /include/linux/raid
parent8af848bbe7a7bb0d5dd62d2c4d6f295755436148 (diff)
[PATCH] md: Remove md_recoveryd thread for md
The md_recoveryd thread is responsible for initiating and cleaning up resync threads. This job can be equally well done by the per-array threads for those arrays which might need it. So the mdrecoveryd thread is gone and the core code that it ran is now run by raid5d, raid1d or multipathd. We add an MD_RECOVERY_NEEDED flag so those daemon don't have to bother trying to lock the md array unless it is likely that something needs to be done. Also modify the names of all threads to have the number of md device.
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/md.h7
-rw-r--r--include/linux/raid/md_k.h7
-rw-r--r--include/linux/raid/multipath.h1
-rw-r--r--include/linux/raid/raid1.h2
-rw-r--r--include/linux/raid/raid5.h2
5 files changed, 9 insertions, 10 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 3260343d634e..3d4faa9f7171 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -69,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 137c64966057..eb232ae1c768 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -206,12 +206,14 @@ 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/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
@@ -223,6 +225,7 @@ struct mddev_s
#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 */
@@ -298,8 +301,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/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;