[dm-devel] [PATCH] Fix persistant mirror reactivation

AJ Lewis alewis at redhat.com
Thu Apr 15 18:40:27 UTC 2004


The attached patch against 2.6.5-udm4 fixes persistant mirror reactivation:
  - count_bits() fxn was broken.  It went into an infinite loop because n
    was
    never incremented.
  - the size parameter passed into the find_*_bit fxns from count_bits() was
    also wrong - it needs to be in bits, not bytes.

Regards,
-- 
AJ Lewis                                   Voice:  612-638-0500
Red Hat Inc.                               E-Mail: alewis at redhat.com
720 Washington Ave. SE, Suite 200
Minneapolis, MN 55414

Current GPG fingerprint = FE77 4B43 6A9B F982 A731  02FA 2BF5 7574 294A AA5A
Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the
many keyservers out there...
-----Begin Obligatory Humorous Quote----------------------------------------
Sticks and stones may break my bones, and so would an 80 lb. carrot.
-----End Obligatory Humorous Quote------------------------------------------
-------------- next part --------------
Fix persistant mirror reactivation
  - count_bits() fxn was broken.  It went into an infinite loop because n was
    never incremented.
  - the size parameter passed into the find_*_bit fxns from count_bits() was
    also wrong - it needs to be in bits, not bytes.
--- diff/drivers/md/dm-log.c	2004-04-14 16:22:54.111484595 -0500
+++ source/drivers/md/dm-log.c	2004-04-15 13:06:31.323250244 -0500
@@ -426,23 +426,16 @@
 
 static int count_bits(unsigned long *addr, unsigned size)
 {
-	/* FIXME: test this */
-#if 1
 	int n, count = 0;
+	unsigned long bitsize = size << 3;
 
-	n = find_first_bit(addr, size);
-	while (n < size) {
+	n = find_first_bit(addr, bitsize);
+	while (n < bitsize) {
 		count++;
-		find_next_bit(addr, size, n + 1);
+		n = find_next_bit(addr, bitsize, n + 1);
 	}
 
 	return count;
-#else
-	int count = 0;
-        for (i = 0; i < lc->region_count; i++)
-                count += log_test_bit(lc->sync_bits, i);
-	return count;
-#endif
 }
 
 static int disk_resume(struct dirty_log *log)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20040415/3ed5100d/attachment.sig>


More information about the dm-devel mailing list