Skip to content

Commit

Permalink
[PATCH] dm mirror log: sync_count fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed Jun 26, 2006
1 parent 29121bd commit 8a835f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/md/dm-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int disk_resume(struct dirty_log *log)
if (r)
return r;

/* set or clear any new bits */
/* set or clear any new bits -- device has grown */
if (lc->sync == NOSYNC)
for (i = lc->header.nr_regions; i < lc->region_count; i++)
/* FIXME: amazingly inefficient */
Expand All @@ -457,6 +457,10 @@ static int disk_resume(struct dirty_log *log)
/* FIXME: amazingly inefficient */
log_clear_bit(lc, lc->clean_bits, i);

/* clear any old bits -- device has shrunk */
for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++)
log_clear_bit(lc, lc->clean_bits, i);

/* copy clean across to sync */
memcpy(lc->sync_bits, lc->clean_bits, size);
lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count);
Expand Down

0 comments on commit 8a835f1

Please sign in to comment.