[DRBD-cvs] drbd by lars; * fix ifdefs in drbd_int.h * move #inclu...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Tue, 8 Jun 2004 14:46:38 +0200 (CEST)


DRBD CVS committal

Author  : lars
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_dsender.c drbd_fs.c drbd_int.h drbd_main.c 


Log Message:
* fix ifdefs in drbd_int.h
* move #include bitops.h into drbd_int.h
* two debug fixmes in drbd_fs.c -> BUG_ON

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_dsender.c,v
retrieving revision 1.1.2.118
retrieving revision 1.1.2.119
diff -u -3 -r1.1.2.118 -r1.1.2.119
--- drbd_dsender.c	8 Jun 2004 12:04:35 -0000	1.1.2.118
+++ drbd_dsender.c	8 Jun 2004 12:46:33 -0000	1.1.2.119
@@ -30,7 +30,6 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
-#include <linux/bitops.h>
 #include <linux/sched.h>
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_fs.c,v
retrieving revision 1.28.2.102
retrieving revision 1.28.2.103
diff -u -3 -r1.28.2.102 -r1.28.2.103
--- drbd_fs.c	7 Jun 2004 13:38:10 -0000	1.28.2.102
+++ drbd_fs.c	8 Jun 2004 12:46:33 -0000	1.28.2.103
@@ -693,14 +693,23 @@
 	if ( !mdev->act_log ||
 	     mdev->act_log->nr_elements != mdev->sync_conf.al_extents )	{
 		struct lru_cache *n,*t;
+		struct lc_element *e;
+		unsigned int in_use=0;
+		int i;
 		n = lc_alloc(mdev->sync_conf.al_extents,
 			     sizeof(struct lc_element), mdev);
-		// FIXME if (n==NULL) scream out loud ...
-		// FIXME if (still_in_use) BUG();
+		D_ASSERT(n); // FIXME if (n==NULL) scream out loud ...
 		spin_lock_irq(&mdev->al_lock);
 		t = mdev->act_log;
 		mdev->act_log = n;
 		spin_unlock_irq(&mdev->al_lock);
+		for (i=0; i < t->nr_elements; i++) {
+			e = lc_entry(t,i);
+			if (e->refcnt)
+				ERR("refcnt(%d)==%d\n", e->lc_number, e->refcnt);
+			in_use += e->refcnt;
+		}
+		BUG_ON(in_use);
 		if (t) lc_free(t);
 	}
 
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_int.h,v
retrieving revision 1.58.2.169
retrieving revision 1.58.2.170
diff -u -3 -r1.58.2.169 -r1.58.2.170
--- drbd_int.h	7 Jun 2004 12:58:38 -0000	1.58.2.169
+++ drbd_int.h	8 Jun 2004 12:46:33 -0000	1.58.2.170
@@ -31,6 +31,7 @@
 #include <linux/version.h>
 #include <linux/list.h>
 #include <linux/sched.h>
+#include <linux/bitops.h>
 #include "lru_cache.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -1312,7 +1313,7 @@
 #endif
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#ifndef sector_div
 # define sector_div(n, b)( \
 { \
 	int _res; \
@@ -1321,6 +1322,9 @@
 	_res; \
 } \
 )
+#endif
+
+#ifndef hweight_long
 # if (BITS_PER_LONG > 32)
 static inline unsigned long hweight64(__u64 w)
 {
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.184
retrieving revision 1.73.2.185
diff -u -3 -r1.73.2.184 -r1.73.2.185
--- drbd_main.c	8 Jun 2004 12:04:35 -0000	1.73.2.184
+++ drbd_main.c	8 Jun 2004 12:46:33 -0000	1.73.2.185
@@ -39,7 +39,6 @@
 #include <asm/uaccess.h>
 #include <asm/types.h>
 #include <net/sock.h>
-#include <linux/bitops.h>
 #include <linux/smp_lock.h>
 #include <linux/fs.h>
 #include <linux/file.h>