diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-09-09 19:23:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 19:39:12 -0400 |
commit | 72626685dc66d455742a7f215a0535c551628b9e (patch) | |
tree | 91e19a61a5a3b782007132b6b2e353e8936dd656 /include/linux | |
parent | 0002b2718dd04da67c21f8a7830de8d95a9b0345 (diff) |
[PATCH] md: add write-intent-bitmap support to raid5
Most awkward part of this is delaying write requests until bitmap updates have
been flushed.
To achieve this, we have a sequence number (seq_flush) which is incremented
each time the raid5 is unplugged.
If the raid thread notices that this has changed, it flushes bitmap changes,
and assigned the value of seq_flush to seq_write.
When a write request arrives, it is given the number from seq_write, and that
write request may not complete until seq_flush is larger than the saved seq
number.
We have a new queue for storing stripes which are waiting for a bitmap flush
and an extra flag for stripes to record if the write was 'degraded' and so
should not clear the a bit in the bitmap.
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/linux')
-rw-r--r-- | include/linux/raid/raid5.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index d63ddcb4afad..176fc653c284 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -134,6 +134,7 @@ struct stripe_head { | |||
134 | unsigned long state; /* state flags */ | 134 | unsigned long state; /* state flags */ |
135 | atomic_t count; /* nr of active thread/requests */ | 135 | atomic_t count; /* nr of active thread/requests */ |
136 | spinlock_t lock; | 136 | spinlock_t lock; |
137 | int bm_seq; /* sequence number for bitmap flushes */ | ||
137 | struct r5dev { | 138 | struct r5dev { |
138 | struct bio req; | 139 | struct bio req; |
139 | struct bio_vec vec; | 140 | struct bio_vec vec; |
@@ -165,12 +166,13 @@ struct stripe_head { | |||
165 | /* | 166 | /* |
166 | * Stripe state | 167 | * Stripe state |
167 | */ | 168 | */ |
168 | #define STRIPE_ERROR 1 | ||
169 | #define STRIPE_HANDLE 2 | 169 | #define STRIPE_HANDLE 2 |
170 | #define STRIPE_SYNCING 3 | 170 | #define STRIPE_SYNCING 3 |
171 | #define STRIPE_INSYNC 4 | 171 | #define STRIPE_INSYNC 4 |
172 | #define STRIPE_PREREAD_ACTIVE 5 | 172 | #define STRIPE_PREREAD_ACTIVE 5 |
173 | #define STRIPE_DELAYED 6 | 173 | #define STRIPE_DELAYED 6 |
174 | #define STRIPE_DEGRADED 7 | ||
175 | #define STRIPE_BIT_DELAY 8 | ||
174 | 176 | ||
175 | /* | 177 | /* |
176 | * Plugging: | 178 | * Plugging: |
@@ -210,10 +212,20 @@ struct raid5_private_data { | |||
210 | 212 | ||
211 | struct list_head handle_list; /* stripes needing handling */ | 213 | struct list_head handle_list; /* stripes needing handling */ |
212 | struct list_head delayed_list; /* stripes that have plugged requests */ | 214 | struct list_head delayed_list; /* stripes that have plugged requests */ |
215 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ | ||
213 | atomic_t preread_active_stripes; /* stripes with scheduled io */ | 216 | atomic_t preread_active_stripes; /* stripes with scheduled io */ |
214 | 217 | ||
215 | char cache_name[20]; | 218 | char cache_name[20]; |
216 | kmem_cache_t *slab_cache; /* for allocating stripes */ | 219 | kmem_cache_t *slab_cache; /* for allocating stripes */ |
220 | |||
221 | int seq_flush, seq_write; | ||
222 | int quiesce; | ||
223 | |||
224 | int fullsync; /* set to 1 if a full sync is needed, | ||
225 | * (fresh device added). | ||
226 | * Cleared when a sync completes. | ||
227 | */ | ||
228 | |||
217 | /* | 229 | /* |
218 | * Free stripes pool | 230 | * Free stripes pool |
219 | */ | 231 | */ |