diff options
| author | Neil Brown <neilb@cse.unsw.edu.au> | 2002-06-18 04:21:49 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-06-18 04:21:49 -0700 |
| commit | 86711d5ed6932fe71188d0c66605e00d021cafd9 (patch) | |
| tree | 36ddddaf6f3b045bf152674d55a384d0139b0ff7 /include/linux/raid | |
| parent | 7444c7185d2d8735a7f9d7db1e73523577365dc0 (diff) | |
[PATCH] md 22 of 22 - Generalise md sync threads
Previously each raid personality (Well, 1 and 5) started their
own thread to do resync, but md.c had a single common thread to do
reconstruct. Apart from being untidy, this means that you cannot
have two arrays reconstructing at the same time, though you can have
to array resyncing at the same time..
This patch changes the personalities so they don't start the resync,
but just leave a flag to say that it is needed.
The common thread (mdrecoveryd) now just monitors things and starts a
separate per-array thread whenever resync or recovery (or both) is
needed.
When the recovery finishes, mdrecoveryd will be woken up to re-lock
the device and activate the spares or whatever.
raid1 needs to know when resync/recovery starts and ends so it can
allocate and release resources.
It allocated when a resync request for stripe 0 is received.
Previously it deallocated for resync in it's own thread, and
deallocated for recovery when the spare is made active or inactive
(depending on success).
As raid1 doesn't own a thread anymore this needed to change. So to
match the "alloc on 0", the md_do_resync now calls sync_request one
last time asking to sync one block past the end. This is a signal to
release any resources.
Diffstat (limited to 'include/linux/raid')
| -rw-r--r-- | include/linux/raid/md.h | 4 | ||||
| -rw-r--r-- | include/linux/raid/md_k.h | 7 | ||||
| -rw-r--r-- | include/linux/raid/raid1.h | 3 | ||||
| -rw-r--r-- | include/linux/raid/raid5.h | 3 |
4 files changed, 6 insertions, 11 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index adcff3f86295..19ebeb0a4988 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h @@ -76,12 +76,8 @@ extern void md_unregister_thread (mdk_thread_t *thread); extern void md_wakeup_thread(mdk_thread_t *thread); extern void md_interrupt_thread (mdk_thread_t *thread); extern void md_update_sb (mddev_t *mddev); -extern int md_do_sync(mddev_t *mddev, mdp_disk_t *spare); extern void md_done_sync(mddev_t *mddev, int blocks, int ok); extern void md_sync_acct(kdev_t dev, unsigned long nr_sectors); -extern void md_recover_arrays (void); -extern int md_notify_reboot(struct notifier_block *this, - unsigned long code, void *x); extern int md_error (mddev_t *mddev, struct block_device *bdev); extern int md_run_setup(void); diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index c1db880110c0..e238bd222ea2 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -181,6 +181,8 @@ struct mddev_s struct list_head disks; int sb_dirty; int ro; + + 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 */ @@ -191,8 +193,10 @@ struct mddev_s * it can only be set > 0 under reconfig_sem */ int recovery_running; + int in_sync; /* know to not need resync */ struct semaphore reconfig_sem; atomic_t active; + mdp_disk_t *spare; atomic_t recovery_active; /* blocks scheduled, but not written */ wait_queue_head_t recovery_wait; @@ -222,9 +226,6 @@ struct mdk_personality_s * SPARE_ACTIVE expects such a change) */ int (*diskop) (mddev_t *mddev, mdp_disk_t **descriptor, int state); - - int (*stop_resync)(mddev_t *mddev); - int (*restart_resync)(mddev_t *mddev); int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); }; diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 3185c754e3fb..f9f02ab19bd3 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h @@ -33,8 +33,7 @@ struct r1_private_data_s { int working_disks; int last_used; sector_t next_seq_sect; - mdk_thread_t *thread, *resync_thread; - int resync_mirrors; + mdk_thread_t *thread; mirror_info_t *spare; spinlock_t device_lock; diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index 661783287da5..93956e694f62 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h @@ -204,12 +204,11 @@ struct disk_info { struct raid5_private_data { struct stripe_head **stripe_hashtbl; mddev_t *mddev; - mdk_thread_t *thread, *resync_thread; + mdk_thread_t *thread; struct disk_info disks[MD_SB_DISKS]; struct disk_info *spare; int chunk_size, level, algorithm; int raid_disks, working_disks, failed_disks; - int resync_parity; int max_nr_stripes; struct list_head handle_list; /* stripes needing handling */ |
