summaryrefslogtreecommitdiff
path: root/include/linux/raid
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2002-08-22 21:27:25 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-08-22 21:27:25 -0700
commit09b63e46124f134b1982705ca9221c63271df2a7 (patch)
treeb82065fa78b4b2a0a60762e4f4e6b17e36dde4fc /include/linux/raid
parent0ce3712f092a9c9f91d58c321ea864c119d13fd4 (diff)
[PATCH] md: Remove per-personality 'operational' and 'write_only' flags
raid1, raid5 and multipath maintain their own 'operational' flag. This is equivalent to !rdev->faulty and so isn't needed. Similarly raid1 and raid1 maintain a "write_only" flag that is equivalnt to !rdev->in_sync so it isn't needed either. As part of implementing this change, we introduce some extra flag bit in raid5 that are meaningful only inside 'handle_stripe'. Some of these replace the "action" array which recorded what actions were required (and would be performed after the stripe spinlock was released). This has the advantage of reducing our dependance on MD_SB_DISKS which personalities shouldn't need to know about.
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/md.h3
-rw-r--r--include/linux/raid/md_k.h15
-rw-r--r--include/linux/raid/multipath.h5
-rw-r--r--include/linux/raid/raid1.h6
-rw-r--r--include/linux/raid/raid5.h7
5 files changed, 20 insertions, 16 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index f2d44e5fcd0b..a9cca6e4da8f 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -77,8 +77,7 @@ extern void md_wakeup_thread(mdk_thread_t *thread);
extern void md_interrupt_thread (mdk_thread_t *thread);
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 int md_error (mddev_t *mddev, mdk_rdev_t *rdev);
-extern int md_run_setup(void);
+extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev);
extern void md_print_devices (void);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 721aa5d478d0..3c88b7882227 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -154,6 +154,16 @@ struct mdk_rdev_s
mdp_super_t *sb;
unsigned long sb_offset;
+ /* A device can be in one of three states based on two flags:
+ * Not working: faulty==1 in_sync==0
+ * Fully working: faulty==0 in_sync==1
+ * Working, but not
+ * in sync with array
+ * faulty==0 in_sync==0
+ *
+ * It can never have faulty==1, in_sync==1
+ * This reduces the burden of testing multiple flags in many cases
+ */
int faulty; /* if faulty do not issue IO requests */
int in_sync; /* device is a full member of the array */
@@ -227,7 +237,10 @@ struct mdk_personality_s
int (*run)(mddev_t *mddev);
int (*stop)(mddev_t *mddev);
int (*status)(char *page, mddev_t *mddev);
- int (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
+ /* error_handler must set ->faulty and clear ->in_sync
+ * if appropriate, and should abort recovery if needed
+ */
+ void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
int (*hot_remove_disk) (mddev_t *mddev, int number);
int (*spare_active) (mddev_t *mddev);
diff --git a/include/linux/raid/multipath.h b/include/linux/raid/multipath.h
index f95a77eb2982..50db7f3c8c57 100644
--- a/include/linux/raid/multipath.h
+++ b/include/linux/raid/multipath.h
@@ -6,11 +6,6 @@
struct multipath_info {
mdk_rdev_t *rdev;
-
- /*
- * State bits:
- */
- int operational;
};
struct multipath_private_data {
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 7e7cf996d865..7095e77cb63e 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -8,12 +8,6 @@ typedef struct mirror_info mirror_info_t;
struct mirror_info {
mdk_rdev_t *rdev;
sector_t head_position;
-
- /*
- * State bits:
- */
- int operational;
- int write_only;
};
typedef struct r1bio_s r1bio_t;
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 5e63e608b5eb..9d08de50d13a 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -148,6 +148,11 @@ struct stripe_head {
#define R5_UPTODATE 0 /* page contains current data */
#define R5_LOCKED 1 /* IO has been submitted on "req" */
#define R5_OVERWRITE 2 /* towrite covers whole page */
+/* and some that are internal to handle_stripe */
+#define R5_Insync 3 /* rdev && rdev->in_sync at start */
+#define R5_Wantread 4 /* want to schedule a read */
+#define R5_Wantwrite 5
+#define R5_Syncio 6 /* this io need to be accounted as resync io */
/*
* Write method
@@ -193,8 +198,6 @@ struct stripe_head {
struct disk_info {
mdk_rdev_t *rdev;
- int operational;
- int write_only;
};
struct raid5_private_data {