[DRBD-cvs] drbd by phil; Now it compiles on 2.4.24 again.

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Fri, 25 Jun 2004 11:44:25 +0200 (CEST)


DRBD CVS committal

Author  : phil
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	Makefile-2.4 drbd_bitmap.c drbd_compat_types.h 
	drbd_compat_wrappers.h drbd_int.h 


Log Message:
Now it compiles on 2.4.24 again.

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/Makefile-2.4,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- Makefile-2.4	8 Jun 2004 12:04:35 -0000	1.1.2.2
+++ Makefile-2.4	25 Jun 2004 09:44:20 -0000	1.1.2.3
@@ -1,4 +1,4 @@
-drbd-objs  := drbd_fs.o drbd_proc.o drbd_dsender.o \
+drbd-objs  := drbd_bitmap.o drbd_fs.o drbd_proc.o drbd_dsender.o \
 	      drbd_receiver.o drbd_req-2.4.o drbd_actlog.o \
 	      lru_cache.o mempool-2.4.o drbd_main.o
 obj-$(CONFIG_BLK_DEV_DRBD)     += drbd.o
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_bitmap.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- drbd_bitmap.c	18 Jun 2004 12:45:05 -0000	1.1.2.5
+++ drbd_bitmap.c	25 Jun 2004 09:44:20 -0000	1.1.2.6
@@ -145,7 +145,6 @@
 
 
 /* long word offset of _bitmap_ sector */
-//#define S2W(s)	((s)<<(12-LN2_BPL))
 #define S2W(s)	((s)<<(BM_EXT_SIZE_B-BM_BLOCK_SIZE_B-LN2_BPL))
 
 /*
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_compat_types.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- drbd_compat_types.h	1 Feb 2004 12:09:31 -0000	1.1.2.5
+++ drbd_compat_types.h	25 Jun 2004 09:44:20 -0000	1.1.2.6
@@ -42,6 +42,80 @@
 #include <linux/completion.h>
 #endif
 
+#if defined(CONFIG_X86)
+/**
+ * find_first_bit - find the first set bit in a memory region
+ * @addr: The address to start the search at
+ * @size: The maximum size to search
+ *
+ * Returns the bit-number of the first set bit, not the number of the byte
+ * containing a bit.
+ */
+static __inline__ int find_first_bit(const unsigned long *addr, unsigned size)
+{
+        int d0, d1;
+        int res;
+
+        /* This looks at memory. Mark it volatile to tell gcc not to move it around */
+        __asm__ __volatile__(
+                "xorl %%eax,%%eax\n\t"
+                "repe; scasl\n\t"
+                "jz 1f\n\t"
+                "leal -4(%%edi),%%edi\n\t"
+                "bsfl (%%edi),%%eax\n"
+                "1:\tsubl %%ebx,%%edi\n\t"
+                "shll $3,%%edi\n\t"
+                "addl %%edi,%%eax"
+                :"=a" (res), "=&c" (d0), "=&D" (d1)
+                :"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+        return res;
+}
+
+/**
+ * find_next_bit - find the first set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+
+static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
+{
+        const unsigned long *p = addr + (offset >> 5);
+        int set = 0, bit = offset & 31, res;
+
+        if (bit) {
+                /*
+                 * Look for nonzero in the first 32 bits:
+                 */
+                __asm__("bsfl %1,%0\n\t"
+                        "jne 1f\n\t"
+                        "movl $32, %0\n"
+                        "1:"
+                        : "=r" (set)
+                        : "r" (*p >> bit));
+                if (set < (32 - bit))
+                        return set + offset;
+                set = 32 - bit;
+                p++;
+        }
+        /*
+         * No set bit yet, search remaining full words for a bit
+         */
+        res = find_first_bit (p, size - 32 * (p - addr));
+        return (offset + set + res);
+}
+
+#else
+#warn You probabely need to copy find_next_bit() from a 2.6.x kernel.
+#endif
+
+#ifndef ALIGN
+#define ALIGN(x,s) (((x) + (s - 1)) & ~(s - 1))
+#endif
+
+#ifndef BUG_ON
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#endif
 
 #else // LINUX 2.6
 //#warning "FIXME"
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_compat_wrappers.h,v
retrieving revision 1.1.2.46
retrieving revision 1.1.2.47
diff -u -3 -r1.1.2.46 -r1.1.2.47
--- drbd_compat_wrappers.h	15 Jun 2004 15:44:52 -0000	1.1.2.46
+++ drbd_compat_wrappers.h	25 Jun 2004 09:44:20 -0000	1.1.2.47
@@ -244,6 +244,8 @@
 
 static inline void drbd_generic_make_request(int rw, struct buffer_head *bh)
 {
+	drbd_dev *mdev = drbd_conf -1 ;
+	
 	if (!bh->b_rdev) {
 		if (DRBD_ratelimit(5*HZ,5)) {
 			printk(KERN_ERR "drbd_generic_make_request: bh->b_rdev == NULL\n");
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_int.h,v
retrieving revision 1.58.2.175
retrieving revision 1.58.2.176
diff -u -3 -r1.58.2.175 -r1.58.2.176
--- drbd_int.h	17 Jun 2004 01:44:36 -0000	1.58.2.175
+++ drbd_int.h	25 Jun 2004 09:44:20 -0000	1.58.2.176
@@ -32,6 +32,7 @@
 #include <linux/list.h>
 #include <linux/sched.h>
 #include <linux/bitops.h>
+#include <linux/slab.h> 
 #include "lru_cache.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)