summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2004-08-23 21:28:31 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-23 21:28:31 -0700
commit32c31806b1d70b73aa7cab95308199f3d710ff3d (patch)
treee0870b3e6211f36f3f4c5dc8facbca11ed1a25bb /include
parentb60e5e711ad490216cc39f0cdfac91a789d85694 (diff)
[PATCH] md: assorted fixes/improvemnet to generic md resync code.
1/ Introduce "mddev->resync_max_sectors" so that an md personality can ask for resync to cover a different address range than that of a single drive. raid10 will use this. 2/ fix is_mddev_idle so that if there seem to be a negative number of events, it doesn't immediately assume activity. 3/ make "sync_io" (the count of IO sectors used for array resync) an atomic_t to avoid SMP races. 4/ Pass md_sync_acct a "block_device" rather than the containing "rdev", as the whole rdev isn't needed. Also make this an inline function. 5/ Make sure recovery gets interrupted on any error. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/raid/md.h1
-rw-r--r--include/linux/raid/md_k.h6
3 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 884d18df6716..d69d9929d4f3 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -100,7 +100,7 @@ struct gendisk {
struct timer_rand_state *random;
int policy;
- unsigned sync_io; /* RAID */
+ atomic_t sync_io; /* RAID */
unsigned long stamp, stamp_idle;
int in_flight;
#ifdef CONFIG_SMP
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 9c06e776cfc2..d9e292ebe417 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -74,7 +74,6 @@ extern void md_write_start(mddev_t *mddev);
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);
extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev);
extern void md_unplug_mddev(mddev_t *mddev);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index faa400cf25e4..0df257d898bb 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -216,6 +216,7 @@ struct mddev_s
unsigned long resync_mark; /* a recent timestamp */
sector_t resync_mark_cnt;/* blocks written at resync_mark */
+ sector_t resync_max_sectors; /* may be set by personality */
/* recovery/resync flags
* NEEDED: we might need to start a resync/recover
* RUNNING: a thread is running, or about to be started
@@ -263,6 +264,11 @@ static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
}
+static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
+{
+ atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
+}
+
struct mdk_personality_s
{
char *name;