Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Alasdair G Kergon and committed by
Linus Torvalds
8a835f11 29121bd0

+5 -1
+5 -1
drivers/md/dm-log.c
··· 447 447 if (r) 448 448 return r; 449 449 450 - /* set or clear any new bits */ 450 + /* set or clear any new bits -- device has grown */ 451 451 if (lc->sync == NOSYNC) 452 452 for (i = lc->header.nr_regions; i < lc->region_count; i++) 453 453 /* FIXME: amazingly inefficient */ ··· 456 456 for (i = lc->header.nr_regions; i < lc->region_count; i++) 457 457 /* FIXME: amazingly inefficient */ 458 458 log_clear_bit(lc, lc->clean_bits, i); 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); 459 463 460 464 /* copy clean across to sync */ 461 465 memcpy(lc->sync_bits, lc->clean_bits, size);