[DRBD-cvs] drbd by phil; Whow! another one in the bitmap code. Th...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Sun, 7 Mar 2004 11:52:03 +0100 (CET)


DRBD CVS committal

Author  : phil
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_main.c 


Log Message:
Whow! another one in the bitmap code. This one fired as soon as the
device sice is something like 256M or 1G... I should wear a brown
paper bag for some days, for these kind of bugs.

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.140
retrieving revision 1.73.2.141
diff -u -3 -r1.73.2.140 -r1.73.2.141
--- drbd_main.c	7 Mar 2004 08:46:37 -0000	1.73.2.140
+++ drbd_main.c	7 Mar 2004 10:51:57 -0000	1.73.2.141
@@ -1857,9 +1857,9 @@
 	bnr = sbm->gs_bitnr;
 
 	// optimization possible, search word != 0 first...
-	while (!test_bit(bnr & BPLM, bm + (bnr>>LN2_BPL))) {
+	while( (bnr>>3) < sbm->size ) {
+		if(test_bit(bnr & BPLM, bm + (bnr>>LN2_BPL))) break;
 		bnr++;
-		if((bnr>>3) >= sbm->size) break;
 	}
 
 	ret=bnr<<BM_SS;