diff options
author | Alasdair G Kergon <agk@redhat.com> | 2006-06-26 03:27:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:35 -0400 |
commit | 8a835f11bce68ed990533e49b5dedb00bee46d71 (patch) | |
tree | 8311b7c5b722fdf1a2b1c7267098ca0c05bd9a54 | |
parent | 29121bd0b00ebb9524971a583fea4a2f7afe8041 (diff) |
[PATCH] dm mirror log: sync_count fix
When a mirror is reduced in size, clear the part of the bitmap that is no
longer used.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/md/dm-log.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 33d80721667c..ba98bf57c7c0 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
@@ -447,7 +447,7 @@ static int disk_resume(struct dirty_log *log) | |||
447 | if (r) | 447 | if (r) |
448 | return r; | 448 | return r; |
449 | 449 | ||
450 | /* set or clear any new bits */ | 450 | /* set or clear any new bits -- device has grown */ |
451 | if (lc->sync == NOSYNC) | 451 | if (lc->sync == NOSYNC) |
452 | for (i = lc->header.nr_regions; i < lc->region_count; i++) | 452 | for (i = lc->header.nr_regions; i < lc->region_count; i++) |
453 | /* FIXME: amazingly inefficient */ | 453 | /* FIXME: amazingly inefficient */ |
@@ -457,6 +457,10 @@ static int disk_resume(struct dirty_log *log) | |||
457 | /* FIXME: amazingly inefficient */ | 457 | /* FIXME: amazingly inefficient */ |
458 | log_clear_bit(lc, lc->clean_bits, i); | 458 | log_clear_bit(lc, lc->clean_bits, i); |
459 | 459 | ||
460 | /* clear any old bits -- device has shrunk */ | ||
461 | for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++) | ||
462 | log_clear_bit(lc, lc->clean_bits, i); | ||
463 | |||
460 | /* copy clean across to sync */ | 464 | /* copy clean across to sync */ |
461 | memcpy(lc->sync_bits, lc->clean_bits, size); | 465 | memcpy(lc->sync_bits, lc->clean_bits, size); |
462 | lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count); | 466 | lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count); |