diff options
author | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:22 -0400 |
---|---|---|
committer | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:22 -0400 |
commit | a0da84f35b25875870270d16b6eccda4884d61a7 (patch) | |
tree | 3c092bcef7a8c8704054b02197156e1c803306b2 /include/linux/raid | |
parent | 0e13fe23a00ad88c737d91d94a050707c6139ce4 (diff) |
Improve setting of "events_cleared" for write-intent bitmaps.
When an array is degraded, bits in the write-intent bitmap are not
cleared, so that if the missing device is re-added, it can be synced
by only updated those parts of the device that have changed since
it was removed.
The enable this a 'events_cleared' value is stored. It is the event
counter for the array the last time that any bits were cleared.
Sometimes - if a device disappears from an array while it is 'clean' -
the events_cleared value gets updated incorrectly (there are subtle
ordering issues between updateing events in the main metadata and the
bitmap metadata) resulting in the missing device appearing to require
a full resync when it is re-added.
With this patch, we update events_cleared precisely when we are about
to clear a bit in the bitmap. We record events_cleared when we clear
the bit internally, and copy that to the superblock which is written
out before the bit on storage. This makes it more "obviously correct".
We also need to update events_cleared when the event_count is going
backwards (as happens on a dirty->clean transition of a non-degraded
array).
Thanks to Mike Snitzer for identifying this problem and testing early
"fixes".
Cc: "Mike Snitzer" <snitzer@gmail.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'include/linux/raid')
-rw-r--r-- | include/linux/raid/bitmap.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 78bfdea24a8..e98900671ca 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -221,6 +221,7 @@ struct bitmap { | |||
221 | unsigned long syncchunk; | 221 | unsigned long syncchunk; |
222 | 222 | ||
223 | __u64 events_cleared; | 223 | __u64 events_cleared; |
224 | int need_sync; | ||
224 | 225 | ||
225 | /* bitmap spinlock */ | 226 | /* bitmap spinlock */ |
226 | spinlock_t lock; | 227 | spinlock_t lock; |