[DRBD-cvs] r1546 - in trunk: drbd drbd/linux scripts

svn at svn.drbd.org svn at svn.drbd.org
Tue Sep 21 01:48:22 CEST 2004


Author: lars
Date: 2004-09-21 01:48:20 +0200 (Tue, 21 Sep 2004)
New Revision: 1546

Removed:
   trunk/drbd/Makefile-2.4
   trunk/drbd/drbd_compat_types.h
   trunk/drbd/mempool-2.4.c
   trunk/drbd/mempool.h
   trunk/scripts/adjust_drbd_config_h.sh
Modified:
   trunk/drbd/Makefile
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_compat_wrappers.h
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_worker.c
   trunk/drbd/linux/drbd_config.h
   trunk/drbd/lru_cache.h
Log:

started to remove 2.4 compatibility crap

 * got rid of 2.4 specific files
 * got rid of drbd_compat_types.h and macros/types defined therein
 * got rid of all compatibility defines in drbd_config.h and their #ifdef branches
 * got rid of all #if LINUX_VERSION_CODE <=> KERNEL_VERSION
 * folded some inline wrappers which no longer make sense directly into the code
 * no more disable_io_hints
 * started to clean up Makefile a little

 drbd/Makefile                   |   39 ----
 drbd/Makefile-2.4               |   11 -
 drbd/drbd_actlog.c              |   28 ---
 drbd/drbd_compat_types.h        |  263 -------------------------------
 drbd/drbd_compat_wrappers.h     |  337 ----------------------------------------
 drbd/drbd_fs.c                  |  138 +---------------
 drbd/drbd_int.h                 |  137 +---------------
 drbd/drbd_main.c                |  170 +-------------------
 drbd/drbd_receiver.c            |  128 ++++-----------
 drbd/drbd_req.c                 |   23 --
 drbd/drbd_worker.c              |  144 -----------------
 drbd/linux/drbd_config.h        |   25 --
 drbd/lru_cache.h                |    7 
 drbd/mempool-2.4.c              |  335 ---------------------------------------
 drbd/mempool.h                  |   49 -----
 scripts/adjust_drbd_config_h.sh |  116 -------------
 16 files changed, 89 insertions(+), 1861 deletions(-)

quite impressive :-)
still a way to go, though ...



Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/Makefile	2004-09-20 23:48:20 UTC (rev 1546)
@@ -31,12 +31,12 @@
   ifneq ($(VERSION),2)
     $(error "won't compile with this kernel version")
   endif
-  ifeq ($(findstring $(PATCHLEVEL),46),$(PATCHLEVEL))
-    include $(DRBDSRC)/Makefile-2.$(PATCHLEVEL)
-  else
+  ifneq ($(PATCHLEVEL),6)
     $(error "won't compile with this kernel version")
   endif
 
+  include $(DRBDSRC)/Makefile-2.6
+
   override CFLAGS += -I$(DRBDSRC)
   # remember KERNELRELEASE for install target
   # .kernelversion can be included in Makefile as well as
@@ -54,8 +54,6 @@
   CONFIG_BLK_DEV_DRBD := m
   export DRBDSRC CONFIG_BLK_DEV_DRBD
 
-  KDIR_Makefile_PATCHLEVEL = $(shell grep "^PATCHLEVEL = " $(KDIR)/Makefile | cut -d " " -f 3)
-
   # to be overridden on command line:
   PREFIX := /
   ifeq ($(wildcard ../build-for-uml),../build-for-uml)
@@ -97,15 +95,9 @@
 
   kbuild: drbd_buildtag.c
 	@rm -f .kernelrelease*
-	-test -x ../scripts/adjust_drbd_config_h.sh && \
-	 KDIR=$(KDIR) ../scripts/adjust_drbd_config_h.sh
-  ifeq ($(KDIR_Makefile_PATCHLEVEL),4)
-	$(MAKE) -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
-  else
-    # since 2.6.6 (suse: 2.6.5-dunno), this should be:
-    # $(MAKE) -C $(KDIR) M=$(DRBDSRC) $(ARCH_UM) modules
-	$(MAKE) -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
-  endif
+    # previous to 2.6.6 (suse: 2.6.5-dunno), this should be:
+    # $(MAKE) -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
+	$(MAKE) -C $(KDIR) M=$(DRBDSRC) $(ARCH_UM) modules
 	@mv .kernelrelease.new .kernelrelease
 	@echo -n "Memorizing module configuration ... "
 	@{ echo -e "#\n# drbd.o was compiled with"          ; \
@@ -120,16 +112,6 @@
 	  cat $(KDIR)/.config ; } | gzip > .kernel.config.gz
 	@echo "done."
 
-  ifneq ($(KDIR_Makefile_PATCHLEVEL),6)
-    # obsolete in 2.6 ...
-    dep:
-	@echo "trying to make dep ..."
-	@$(MAKE) -s -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) dep || \
-         echo "I'll ignore this error, but this can cause inconsistencies!"
-
-    kbuild: dep
-  endif
-
   clean:
 	rm -f *.[oas] *.ko .*.cmd .*.d .*.tmp *.mod.c .*.flags .depend .kernel*
 
@@ -138,13 +120,8 @@
   ifneq ($(wildcard .kernelrelease),)
     # for VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION, KERNELRELEASE
     include .kernelrelease
-    MODOBJ-4 := drbd.o
-    MODOBJ-6 := drbd.ko
-    MODOBJ   := $(MODOBJ-$(PATCHLEVEL))
-    MODSUBDIR := $(strip \
-      $(if $(wildcard /lib/modules/$(KERNELRELEASE)/kernel),\
-           kernel/drivers/block,\
-           block))
+    MODOBJ := drbd.ko
+    MODSUBDIR := kernel/drivers/block
     LINUX := $(wildcard /lib/modules/$(KERNELRELEASE)/build)
 
     install:

Deleted: trunk/drbd/Makefile-2.4
===================================================================
--- trunk/drbd/Makefile-2.4	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/Makefile-2.4	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,11 +0,0 @@
-drbd-objs  := drbd_buildtag.o drbd_bitmap.o drbd_fs.o drbd_proc.o \
-	      drbd_worker.o drbd_receiver.o drbd_req.o drbd_actlog.o \
-	      lru_cache.o mempool-2.4.o drbd_main.o
-obj-$(CONFIG_BLK_DEV_DRBD)     += drbd.o
-
-list-multi := drbd.o
-
-include $(TOPDIR)/Rules.make
-
-drbd.o: $(drbd-objs)
-	$(LD) -r -o $@ $(drbd-objs)

Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_actlog.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -34,36 +34,9 @@
  * ;)
  * this is mostly from drivers/md/md.c
  */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 STATIC int _drbd_md_sync_page_io(drbd_dev *mdev, struct page *page, 
 				 sector_t sector, int rw, int size)
 {
-	struct buffer_head bh;
-	struct completion event;
-	int ok;
-
-	init_completion(&event);
-	init_buffer(&bh, drbd_md_io_complete, &event);
-	bh.b_rdev = mdev->md_bdev;
-	bh.b_rsector = sector;
-	bh.b_state = (1 << BH_Req) | (1 << BH_Mapped) | (1 << BH_Lock);
-	bh.b_size = size; 
-	bh.b_page = page;
-	bh.b_reqnext = NULL;
-	bh.b_data = page_address(page);
-	generic_make_request(rw, &bh);
-
-	run_task_queue(&tq_disk);
-	wait_for_completion(&event);
-
-	ok = test_bit(BH_Uptodate, &bh.b_state);
-
-	return ok;
-}
-#else
-STATIC int _drbd_md_sync_page_io(drbd_dev *mdev, struct page *page, 
-				 sector_t sector, int rw, int size)
-{
 	struct bio bio;
 	struct bio_vec vec;
 	struct completion event;
@@ -95,7 +68,6 @@
 
 	return ok;
 }
-#endif
 
 int drbd_md_sync_page_io(drbd_dev *mdev, sector_t sector, int rw)
 {

Deleted: trunk/drbd/drbd_compat_types.h
===================================================================
--- trunk/drbd/drbd_compat_types.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_compat_types.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,263 +0,0 @@
-
-// currently only abstraction layer to get all references to buffer_head
-// and b_some_thing out of our .c files.
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/highmem.h>
-
-typedef struct buffer_head drbd_bio_t;
-typedef unsigned long sector_t;
-
-#define NOT_IN_26(x...)		x
-#define ONLY_IN_26(x...)
-
-#if !defined(CONFIG_HIGHMEM) && !defined(bh_kmap)
-#define bh_kmap(bh)	((bh)->b_data)
-#define bh_kunmap(bh)	do { } while (0)
-#endif
-
-#ifndef list_for_each
-#define list_for_each(pos, head) \
-	for(pos = (head)->next; pos != (head); pos = pos->next)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) && !defined(REDHAT_2_4_18)
-#define BH_Launder BH_launder
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
-#define min_t(type,x,y) \
-	({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-	({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-#define MODULE_LICENSE(L)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7)
-#define completion semaphore
-#define init_completion(A) init_MUTEX_LOCKED(A)
-#define wait_for_completion(A) down(A)
-#define complete(A) up(A)
-#else
-#include <linux/completion.h>
-#endif
-
-/* note that if you use some verndor kernels like SuSE,
- * their 2.4.X variant probably already contain equivalent definitions.
- * you then have to disable this compat again...
- */
-
-#ifndef HAVE_FIND_NEXT_BIT /* { */
-
-#if defined(__i386__) || defined(__arch_um__)
-/**
- * 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) : "memory");
-        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);
-}
-
-#elif defined(__alpha__)
-
-#include <asm/compiler.h>
-#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
-# define __kernel_cmpbge(a, b)          __builtin_alpha_cmpbge(a, b)
-#else
-# define __kernel_cmpbge(a, b)                                          \
-  ({ unsigned long __kir;                                               \
-     __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));      \
-     __kir; })
-#endif
-
-static inline unsigned long __ffs(unsigned long word)
-{
-#if defined(__alpha_cix__) && defined(__alpha_fix__)
-	/* Whee.  EV67 can calculate it directly.  */
-	return __kernel_cttz(word);
-#else
-	unsigned long bits, qofs, bofs;
-
-	bits = __kernel_cmpbge(0, word);
-	qofs = ffz_b(bits);
-	bits = __kernel_extbl(word, qofs);
-	bofs = ffz_b(~bits);
-
-	return qofs*8 + bofs;
-#endif
-}
-
-static inline unsigned long
-find_next_bit(void * addr, unsigned long size, unsigned long offset)
-{
-	unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= ~0UL << offset;
-		if (size < 64)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
- found_first:
-	tmp &= ~0UL >> (64 - size);
-	if (!tmp)
-		return result + size;
- found_middle:
-	return result + __ffs(tmp);
-}
-#elif defined(USE_GENERIC_FIND_NEXT_BIT)
-
-#if BITS_PER_LONG == 32
-#define  _xFFFF 31ul
-#define _x10000 32
-#define _xSHIFT  5
-#elif BITS_PER_LONG == 64
-#define  _xFFFF 63ul
-#define _x10000 64
-#define _xSHIFT  6
-#else
-#error "Unexpected BITS_PER_LONG"
-#endif
-
-/* slightly large to be inlined, but anyways... */
-static inline unsigned long
-find_next_bit(void * addr, unsigned long size, unsigned long offset)
-{
-	unsigned long * p = ((unsigned long *) addr) + (offset >> _xSHIFT);
-	unsigned long result = offset & ~_xFFFF;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= _xFFFF;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= ~0UL << offset;
-		if (size < _x10000)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= _x10000;
-		result += _x10000;
-	}
-	while (size & ~_xFFFF) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += _x10000;
-		size -= _x10000;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
- found_first:
-	tmp &= ~0UL >> (_x10000 - size);
-	if (!tmp)
-		return result + size;
- found_middle: /* if this is reached, we know that (tmp != 0) */
-	return result + generic_ffs(tmp)-1;
-}
-
-#undef _xFFFF
-#undef _x10000
-#undef _xSHIFT
-
-#else
-#warning "You probabely need to copy find_next_bit() from a 2.6.x kernel."
-#warning "Or enable low performance generic C-code"
-#warning "(USE_GENERIC_FIND_NEXT_BIT in drbd_config.h)"
-#endif
-
-#endif /* HAVE_FIND_NEXT_BIT } */
-
-#ifndef ALIGN
-#define ALIGN(x,a) ( ((x) + (a)-1) &~ ((a)-1) )
-#endif
-
-#ifndef BUG_ON
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-#endif
-
-#else // LINUX 2.6
-
-typedef struct bio drbd_bio_t;
-
-#define SIGHAND_HACK
-
-#define NOT_IN_26(x...)
-#define ONLY_IN_26(x...)	x
-
-#endif

Modified: trunk/drbd/drbd_compat_wrappers.h
===================================================================
--- trunk/drbd/drbd_compat_wrappers.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_compat_wrappers.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,337 +1,12 @@
-// currently only abstraction layer to get all references to buffer_head
-// and b_some_thing out of our .c files.
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-#define __module_get  __MOD_INC_USE_COUNT
-#define   module_put  __MOD_DEC_USE_COUNT
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
 /*
- * dump_stack() showed up in 2.4.20.
- * show_stack is arch-specific
- * The architecture-independent backtrace generator
+ * FIXME this file is bound to die, renamed or included in drbd_int.h
  */
-static inline void dump_stack(void)
-{
-        show_stack(0);
-}
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+# error "use a 2.6 kernel, please"
 #endif
 
-// b_end_io handlers
-extern void drbd_md_io_complete     (struct buffer_head *bh, int uptodate);
-extern void enslaved_read_bi_end_io (struct buffer_head *bh, int uptodate);
-extern void drbd_dio_end_sec        (struct buffer_head *bh, int uptodate);
-extern void drbd_dio_end            (struct buffer_head *bh, int uptodate);
-extern void drbd_read_bi_end_io     (struct buffer_head *bh, int uptodate);
-
-/*
- * because in 2.6.x [sg]et_capacity operate on gendisk->capacity, which is in
- * units of 512 bytes sectors, these wrappers have a <<1 or >>1 where
- * appropriate.
- */
-
-static inline sector_t drbd_get_hardsect(kdev_t dev)
-{
-	return hardsect_size[MAJOR(dev)] ?
-		hardsect_size[MAJOR(dev)][MINOR(dev)] : 512;
-}
-
-/* Returns the number of 512 byte sectors of the device */
-static inline sector_t drbd_get_capacity(kdev_t dev)
-{
-	return dev ? blk_size[MAJOR(dev)][MINOR(dev)]<<1 : 0;
-}
-
-/* sets the number of 512 byte sectors of our virtual device */
-static inline void drbd_set_my_capacity(drbd_dev *mdev, sector_t size)
-{
-	blk_size[MAJOR_NR][(int)(mdev - drbd_conf)] = (size>>1);
-}
-
-//#warning "FIXME why don't we care for the return value?"
-static inline void drbd_set_blocksize(drbd_dev *mdev, int blksize)
-{
-	set_blocksize(mdev->this_bdev, blksize);
-	if (mdev->backing_bdev)
-		set_blocksize(mdev->backing_bdev, blksize);
-	else D_ASSERT(mdev->backing_bdev);
-}
-
-static inline int drbd_sync_me(drbd_dev *mdev)
-{
-	return fsync_dev(mdev->this_bdev);
-}
-
-#define drbd_bio_uptodate(bio) buffer_uptodate(bio)
-
-static inline void drbd_bio_IO_error(struct buffer_head *bh)
-{
-	buffer_IO_error(bh);
-}
-
-static inline void drbd_bio_endio(struct buffer_head *bh, int uptodate)
-{
-	bh->b_end_io(bh,uptodate);
-}
-
-static inline drbd_dev* drbd_req_get_mdev(struct drbd_request *req)
-{
-	return (drbd_dev*) req->private_bio.b_private;
-}
-
-static inline sector_t drbd_req_get_sector(struct drbd_request *req)
-{
-	return req->private_bio.b_blocknr;
-}
-
-static inline unsigned short drbd_req_get_size(struct drbd_request *req)
-{
-	return req->private_bio.b_size;
-}
-
-static inline sector_t drbd_ee_get_sector(struct Tl_epoch_entry *ee)
-{
-	return ee->private_bio.b_blocknr;
-}
-
-static inline unsigned short drbd_ee_get_size(struct Tl_epoch_entry *ee)
-{
-	return ee->private_bio.b_size;
-}
-
-static inline char *drbd_bio_kmap(struct buffer_head *bh)
-{
-	return bh_kmap(bh);
-}
-
-static inline void drbd_bio_kunmap(struct buffer_head *bh)
-{
-	bh_kunmap(bh);
-}
-
-static inline void drbd_ee_init(struct Tl_epoch_entry *e,struct page *page)
-{
-	struct buffer_head * const bh = &e->private_bio;
-	memset(e, 0, sizeof(*e));
-
-	// bh->b_list   = BUF_LOCKED; // does it matter?
-	bh->b_size      = PAGE_SIZE;
-	bh->b_this_page = bh;
-	bh->b_state     = (1 << BH_Mapped);
-	init_waitqueue_head(&bh->b_wait);
-	set_bh_page(bh,page,0);
-	atomic_set(&bh->b_count, 1);
-
-	e->block_id = ID_VACANT;
-}
-
-static inline void drbd_bio_set_pages_dirty(struct buffer_head *bh)
-{
-	set_bit(BH_Dirty, &bh->b_state);
-}
-
-static inline void drbd_bio_set_end_io(struct buffer_head *bh, bh_end_io_t * h)
-{
-	bh->b_end_io = h;
-}
-
-static inline void
-drbd_ee_bh_prepare(drbd_dev *mdev, struct buffer_head *bh,
-		   sector_t sector, int size)
-{
-	D_ASSERT(mdev->backing_bdev);
-
-	bh->b_blocknr  = sector;	// We abuse b_blocknr here.
-	bh->b_size     = size;
-	bh->b_rsector  = sector;
-	bh->b_rdev     = mdev->backing_bdev;
-	bh->b_private  = mdev;
-	bh->b_state    = (1 << BH_Req)
-			|(1 << BH_Launder)
-	                |(1 << BH_Mapped)
-			|(1 << BH_Lock);
-}
-
-static inline void
-drbd_ee_prepare_write(drbd_dev *mdev, struct Tl_epoch_entry* e,
-		      sector_t sector, int size)
-{
-	struct buffer_head * const bh = &e->private_bio;
-
-	drbd_ee_bh_prepare(mdev,bh,sector,size);
-	set_bit(BH_Uptodate,&bh->b_state);
-	set_bit(BH_Dirty,&bh->b_state);
-	bh->b_end_io   = drbd_dio_end_sec;
-}
-
-static inline void
-drbd_ee_prepare_read(drbd_dev *mdev, struct Tl_epoch_entry* e,
-		     sector_t sector, int size)
-{
-	struct buffer_head * const bh = &e->private_bio;
-
-	drbd_ee_bh_prepare(mdev,bh,sector,size);
-	bh->b_end_io   = enslaved_read_bi_end_io;
-}
-
-static inline void
-drbd_bh_clone(struct buffer_head *bh, struct buffer_head *bh_src)
-{
-	memset(bh,0,sizeof(*bh));
-	bh->b_list    = bh_src->b_list; // BUF_LOCKED;
-	bh->b_size    = bh_src->b_size;
-	bh->b_state   = bh_src->b_state & ((1 << BH_PrivateStart)-1);
-	bh->b_page    = bh_src->b_page;
-	bh->b_data    = bh_src->b_data;
-	bh->b_rsector = bh_src->b_rsector;
-	bh->b_blocknr = bh_src->b_rsector; // We abuse b_blocknr here.
-	bh->b_dev     = bh_src->b_dev;     // hint for LVM as to
-					   // which device to call fsync_dev
-					   // on for snapshots
-	atomic_set(&bh->b_count, 1);
-	init_waitqueue_head(&bh->b_wait);
-	// other members stay NULL
-}
-
-static inline void
-drbd_req_prepare_write(drbd_dev *mdev, struct drbd_request *req)
-{
-	struct buffer_head * const bh     = &req->private_bio;
-	struct buffer_head * const bh_src =  req->master_bio;
-
-	drbd_bh_clone(bh,bh_src);
-	bh->b_rdev    = mdev->backing_bdev;
-	bh->b_private = mdev;
-	bh->b_end_io  = drbd_dio_end;
-
-	D_ASSERT(buffer_req(bh));
-	D_ASSERT(buffer_launder(bh));
-	D_ASSERT(buffer_locked(bh));
-	D_ASSERT(buffer_mapped(bh));
-	// D_ASSERT(buffer_dirty(bh)); // It is not true ?!?
-	/* kupdated keeps submitting "non-uptodate" buffers.
-	ERR_IF (!buffer_uptodate(bh)) {
-		ERR("[%s/%d]: bh_src->b_state=%lx bh->b_state=%lx\n",
-		    current->comm, current->pid,
-		    bh_src->b_state, bh->b_state);
-	};
-	*/
-
-	// FIXME should not be necessary;
-	// remove if the assertions above do not trigger.
-	bh->b_state = (1 << BH_Uptodate)
-		     |(1 << BH_Dirty)
-		     |(1 << BH_Lock)
-		     |(1 << BH_Req)
-		     |(1 << BH_Mapped) ;
-
-	req->rq_status = RQ_DRBD_NOTHING;
-}
-
-static inline void
-drbd_req_prepare_read(drbd_dev *mdev, struct drbd_request *req)
-{
-	struct buffer_head * const bh     = &req->private_bio;
-	struct buffer_head * const bh_src =  req->master_bio;
-
-	drbd_bh_clone(bh,bh_src);
-	bh->b_rdev    = mdev->backing_bdev;
-	bh->b_private = mdev;
-	bh->b_end_io  = drbd_read_bi_end_io;
-
-	D_ASSERT(buffer_req(bh));
-	D_ASSERT(buffer_launder(bh));
-	D_ASSERT(buffer_locked(bh));
-	D_ASSERT(buffer_mapped(bh));
-	D_ASSERT(!buffer_uptodate(bh));
-
-	// FIXME should not be necessary;
-	// remove if the assertions above do not trigger.
-	bh->b_state = (1 << BH_Lock)
-		     |(1 << BH_Req)
-		     |(1 << BH_Mapped) ;
-
-	req->rq_status = RQ_DRBD_NOTHING;
-}
-
-static inline struct page* drbd_bio_get_page(struct buffer_head *bh)
-{
-	return bh->b_page;
-}
-
-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");
-			dump_stack();
-		}
-		drbd_bio_IO_error(bh);
-		return;
-	}
-
-	generic_make_request(rw, bh);
-}
-
-static inline void drbd_kick_lo(drbd_dev *mdev)
-{
-	run_task_queue(&tq_disk);
-}
-
-static inline void drbd_plug_device(drbd_dev *mdev)
-{
-	D_ASSERT(mdev->state == Primary);
-	if (mdev->cstate < Connected)
-		return;
-	if (!test_and_set_bit(UNPLUG_QUEUED,&mdev->flags)) {
-		queue_task(&mdev->write_hint_tq, &tq_disk); // IO HINT
-	}
-}
-
-/* for increased performance,
- * we try to use zero copy network send whenever possible.
- *
- * maybe TODO:
- * find out whether we can use zero copy network recv, too, somehow.
- * we'd need to define some sk_read_actor_t, and then use
- * tcp_read_sock ...
- */
-static inline int _drbd_send_zc_bio(drbd_dev *mdev, struct buffer_head *bh)
-{
-	struct page *page = bh->b_page;
-	size_t size = bh->b_size;
-
-	return _drbd_send_page(mdev,page,bh_offset(bh),size);
-}
-
-/* for proto A, we cannot use zero copy network send:
- * we don't want to "ack" a send when we put a reference to it on the socket,
- * but when it actually has reached the sendbuffer (so is likely to actually be
- * on the wire in a couple of jiffies).
- */
-static inline int _drbd_send_bio(drbd_dev *mdev, struct buffer_head *bh)
-{
-	struct page *page = bh->b_page;
-	size_t size = bh->b_size;
-	int offset;
-	int ret;
-
-	if (PageHighMem(page))
-		offset = (int)(long)bh->b_data;
-	else
-		offset = (long)bh->b_data - (long)page_address(page);
-
-	ret = drbd_send(mdev, mdev->data.socket, kmap(page) + offset, size, 0);
-	kunmap(page);
-	return ret;
-}
-
-#else
-// LINUX_VERSION_CODE > 2,5,0
-
 #include <linux/buffer_head.h> // for fsync_bdev
 
 /* see get_sb_bdev and bd_claim */
@@ -645,5 +320,3 @@
 	kunmap(page);
 	return ret;
 }
-
-#endif

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_fs.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -44,30 +44,10 @@
 
 #include <linux/blkpg.h>
 
-ONLY_IN_26(
 /* see get_sb_bdev and bd_claim */
 char *drbd_sec_holder = "Secondary DRBD cannot be bd_claimed ;)";
 char *drbd_m_holder = "Hands off! this is DRBD's meta data device.";
-)
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-STATIC enum { NotMounted=0,MountedRO,MountedRW } drbd_is_mounted(int minor)
-{
-       struct super_block *sb;
-
-       sb = get_super(MKDEV(MAJOR_NR, minor));
-       if(!sb) return NotMounted;
-
-       if(sb->s_flags & MS_RDONLY) {
-	       drop_super(sb);
-	       return MountedRO;
-       }
-
-       drop_super(sb);
-       return MountedRW;
-}
-#endif
-
 STATIC int do_determin_dev_size(struct Drbd_Conf* mdev);
 int drbd_determin_dev_size(struct Drbd_Conf* mdev)
 {
@@ -236,15 +216,13 @@
 int drbd_ioctl_set_disk(struct Drbd_Conf *mdev,
 			struct ioctl_disk_config * arg)
 {
-	NOT_IN_26(int err;) // unused in 26 ?? cannot believe it ...
 	int i, md_gc_valid, minor, mput=0;
 	enum ret_codes retcode;
 	struct disk_config new_conf;
 	struct file *filp = 0;
 	struct file *filp2 = 0;
 	struct inode *inode, *inode2;
-	NOT_IN_26(kdev_t bdev, bdev2;)
-	ONLY_IN_26(struct block_device *bdev, *bdev2;)
+	struct block_device *bdev, *bdev2;
 
 	minor=(int)(mdev-drbd_conf);
 
@@ -328,7 +306,6 @@
 		goto fail_ioctl;
 	}
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	bdev = inode->i_bdev;
 	if (bd_claim(bdev, mdev)) {
 		retcode=LDMounted;
@@ -341,39 +318,7 @@
 		retcode=MDMounted;
 		goto release_bdev_fail_ioctl;
 	}
-#else
-	for(i=0;i<minor_count;i++) {
-		if( i != minor &&
-		    inode->i_rdev == drbd_conf[i].backing_bdev) {
-			retcode=LDAlreadyInUse;
-			goto fail_ioctl;
-		}
-	}
 
-	if (drbd_is_mounted(inode->i_rdev)) {
-		WARN("can not configure %d:%d, has active inodes!\n",
-		     MAJOR(inode->i_rdev), MINOR(inode->i_rdev));
-		retcode=LDMounted;
-		goto fail_ioctl;
-	}
-
-	if ((err = blkdev_open(inode, filp))) {
-		ERR("blkdev_open( %d:%d ,) returned %d\n",
-		    MAJOR(inode->i_rdev), MINOR(inode->i_rdev), err);
-		retcode=LDOpenFailed;
-		goto fail_ioctl;
-	}
-	bdev = inode->i_rdev;
-
-	if ((err = blkdev_open(inode2, filp2))) {
-		ERR("blkdev_open( %d:%d ,) returned %d\n",
-		    MAJOR(inode->i_rdev), MINOR(inode->i_rdev), err);
-		retcode=MDOpenFailed;
-		goto release_bdev_fail_ioctl;
-	}
-	bdev2 = inode2->i_rdev;
-#endif
-
 	if ( (bdev == bdev2) != (new_conf.meta_index == -1) ) {
 		retcode=LDMDInvalid;
 		goto release_bdev2_fail_ioctl;
@@ -384,7 +329,7 @@
 		goto release_bdev2_fail_ioctl;
 	}
 
-	if (drbd_get_capacity(bdev) > DRBD_MAX_SECTORS) {
+	if (drbd_get_capacity(bdev) >= (sector_t)DRBD_MAX_SECTORS) {
 		retcode = LDDeviceTooLarge;
 		goto release_bdev2_fail_ioctl;
 	}
@@ -424,12 +369,13 @@
 	mdev->read_cnt = 0;
 	mdev->writ_cnt = 0;
 
-// FIXME unclutter the code again ;)
+/* FIXME unclutter the code again...
+ * possibly rather use blk_queue_stack_limits
+ */
 /*
  * Returns the minimum that is _not_ zero, unless both are zero.
  */
 #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
-ONLY_IN_26({
 	request_queue_t * const q = mdev->rq_queue;
 	request_queue_t * const b = bdev->bd_disk->queue;
 
@@ -440,7 +386,6 @@
 	q->hardsect_size     = max((unsigned short)512,b->hardsect_size);
 	q->seg_boundary_mask = PAGE_SIZE-1;
 	D_ASSERT(q->hardsect_size <= PAGE_SIZE); // or we are really screwed ;-)
-})
 #undef min_not_zero
 
 	clear_bit(SENT_DISK_FAILURE,&mdev->flags);
@@ -520,11 +465,9 @@
 	return 0;
 
  release_bdev2_fail_ioctl:
-	NOT_IN_26(blkdev_put(filp2->f_dentry->d_inode->i_bdev,BDEV_FILE);)
-	ONLY_IN_26(bd_release(bdev2);)
+	bd_release(bdev2);
  release_bdev_fail_ioctl:
-	NOT_IN_26(blkdev_put(filp->f_dentry->d_inode->i_bdev,BDEV_FILE);)
-	ONLY_IN_26(bd_release(bdev);)
+	bd_release(bdev);
  fail_ioctl:
 	if (mput) module_put(THIS_MODULE);
 	if (filp) fput(filp);
@@ -539,7 +482,6 @@
 	struct ioctl_get_config cn;
 	memset(&cn,0,sizeof(cn));
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	if (mdev->backing_bdev) {
 		cn.lower_device_major = MAJOR(mdev->backing_bdev->bd_dev);
 		cn.lower_device_minor = MINOR(mdev->backing_bdev->bd_dev);
@@ -550,20 +492,6 @@
 		cn.meta_device_minor  = MINOR(mdev->md_bdev->bd_dev);
 		bdevname(mdev->md_bdev,cn.meta_device_name);
 	}
-#else
-	cn.lower_device_major=MAJOR(mdev->backing_bdev);
-	cn.lower_device_minor=MINOR(mdev->backing_bdev);
-	cn.meta_device_major=MAJOR(mdev->md_bdev);
-	cn.meta_device_minor=MINOR(mdev->md_bdev);
-	if (mdev->backing_bdev) {
-		strncpy(cn.lower_device_name,
-				bdevname(mdev->backing_bdev), BDEVNAME_SIZE);
-	}
-	if (mdev->md_bdev) {
-		strncpy(cn.meta_device_name,
-				bdevname(mdev->md_bdev), BDEVNAME_SIZE);
-	}
-#endif
 	cn.cstate=mdev->cstate;
 	cn.state=mdev->state;
 	cn.peer_state=mdev->o_state;
@@ -678,7 +606,6 @@
 {
 	int forced = 0;
 	int dont_have_good_data;
-	NOT_IN_26(int minor = mdev-drbd_conf;)
 
 	D_ASSERT(semaphore_is_locked(&mdev->device_mutex));
 
@@ -693,13 +620,6 @@
 	if ( (newstate & Primary) && (mdev->o_state == Primary) )
 		return -EACCES;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	smp_rmb();
-	if ( (newstate & Secondary) &&
-	   (test_bit(WRITER_PRESENT,&mdev->flags) ||
-	    drbd_is_mounted(minor) == MountedRW))
-		return -EBUSY;
-#else
 	ERR_IF (mdev->this_bdev->bd_contains == 0) {
 		// FIXME this masks a bug somewhere else!
 		mdev->this_bdev->bd_contains = mdev->this_bdev;
@@ -712,9 +632,7 @@
 		if (bd_claim(mdev->this_bdev,drbd_sec_holder))
 			return -EBUSY;
 	}
-#endif
 
-
 	/* I dont have access to good data anywhere, if:
 	 *  ( I am diskless OR inconsistent )
 	 *  AND
@@ -761,12 +679,10 @@
 	/* Wait until nothing is on the fly :) */
 	if ( wait_event_interruptible( mdev->cstate_wait,
 			atomic_read(&mdev->ap_pending_cnt) == 0 ) ) {
-ONLY_IN_26(
 		if ( newstate & Secondary ) {
 			D_ASSERT(mdev->this_bdev->bd_holder == drbd_sec_holder);
 			bd_release(mdev->this_bdev);
 		}
-)
 		return -EINTR;
 	}
 
@@ -795,15 +711,13 @@
 	      nodestate_to_name(newstate & 0x03),
 	      nodestate_to_name(mdev->o_state)   );
 	mdev->state = (Drbd_State) newstate & 0x03;
-	if(newstate & Primary) {
-		NOT_IN_26( set_device_ro(MKDEV(MAJOR_NR, minor), FALSE ); )
-
-ONLY_IN_26(
+	if (newstate & Secondary) {
+		set_disk_ro(mdev->vdisk, TRUE );
+	} else {
 		set_disk_ro(mdev->vdisk, FALSE );
 		D_ASSERT(mdev->this_bdev->bd_holder == drbd_sec_holder);
 		bd_release(mdev->this_bdev);
 		mdev->this_bdev->bd_disk = mdev->vdisk;
-)
 
 		if(test_bit(ON_PRI_INC_HUMAN,&mdev->flags)) {
 			newstate |= Human;
@@ -824,9 +738,6 @@
 			    mdev->cstate >= Connected ?
 			    ConnectedCnt : ArbitraryCnt);
 		}
-	} else {
-		NOT_IN_26( set_device_ro(MKDEV(MAJOR_NR, minor), TRUE ); )
-		ONLY_IN_26( set_disk_ro(mdev->vdisk, TRUE ); )
 	}
 
 	if(!test_bit(DISKLESS,&mdev->flags) && (newstate & Secondary)) {
@@ -972,10 +883,8 @@
 	long time;
 	struct Drbd_Conf *mdev;
 	struct ioctl_wait* wp;
-ONLY_IN_26(
 	struct block_device *bdev = inode->i_bdev;
 	struct gendisk *disk = bdev->bd_disk;
-)
 
 	minor = MINOR(inode->i_rdev);
 	if (minor >= minor_count) return -ENODEV;
@@ -992,38 +901,11 @@
 	 * we hold the device_mutex
 	 */
 
-ONLY_IN_26(
 	D_ASSERT(bdev == mdev->this_bdev);
 	D_ASSERT(disk == mdev->vdisk);
-);
 
 	smp_rmb();
 	switch (cmd) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-/* see how sys_ioctl and blkdev_ioctl handle it in 2.6 .
- * If I understand correctly, only "private" ioctl end up here.
- */
-	case BLKGETSIZE:
-		err = put_user(drbd_get_capacity(mdev->this_bdev),(long *)arg);
-		break;
-
-#ifdef BLKGETSIZE64
-	case BLKGETSIZE64: /* see ./drivers/block/loop.c */
-		err = put_user((u64)drbd_get_capacity(mdev->this_bdev)<<9, 
-			       (u64*)arg);
-		break;
-#endif
-
-	case BLKROSET:  // THINK do we want to intercept this one ?
-	case BLKROGET:
-	case BLKFLSBUF:
-	case BLKSSZGET:
-	case BLKBSZGET:
-	case BLKBSZSET: // THINK do we want to intercept this one ?
-	case BLKPG:
-		err=blk_ioctl(inode->i_rdev, cmd, arg);
-		break;
-#endif
 	case DRBD_IOCTL_GET_VERSION:
 		err = put_user(API_VERSION, (int *) arg);
 		break;

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_int.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -35,37 +35,8 @@
 #include <linux/slab.h> 
 #include "lru_cache.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "mempool.h"
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
-static inline void __list_splice(struct list_head *list,
-				 struct list_head *head)
-{
-	struct list_head *first = list->next;
-	struct list_head *last = list->prev;
-	struct list_head *at = head->next;
-
-	first->prev = head;
-	head->next = first;
-
-	last->next = at;
-	at->prev = last;
-}
-static inline void list_splice_init(struct list_head *list,
-				    struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head);
-		INIT_LIST_HEAD(list);
-	}
-}
-#endif
-
 // module parameter, defined in drbd_main.c
 extern int minor_count;
-extern int disable_io_hints;
 extern int major_nr;
 extern int use_nbd_major;
 
@@ -77,25 +48,9 @@
 # warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-/*lge: this hack is to get rid of the compiler warnings about
- * 'do_nbd_request declared static but never defined'
- * whilst forcing blk.h defines on
- * though we probably do not need them, we do not use them...
- * would not work without LOCAL_END_REQUEST
- */
-# define MAJOR_NR DRBD_MAJOR
-# define DEVICE_ON(device)
-# define DEVICE_OFF(device)
-# define DEVICE_NR(device) (MINOR(device))
-# define LOCAL_END_REQUEST
-# include <linux/blk.h>
-# define DRBD_MAJOR major_nr
-#else
-# include <linux/blkdev.h>
-# include <linux/bio.h>
-# define MAJOR_NR major_nr
-#endif
+#include <linux/blkdev.h>
+#include <linux/bio.h>
+#define MAJOR_NR major_nr
 
 #undef DEVICE_NAME
 #define DEVICE_NAME "drbd"
@@ -234,18 +189,10 @@
  * Compatibility Section
  *************************/
 
-#include "drbd_compat_types.h"
+#define LOCK_SIGMASK(task,flags)   spin_lock_irqsave(&task->sighand->siglock, flags)
+#define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sighand->siglock, flags)
+#define RECALC_SIGPENDING()        recalc_sigpending();
 
-#ifdef SIGHAND_HACK
-# define LOCK_SIGMASK(task,flags)   spin_lock_irqsave(&task->sighand->siglock, flags)
-# define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sighand->siglock, flags)
-# define RECALC_SIGPENDING()        recalc_sigpending();
-#else
-# define LOCK_SIGMASK(task,flags)   spin_lock_irqsave(&task->sigmask_lock, flags)
-# define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sigmask_lock, flags)
-# define RECALC_SIGPENDING()        recalc_sigpending(current);
-#endif
-
 #if defined(DBG_SPINLOCKS) && defined(__SMP__)
 # define MUST_HOLD(lock) if(!spin_is_locked(lock)) { ERR("Not holding lock! in %s\n", __FUNCTION__ ); }
 #else
@@ -618,8 +565,8 @@
 	long magic;
 	int rq_status;
 	struct drbd_barrier *barrier; // The next barrier.
-	drbd_bio_t *master_bio;       // master bio pointer
-	drbd_bio_t private_bio;       // private bio struct
+	struct bio *master_bio;       // master bio pointer
+	struct bio private_bio;       // private bio struct
 };
 
 struct drbd_barrier {
@@ -654,13 +601,13 @@
  */
 struct Tl_epoch_entry {
 	struct drbd_work    w;
-	drbd_bio_t private_bio; // private bio struct, NOT a pointer
+	struct bio private_bio; // private bio struct, NOT a pointer
 	u64    block_id;
 	long magic;
-	ONLY_IN_26(unsigned int ee_size;)
-	ONLY_IN_26(sector_t ee_sector;)
+	unsigned int ee_size;
+	sector_t ee_sector;
 	// THINK: maybe we rather want bio_alloc(GFP_*,1)
-	ONLY_IN_26(struct bio_vec ee_bvec;)
+	struct bio_vec ee_bvec;
 };
 
 /* flag bits */
@@ -730,18 +677,11 @@
 			  barrier_work,
 			  unplug_work;
 	struct timer_list resync_timer;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	kdev_t backing_bdev;  // backing device
-	kdev_t this_bdev;
-	kdev_t md_bdev;       // device for meta-data.
-#else
 	struct block_device *backing_bdev;
 	struct block_device *this_bdev;
 	struct block_device *md_bdev;
 	struct gendisk      *vdisk;
 	request_queue_t     *rq_queue;
-#endif
-	// THINK is this the same in 2.6.x ??
 	struct file *lo_file;
 	struct file *md_file;
 	int md_index;
@@ -800,7 +740,6 @@
 	int ee_in_use;
 	wait_queue_head_t ee_wait;
 	struct list_head busy_blocks;
-	NOT_IN_26(struct tq_struct write_hint_tq;)
 	struct page *md_io_page;      // one page buffer for md_io
 	struct page *md_io_tmpp;     // in case hardsect != 512 [ s390 only? ]
 	struct semaphore md_io_mutex; // protects the md_io_buffer
@@ -1010,11 +949,7 @@
 // drbd_req
 #define ERF_NOTLD    2   /* do not call tl_dependence */
 extern void drbd_end_req(drbd_request_t *, int, int, sector_t);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-extern int drbd_make_request_24(request_queue_t *q, int rw, struct buffer_head *bio);
-#else
 extern int drbd_make_request_26(request_queue_t *q, struct bio *bio);
-#endif
 extern int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req);
 
 // drbd_fs.c
@@ -1132,18 +1067,6 @@
 
 #include "drbd_compat_wrappers.h"
 
-static inline void
-drbd_flush_signals(struct task_struct *t)
-{
-	NOT_IN_26(
-	unsigned long flags;
-	LOCK_SIGMASK(t,flags);
-	)
-
-	flush_signals(t);
-	NOT_IN_26(UNLOCK_SIGMASK(t,flags));
-}
-
 static inline void set_cstate(drbd_dev* mdev,Drbd_CState ns)
 {
 	unsigned long flags;
@@ -1457,39 +1380,3 @@
 #define dump_packet(ignored...) ((void)0)
 #endif
 
-
-#ifndef sector_div
-# define sector_div(n, b)( \
-{ \
-	int _res; \
-	_res = (n) % (b); \
-	(n) /= (b); \
-	_res; \
-} \
-)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-// this is a direct copy from 2.6.6 include/linux/bitops.h
-
-static inline unsigned long generic_hweight64(u64 w)
-{
-#if BITS_PER_LONG < 64
-	return generic_hweight32((unsigned int)(w >> 32)) +
-				generic_hweight32((unsigned int)w);
-#else
-	u64 res;
-	res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
-	res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
-	res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
-	res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
-	res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
-	return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
-#endif
-}
-
-static inline unsigned long hweight_long(unsigned long w)
-{
-	return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
-}
-#endif

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_main.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -47,9 +47,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/drbd_config.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
-#endif
 #include <linux/slab.h>
 #include <linux/devfs_fs_kernel.h>
 
@@ -64,26 +62,10 @@
  */
 #define LANANA_DRBD_MAJOR 147
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-# if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
-extern int register_ioctl32_conversion(unsigned int cmd,
-				       int (*handler)(unsigned int,
-						      unsigned int,
-						      unsigned long,
-						      struct file *));
-extern int unregister_ioctl32_conversion(unsigned int cmd);
-extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
-# endif
-#else
-# ifdef CONFIG_COMPAT
-#  include <linux/ioctl32.h>
-# endif
+#ifdef CONFIG_COMPAT
+# include <linux/ioctl32.h>
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-static devfs_handle_t devfs_handle;
-#endif
-
 int drbdd_init(struct Drbd_thread*);
 int drbd_worker(struct Drbd_thread*);
 int drbd_asender(struct Drbd_thread*);
@@ -103,12 +85,7 @@
 MODULE_PARM_DESC(use_nbd_major, "DEPRECATED! use nbd device major nr (43) "
 		                "instead of the default " __stringify(LANANA_DRBD_MAJOR) );
 MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
-MODULE_PARM_DESC(disable_io_hints, "Necessary if the loopback network device is used for DRBD" );
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(use_nbd_major,"i");
-MODULE_PARM(minor_count,"i");
-MODULE_PARM(disable_io_hints,"i");
-#else
+
 #include <linux/moduleparam.h>
 /*
  * please somebody explain to me what the "perm" of the module_param
@@ -121,13 +98,10 @@
  */
 
 /* thanks to these macros, if compiled into the kernel (not-module),
- * these become boot parameters: [-drbd.major_nr-], drbd.minor_count and
- * drbd.disable_io_hints
+ * these become boot parameters drbd.use_nbd_major and drbd.minor_count
  */
 module_param(use_nbd_major,   bool,0);
 module_param(minor_count,      int,0);
-module_param(disable_io_hints,bool,0);
-#endif
 
 // module parameter, defined
 int use_nbd_major = 0;
@@ -137,8 +111,6 @@
 #else
 int minor_count = 8;
 #endif
-// FIXME disable_io_hints shall die
-int disable_io_hints = 0;
 
 // devfs name
 char* drbd_devfs_name = "drbd";
@@ -150,19 +122,13 @@
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
  */
-NOT_IN_26(
-STATIC int *drbd_blocksizes;
-STATIC int *drbd_sizes;
-)
 struct Drbd_Conf *drbd_conf;
 kmem_cache_t *drbd_request_cache;
 kmem_cache_t *drbd_ee_cache;
 mempool_t *drbd_request_mempool;
 
 STATIC struct block_device_operations drbd_ops = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,10)
 	.owner =   THIS_MODULE,
-#endif
 	.open =    drbd_open,
 	.release = drbd_close,
 	.ioctl =   drbd_ioctl
@@ -410,42 +376,6 @@
 	return ok;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-// daemonize was no global symbol before 2.4.14
-/* in 2.4.6 is is prototyped as
- * void daemonize(const char *name, ...)
- * though, so maybe we want to do this for 2.4.x already, too.
- */
-void daemonize(void)
-{
-	struct fs_struct *fs;
-
-	exit_mm(current);
-
-	current->session = 1;
-	current->pgrp = 1;
-	current->tty = NULL;
-
-	exit_fs(current);       /* current->fs->count--; */
-	fs = init_task.fs;
-	current->fs = fs;
-	atomic_inc(&fs->count);
-	exit_files(current);
-	current->files = init_task.files;
-	atomic_inc(&current->files->count);
-}
-#endif
-
-STATIC void drbd_daemonize(void) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-	daemonize("drbd_thread");
-#else
-	daemonize();
-	// VERIFY what about blocking signals ?
-	reparent_to_init();
-#endif
-}
-
 void _set_cstate(drbd_dev* mdev,Drbd_CState ns)
 {
 	Drbd_CState os;
@@ -482,7 +412,7 @@
 	drbd_dev *mdev = thi->mdev;
 	int retval;
 
-	drbd_daemonize();
+	daemonize("drbd_thread");
 	D_ASSERT(get_t_state(thi) == Running);
 	D_ASSERT(thi->task == NULL);
 	thi->task = current;
@@ -1195,7 +1125,7 @@
 				// dump_stack();
 			}
 #endif
-			drbd_flush_signals(current);
+			flush_signals(current);
 			rv = 0;
 		}
 		if (rv < 0) break;
@@ -1236,8 +1166,6 @@
 
 	drbd_conf[minor].open_cnt++;
 
-	NOT_IN_26(MOD_INC_USE_COUNT;)
-
 	return 0;
 }
 
@@ -1259,22 +1187,9 @@
 		clear_bit(WRITER_PRESENT, &drbd_conf[minor].flags);
 	}
 
-	NOT_IN_26(MOD_DEC_USE_COUNT;)
-
 	return 0;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-STATIC void drbd_unplug_fn(void *data)
-{
-	struct Drbd_Conf* mdev = (drbd_dev*)data;
-	spin_lock_irq(&mdev->req_lock);
-	if (list_empty(&mdev->unplug_work.list))
-		_drbd_queue_work_front(&mdev->data.work,&mdev->unplug_work);
-	spin_unlock_irq(&mdev->req_lock);
-}
-#else
-
 STATIC void drbd_unplug_fn(request_queue_t *q)
 {
 	drbd_dev *mdev = q->queuedata;
@@ -1301,16 +1216,10 @@
 
 	if(!test_bit(DISKLESS,&mdev->flags)) drbd_kick_lo(mdev);
 }
-#endif
 
 void drbd_set_defaults(drbd_dev *mdev)
 {
 	mdev->flags = 1<<DISKLESS;
-
-	/* If the UNPLUG_QUEUED flag is set but it is not
-	   actually queued the functionality is completely disabled */
-	if (disable_io_hints) mdev->flags |= 1<<UNPLUG_QUEUED;
-
 	mdev->sync_conf.rate       = 250;
 	mdev->sync_conf.al_extents = 127; // 512 MB active set
 	mdev->state                = Secondary;
@@ -1376,11 +1285,6 @@
 	drbd_thread_init(mdev, &mdev->worker, drbd_worker);
 	drbd_thread_init(mdev, &mdev->asender, drbd_asender);
 
-NOT_IN_26(
-	mdev->write_hint_tq.routine = &drbd_unplug_fn;
-	mdev->write_hint_tq.data    = mdev;
-)
-
 #ifdef __arch_um__
 	INFO("mdev = 0x%p\n",mdev);
 #endif
@@ -1562,14 +1466,11 @@
 		i=minor_count;
 		while (i--) {
 			drbd_dev        *mdev  = drbd_conf+i;
-ONLY_IN_26(
 			struct gendisk  **disk = &mdev->vdisk;
 			request_queue_t **q    = &mdev->rq_queue;
-)
 
 			drbd_free_resources(mdev);
 
-ONLY_IN_26(
 			if (*disk) {
 				del_gendisk(*disk);
 				put_disk(*disk);
@@ -1578,12 +1479,11 @@
 			if (*q) blk_put_queue(*q);
 			*q = NULL;
 
-			if (mdev->this_bdev->bd_holder == drbd_sec_holder) { 
+			if (mdev->this_bdev->bd_holder == drbd_sec_holder) {
 				mdev->this_bdev->bd_contains = mdev->this_bdev;
 				bd_release(mdev->this_bdev);
 			}
 			if (mdev->this_bdev) bdput(mdev->this_bdev);
-)
 
 			tl_cleanup(mdev);
 			if (mdev->bitmap) drbd_bm_cleanup(mdev);
@@ -1629,7 +1529,7 @@
 		drbd_destroy_mempools();
 	}
 
-#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
+#if defined(CONFIG_COMPAT)
 	lock_kernel();
 	unregister_ioctl32_conversion(DRBD_IOCTL_GET_VERSION);
 	unregister_ioctl32_conversion(DRBD_IOCTL_SET_STATE);
@@ -1647,20 +1547,9 @@
 	unlock_kernel();
 #endif
 
-NOT_IN_26(
-	blksize_size[MAJOR_NR] = NULL;
-	blk_size[MAJOR_NR]     = NULL;
-	// kfree(NULL) is noop
-	kfree(drbd_blocksizes);
-	kfree(drbd_sizes);
-)
 	kfree(drbd_conf);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	devfs_unregister(devfs_handle);
-#else
 	devfs_remove(drbd_devfs_name);
-#endif
 
 	if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0)
 		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
@@ -1721,9 +1610,7 @@
 #endif
 	}
 
-	err = register_blkdev(MAJOR_NR, DEVICE_NAME
-			      NOT_IN_26(, &drbd_ops)
-			      );
+	err = register_blkdev(MAJOR_NR, DEVICE_NAME);
 	if (err) {
 		printk(KERN_ERR DEVICE_NAME
 		       ": unable to register block device major %d\n",
@@ -1744,15 +1631,6 @@
 		memset(drbd_conf,0,sizeof(drbd_dev)*minor_count);
 	else goto Enomem;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	drbd_sizes = kmalloc(sizeof(int)*minor_count,GFP_KERNEL);
-	if (likely(drbd_sizes!=NULL))
-		memset(drbd_sizes,0,sizeof(int)*minor_count);
-	else goto Enomem;
-	drbd_blocksizes = kmalloc(sizeof(int)*minor_count,GFP_KERNEL);
-	if (unlikely(!drbd_blocksizes)) goto Enomem;
-#else
-
 	devfs_mk_dir(drbd_devfs_name);
 
 	for (i = 0; i < minor_count; i++) {
@@ -1793,7 +1671,6 @@
 		// plugging on a queue, that actually has no requests!
 		q->unplug_fn = drbd_unplug_fn;
 	}
-#endif
 
 	if ((err = drbd_create_mempools()))
 		goto Enomem;
@@ -1804,12 +1681,6 @@
 
 		drbd_init_set_defaults(mdev);
 
-NOT_IN_26(
-		drbd_blocksizes[i] = INITIAL_BLOCK_SIZE;
-		mdev->this_bdev = MKDEV(MAJOR_NR, i);
-		set_device_ro( MKDEV(MAJOR_NR, i), TRUE );
-)
-
 		if(!page) goto Enomem;
 		mdev->md_io_page = page;
 
@@ -1841,22 +1712,8 @@
 #else
 # error "Currently drbd depends on the proc file system (CONFIG_PROC_FS)"
 #endif
-NOT_IN_26(
-	blksize_size[MAJOR_NR] = drbd_blocksizes;
-	blk_size[MAJOR_NR] = drbd_sizes;
-)
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	devfs_handle = devfs_mk_dir (NULL, drbd_devfs_name, NULL);
-	devfs_register_series(devfs_handle, "%u", minor_count,
-			      DEVFS_FL_DEFAULT, MAJOR_NR, 0,
-			      S_IFBLK | S_IRUSR | S_IWUSR,
-			      &drbd_ops, NULL);
-#endif
-
-	NOT_IN_26(blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR),drbd_make_request_24);)
-
-#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
+#if defined(CONFIG_COMPAT)
 	// tell the kernel that we think our ioctls are 64bit clean
 	lock_kernel();
 	register_ioctl32_conversion(DRBD_IOCTL_GET_VERSION,NULL);
@@ -1904,14 +1761,9 @@
 	wmb();
 
 	if (lo_file) {
-NOT_IN_26(
-		blkdev_put(lo_file->f_dentry->d_inode->i_bdev,BDEV_FILE);
-		blkdev_put(mdev->md_file->f_dentry->d_inode->i_bdev,BDEV_FILE);
-)
-ONLY_IN_26(
 		bd_release(mdev->backing_bdev);
 		bd_release(mdev->md_bdev);
-)
+
 		mdev->md_bdev =
 		mdev->backing_bdev = 0;
 

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_receiver.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -40,9 +40,7 @@
 #include <linux/file.h>
 #include <linux/mm.h>
 #include <linux/drbd_config.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
-#endif
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/pkt_sched.h>
@@ -202,10 +200,10 @@
 	list_del(le);
 
 	page = drbd_bio_get_page(&e->private_bio);
-ONLY_IN_26(
+
 	D_ASSERT(page == e->ee_bvec.bv_page);
 	page = e->ee_bvec.bv_page;
-)
+
 	kmem_cache_free(drbd_ee_cache, e);
 	mdev->ee_vacant--;
 
@@ -237,48 +235,10 @@
 	return count;
 }
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #define GFP_TRY	( __GFP_HIGHMEM | __GFP_NOWARN )
-#else
-#define GFP_TRY	( __GFP_HIGHMEM )
-#endif
 
 STATIC int _drbd_process_ee(drbd_dev *mdev,struct list_head *head);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-STATIC void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
-{
-	unsigned long flags;
-
-	wait->flags &= ~WQ_FLAG_EXCLUSIVE;
-	spin_lock_irqsave(&q->lock, flags);
-	if (list_empty(&wait->task_list))
-		__add_wait_queue(q, wait);
-	set_current_state(state);
-	spin_unlock_irqrestore(&q->lock, flags);
-}
-
-STATIC void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
-{
-	unsigned long flags;
-
-	__set_current_state(TASK_RUNNING);
-
-	spin_lock_irqsave(&q->lock, flags);
-	list_del_init(&wait->task_list);
-	spin_unlock_irqrestore(&q->lock, flags);
-}
-
-#define DEFINE_WAIT(name)						\
-	wait_queue_t name = {						\
-		.task		= current,				\
-		.task_list	= {	.next = &name.task_list,	\
-					.prev = &name.task_list,	\
-				},					\
-	}
-
-#endif
-
 /**
  * drbd_get_ee: Returns an Tl_epoch_entry; might sleep. Fails only if
  * a signal comes in.
@@ -332,10 +292,10 @@
 	mdev->ee_vacant--;
 	mdev->ee_in_use++;
 	e=list_entry(le, struct Tl_epoch_entry, w.list);
-ONLY_IN_26(
+
 	D_ASSERT(e->private_bio.bi_idx == 0);
 	drbd_ee_init(e,e->ee_bvec.bv_page); // reinitialize
-)
+
 	e->block_id = !ID_VACANT;
 	SET_MAGIC(e);
 	return e;
@@ -537,12 +497,6 @@
 	return rv;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-# define SK_(x)		x
-#else
-# define SK_(x)		sk_ ## x
-#endif
-
 int drbd_recv(drbd_dev *mdev,void *buf, size_t size)
 {
 	mm_segment_t oldfs;
@@ -614,10 +568,9 @@
 	if (err) {
 		ERR("sock_creat(..)=%d\n", err);
 	}
+	sock->sk->sk_rcvtimeo =
+	sock->sk->sk_sndtimeo =  mdev->conf.try_connect_int*HZ;
 
-	sock->sk->SK_(rcvtimeo) =
-	sock->sk->SK_(sndtimeo) =  mdev->conf.try_connect_int*HZ;
-
 	err = sock->ops->connect(sock,
 				 (struct sockaddr *) mdev->conf.other_addr,
 				 mdev->conf.other_addr_len, 0);
@@ -640,9 +593,9 @@
 		// FIXME return NULL ?
 	}
 
-	sock2->sk->SK_(reuse)    = 1; /* SO_REUSEADDR */
-	sock2->sk->SK_(rcvtimeo) =
-	sock2->sk->SK_(sndtimeo) =  mdev->conf.try_connect_int*HZ;
+	sock2->sk->sk_reuse    = 1; /* SO_REUSEADDR */
+	sock2->sk->sk_rcvtimeo =
+	sock2->sk->sk_sndtimeo =  mdev->conf.try_connect_int*HZ;
 
 	err = sock2->ops->bind(sock2,
 			      (struct sockaddr *) mdev->conf.my_addr,
@@ -695,7 +648,7 @@
 		}
 		if(mdev->cstate==Unconnected) return 0;
 		if(signal_pending(current)) {
-			drbd_flush_signals(current);
+			flush_signals(current);
 			smp_rmb();
 			if (get_t_state(&mdev->receiver) == Exiting)
 				return 0;
@@ -704,34 +657,32 @@
 
  connected:
 
-	msock->sk->SK_(reuse)=1; /* SO_REUSEADDR */
-	sock->sk->SK_(reuse)=1; /* SO_REUSEADDR */
+	msock->sk->sk_reuse=1; /* SO_REUSEADDR */
+	sock->sk->sk_reuse=1; /* SO_REUSEADDR */
 
 	/* to prevent oom deadlock... */
 	/* The default allocation priority was GFP_KERNEL */
-	sock->sk->SK_(allocation) = GFP_DRBD;
-	msock->sk->SK_(allocation) = GFP_DRBD;
+	sock->sk->sk_allocation = GFP_DRBD;
+	msock->sk->sk_allocation = GFP_DRBD;
 
-	sock->sk->SK_(priority)=TC_PRIO_BULK;
-	NOT_IN_26(sock->sk->tp_pinfo.af_tcp.nonagle=0;)
-	ONLY_IN_26( tcp_sk(sock->sk)->nonagle = 0;)
+	sock->sk->sk_priority=TC_PRIO_BULK;
+	tcp_sk(sock->sk)->nonagle = 0;
 	// FIXME fold to limits. should be done in drbd_ioctl
-	sock->sk->SK_(sndbuf) = mdev->conf.sndbuf_size;
-	sock->sk->SK_(rcvbuf) = mdev->conf.sndbuf_size;
+	sock->sk->sk_sndbuf = mdev->conf.sndbuf_size;
+	sock->sk->sk_rcvbuf = mdev->conf.sndbuf_size;
 	/* NOT YET ...
-	 * sock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-	 * sock->sk->SK_(rcvtimeo) = MAX_SCHEDULE_TIMEOUT;
-	 * THINK HandShake timeout, hardcoded for now: */
-	sock->sk->SK_(sndtimeo) =
-	sock->sk->SK_(rcvtimeo) = 2*HZ;
-	sock->sk->SK_(userlocks) |= SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK;
+	 * sock->sk->sk_sndtimeo = mdev->conf.timeout*HZ/20;
+	 * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
+	 * first set it to the HandShake timeout, wich is hardcoded for now: */
+	sock->sk->sk_sndtimeo =
+	sock->sk->sk_rcvtimeo = 2*HZ;
+	sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK;
 
-	msock->sk->SK_(priority)=TC_PRIO_INTERACTIVE;
-	NOT_IN_26(sock->sk->tp_pinfo.af_tcp.nonagle=1;)
-	ONLY_IN_26(tcp_sk(sock->sk)->nonagle = 1;)
-	msock->sk->SK_(sndbuf) = 2*32767;
-	msock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-	msock->sk->SK_(rcvtimeo) = mdev->conf.ping_int*HZ;
+	msock->sk->sk_priority=TC_PRIO_INTERACTIVE;
+	tcp_sk(sock->sk)->nonagle = 1;
+	msock->sk->sk_sndbuf = 2*32767;
+	msock->sk->sk_sndtimeo = mdev->conf.timeout*HZ/20;
+	msock->sk->sk_rcvtimeo = mdev->conf.ping_int*HZ;
 
 	mdev->data.socket = sock;
 	mdev->meta.socket = msock;
@@ -747,8 +698,8 @@
 	clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
 	clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
 
-	sock->sk->SK_(sndtimeo) = mdev->conf.timeout*HZ/20;
-	sock->sk->SK_(rcvtimeo) = MAX_SCHEDULE_TIMEOUT;
+	sock->sk->sk_sndtimeo = mdev->conf.timeout*HZ/20;
+	sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
 
 	drbd_thread_start(&mdev->asender);
 
@@ -818,7 +769,7 @@
 read_in_block(drbd_dev *mdev, int data_size)
 {
 	struct Tl_epoch_entry *e;
-	drbd_bio_t *bio;
+	struct bio *bio;
 	int rr;
 
 	spin_lock_irq(&mdev->ee_lock);
@@ -832,7 +783,6 @@
 	drbd_bio_kunmap(bio);
 
 	if ( rr != data_size) {
-		NOT_IN_26(clear_bit(BH_Lock, &bio->b_state);)
 		spin_lock_irq(&mdev->ee_lock);
 		drbd_put_ee(mdev,e);
 		spin_unlock_irq(&mdev->ee_lock);
@@ -863,7 +813,7 @@
 STATIC int recv_dless_read(drbd_dev *mdev, drbd_request_t *req,
 			   sector_t sector, int data_size)
 {
-	drbd_bio_t *bio;
+	struct bio *bio;
 	int ok,rr;
 
 	bio = req->master_bio;
@@ -1590,7 +1540,7 @@
 STATIC void drbd_fail_pending_reads(drbd_dev *mdev)
 {
 	struct list_head *le;
-	drbd_bio_t *bio;
+	struct bio *bio;
 	LIST_HEAD(workset);
 
 	/*
@@ -1983,7 +1933,7 @@
 		}
 		else {
 			if (signal_pending(current)) {
-				drbd_flush_signals(current);
+				flush_signals(current);
 			}
 			spin_lock(&thi->t_lock);
 			D_ASSERT(thi->t_state == Restarting);
@@ -2008,7 +1958,7 @@
 STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header* h)
 {
 	// restore idle timeout
-	mdev->meta.socket->sk->SK_(rcvtimeo) = mdev->conf.ping_int*HZ;
+	mdev->meta.socket->sk->sk_rcvtimeo = mdev->conf.ping_int*HZ;
 
 	return TRUE;
 }
@@ -2174,7 +2124,7 @@
 			ERR_IF(!drbd_send_ping(mdev)) goto err;
 			// half ack timeout only,
 			// since sendmsg waited the other half already
-			mdev->meta.socket->sk->SK_(rcvtimeo) =
+			mdev->meta.socket->sk->sk_rcvtimeo =
 				mdev->conf.timeout*HZ/20;
 		}
 
@@ -2192,7 +2142,7 @@
 		rv = drbd_recv_short(mdev,buf,expect-received);
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);
 
-		drbd_flush_signals(current);
+		flush_signals(current);
 
 		/* Note:
 		 * -EINTR        (on meta) we got a signal
@@ -2211,7 +2161,7 @@
 			ERR("meta connection shut down by peer.\n");
 			goto err;
 		} else if (rv == -EAGAIN) {
-			if( mdev->meta.socket->sk->SK_(rcvtimeo) ==
+			if( mdev->meta.socket->sk->sk_rcvtimeo ==
 			    mdev->conf.timeout*HZ/20) {
 				ERR("PingAck did not arrive in time.\n");
 				goto err;

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_req.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -119,20 +119,15 @@
 int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req)
 {
 	int rv;
-	drbd_bio_t *bio = req->master_bio;
+	struct bio *bio = req->master_bio;
 
 	req->w.cb = w_is_app_read;
 	spin_lock(&mdev->pr_lock);
 	list_add(&req->w.list,&mdev->app_reads);
 	spin_unlock(&mdev->pr_lock);
 	set_bit(UNPLUG_REMOTE,&mdev->flags);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	rv=drbd_send_drequest(mdev, DataRequest, bio->b_rsector, bio->b_size,
-			      (unsigned long)req);
-#else
 	rv=drbd_send_drequest(mdev, DataRequest, bio->bi_sector, bio->bi_size,
 			      (unsigned long)req);
-#endif
 	return rv;
 }
 
@@ -168,7 +163,7 @@
 
 STATIC int
 drbd_make_request_common(drbd_dev *mdev, int rw, int size,
-			 sector_t sector, drbd_bio_t *bio)
+			 sector_t sector, struct bio *bio)
 {
 	drbd_request_t *req;
 	int local, remote;
@@ -235,7 +230,6 @@
 				   mdev->cstate > WFBitMapT) );
 
 	local = inc_local(mdev);
-	NOT_IN_26( if (rw == READA) rw=READ );
 	if (rw == READ || rw == READA) {
 		if (local) {
 			if (!drbd_may_do_local_read(mdev,sector,size)) {
@@ -354,18 +348,6 @@
 	return 0;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-int drbd_make_request_24(request_queue_t *q, int rw, struct buffer_head *bh)
-{
-	struct Drbd_Conf* mdev = drbd_conf + MINOR(bh->b_rdev);
-	if (MINOR(bh->b_rdev) >= minor_count || mdev->cstate < StandAlone) {
-		buffer_IO_error(bh);
-		return 0;
-	}
-
-	return drbd_make_request_common(mdev,rw,bh->b_size,bh->b_rsector,bh);
-}
-#else
 int drbd_make_request_26(request_queue_t *q, struct bio *bio)
 {
 	unsigned int s_enr,e_enr;
@@ -404,4 +386,3 @@
 	return drbd_make_request_common(mdev,bio_rw(bio),bio->bi_size,
 					bio->bi_sector,bio);
 }
-#endif

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/drbd_worker.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -34,9 +34,7 @@
 #include <linux/wait.h>
 #include <linux/mm.h>
 #include <linux/drbd_config.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
-#endif
 #include <linux/slab.h>
 
 #include <linux/drbd.h>
@@ -50,146 +48,8 @@
  * Try to get the locking right :)
  *
  */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 
 /* used for synchronous meta data and bitmap IO
- * submitted by FIXME (I'd say worker only, but currently this is not true...)
- */
-void drbd_md_io_complete(struct buffer_head *bh, int uptodate)
-{
-	if (uptodate)
-		set_bit(BH_Uptodate, &bh->b_state);
-
-	complete((struct completion*)bh->b_private);
-}
-
-/* reads on behalf of the partner,
- * "submitted" by the receiver
- */
-void enslaved_read_bi_end_io(drbd_bio_t *bh, int uptodate)
-{
-	unsigned long flags=0;
-	struct Tl_epoch_entry *e=NULL;
-	struct Drbd_Conf* mdev;
-
-	mdev=bh->b_private;
-	PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-
-	e = container_of(bh,struct Tl_epoch_entry,private_bio);
-	PARANOIA_BUG_ON(!VALID_POINTER(e));
-	D_ASSERT(e->block_id != ID_VACANT);
-
-	spin_lock_irqsave(&mdev->ee_lock,flags);
-
-	mark_buffer_uptodate(bh, uptodate);
-	clear_bit(BH_Lock, &bh->b_state);
-	smp_mb__after_clear_bit();
-
-	list_del(&e->w.list);
-	if(list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
-	spin_unlock_irqrestore(&mdev->ee_lock,flags);
-
-	drbd_chk_io_error(mdev,!uptodate);
-	drbd_queue_work(mdev,&mdev->data.work,&e->w);
-	dec_local(mdev);
-}
-
-/* writes on behalf of the partner, or resync writes,
- * "submitted" by the receiver.
- */
-void drbd_dio_end_sec(struct buffer_head *bh, int uptodate)
-{
-	unsigned long flags=0;
-	struct Tl_epoch_entry *e=NULL;
-	struct Drbd_Conf* mdev;
-
-	mdev=bh->b_private;
-	PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-
-	e = container_of(bh,struct Tl_epoch_entry,private_bio);
-	PARANOIA_BUG_ON(!VALID_POINTER(e));
-	D_ASSERT(e->block_id != ID_VACANT);
-
-	spin_lock_irqsave(&mdev->ee_lock,flags);
-
-	mark_buffer_uptodate(bh, uptodate);
-
-	clear_bit(BH_Dirty, &bh->b_state);
-	clear_bit(BH_Lock, &bh->b_state);
-	smp_mb__after_clear_bit();
-
-	list_del(&e->w.list);
-	list_add_tail(&e->w.list,&mdev->done_ee);
-
-	if (waitqueue_active(&mdev->ee_wait) &&
-	    (list_empty(&mdev->active_ee) ||
-	     list_empty(&mdev->sync_ee)))
-		wake_up(&mdev->ee_wait);
-
-	spin_unlock_irqrestore(&mdev->ee_lock,flags);
-
-	drbd_chk_io_error(mdev,!uptodate);
-	wake_asender(mdev);
-	dec_local(mdev);
-}
-
-/* writes on Primary comming from drbd_make_request
- */
-void drbd_dio_end(struct buffer_head *bh, int uptodate)
-{
-	struct Drbd_Conf* mdev;
-	drbd_request_t *req;
-
-	mdev = bh->b_private;
-	PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-
-	req = container_of(bh,struct drbd_request,private_bio);
-	PARANOIA_BUG_ON(!VALID_POINTER(req));
-
-	drbd_chk_io_error(mdev,!uptodate);
-	drbd_end_req(req, RQ_DRBD_LOCAL, uptodate, drbd_req_get_sector(req));
-	drbd_al_complete_io(mdev,drbd_req_get_sector(req));
-	dec_local(mdev);
-}
-
-/* reads on Primary comming from drbd_make_request
- */
-void drbd_read_bi_end_io(struct buffer_head *bh, int uptodate)
-{
-	struct Drbd_Conf* mdev;
-	drbd_request_t *req;
-
-	mdev = bh->b_private;
-	PARANOIA_BUG_ON(!IS_VALID_MDEV(mdev));
-
-	req = container_of(bh,struct drbd_request,private_bio);
-	PARANOIA_BUG_ON(!VALID_POINTER(req));
-
-	// no special case for READA here, in 2.4.X we submit them as READ.
-	if (!uptodate) {
-		// for the panic:
-		drbd_chk_io_error(mdev,!uptodate); // handle panic and detach.
-		if(mdev->on_io_error == PassOn) goto pass_on;
-		// ok, if we survived this, retry:
-		// FIXME sector ...
-		if (DRBD_ratelimit(5*HZ,5))
-			ERR("local read failed, retrying remotely\n");
-		req->w.cb = w_read_retry_remote;
-		drbd_queue_work(mdev,&mdev->data.work,&req->w);
-	} else {
-	pass_on:
-		req->master_bio->b_end_io(req->master_bio,uptodate);
-		dec_ap_bio(mdev);
-
-		INVALIDATE_MAGIC(req);
-		mempool_free(req,drbd_request_mempool);
-	}
-	dec_local(mdev);
-}
-
-#else
-
-/* used for synchronous meta data and bitmap IO
  * submitted by drbd_md_sync_page_io()
  */
 int drbd_md_io_complete(struct bio *bio, unsigned int bytes_done, int error)
@@ -337,7 +197,6 @@
 	dec_local(mdev);
 	return 0;
 }
-#endif
 
 int w_io_error(drbd_dev* mdev, struct drbd_work* w,int cancel)
 {
@@ -656,7 +515,6 @@
 int w_send_write_hint(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
 	if (cancel) return 1;
-	NOT_IN_26(clear_bit(UNPLUG_QUEUED,&mdev->flags));
 	return drbd_send_short_cmd(mdev,UnplugRemote);
 }
 
@@ -937,7 +795,7 @@
 
 		if (intr) {
 			D_ASSERT(intr == -EINTR);
-			drbd_flush_signals(current);
+			flush_signals(current);
 			ERR_IF (get_t_state(thi) == Running)
 				continue;
 			break;

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/linux/drbd_config.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -35,35 +35,12 @@
 //#define DUMP_MD 3       // Dump even all meta data access
                           // (don't! unless we track down a bug...)
 
-//#define SIGHAND_HACK           // Needed for RH 2.4.20 and later kernels.
-//#define REDHAT_HLIST_BACKPORT  // Makes DRBD work on RH9 kernels
-/* Redhat 2.4.18 already includes BH_Launder,
- * other  2.4.18 still have       BH_launder ...
- * most likely we could do without it completely,
- * since it is only used in drbd_ee_bh_prepare().
- * anyways...
- */
-//#define REDHAT_2_4_18
-/* some redhat 2.4.X-Y.Z.whatever kernel flavours have an mm_inline.h,
- * which needs to be included explicitly. most 2.4.x kernels don't have that
- * header file at all. So uncomment for these, and ignore for all others.
- * in 2.6., it will be included anyways.
- */
-//#define HAVE_MM_INLINE_H
-
-//Your 2.4 verndor kernel already defines find_next_bit()
-//#define HAVE_FIND_NEXT_BIT
-
-//Your 2.4 kernel does not define find_next_bit(),
-//and you are too lazy to "backport" it from 2.6 for your arch:
-//#define USE_GENERIC_FIND_NEXT_BIT
-
 //#define PARANOIA // some extra checks
 
 // don't enable this, unless you can cope with gigabyte syslogs :)
 //#define DUMP_EACH_PACKET
 
-// Dump every hour the usage / not usage of zero copy IO 
+// Dump every hour the usage / not usage of zero copy IO
 //#define SHOW_SENDPAGE_USAGE
 
 // You can disable the use of the sendpage() call (= zero copy

Modified: trunk/drbd/lru_cache.h
===================================================================
--- trunk/drbd/lru_cache.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/lru_cache.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -52,13 +52,6 @@
 #endif
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION (2,4,20)
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
-        __list_del(list->prev, list->next);
-        list_add(list, head);
-}
-#endif
 
 struct lc_element {
 	struct hlist_node colision;

Deleted: trunk/drbd/mempool-2.4.c
===================================================================
--- trunk/drbd/mempool-2.4.c	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/mempool-2.4.c	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,335 +0,0 @@
-/*
- *  linux/mm/mempool.c
- *
- *  memory buffer pool support. Such pools are mostly used
- *  for guaranteed, deadlock-free memory allocations during
- *  extreme VM load.
- *
- *  started by Ingo Molnar, Copyright (C) 2001
- *  modified for inclusion with DRBD in 2003 by Philipp Reisner.
- */
-
-#include <linux/compiler.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include "mempool.h"
-
-#ifndef BUG_ON
-# define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-#endif
-
-/**
- * mempool_create - create a memory pool
- * @min_nr:    the minimum number of elements guaranteed to be
- *             allocated for this pool.
- * @alloc_fn:  user-defined element-allocation function.
- * @free_fn:   user-defined element-freeing function.
- * @pool_data: optional private data available to the user-defined functions.
- *
- * this function creates and allocates a guaranteed size, preallocated
- * memory pool. The pool can be used from the mempool_alloc and mempool_free
- * functions. This function might sleep. Both the alloc_fn() and the free_fn()
- * functions might sleep - as long as the mempool_alloc function is not called
- * from IRQ contexts.
- */
-mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
-				mempool_free_t *free_fn, void *pool_data)
-{
-	mempool_t *pool;
-	int i;
-
-	BUG_ON(!alloc_fn);
-	BUG_ON(!free_fn);
-
-	pool = kmalloc(sizeof(*pool), GFP_KERNEL);
-	if (!pool)
-		return NULL;
-	memset(pool, 0, sizeof(*pool));
-
-	spin_lock_init(&pool->lock);
-	pool->min_nr = min_nr;
-	pool->pool_data = pool_data;
-	INIT_LIST_HEAD(&pool->elements);
-	init_waitqueue_head(&pool->wait);
-	pool->alloc = alloc_fn;
-	pool->free = free_fn;
-
-	/*
-	 * First pre-allocate the guaranteed number of buffers
-	 * and nodes for them.
-	 */
-	for (i = 0; i < min_nr; i++) {
-		void *element;
-		mempool_node_t *node;
-
-		node = kmalloc(sizeof(*node), GFP_KERNEL);
-		element = NULL;
-		if (node)
-			element = pool->alloc(GFP_KERNEL, pool->pool_data);
-
-		if (unlikely(!element)) {
-			/*
-			 * Not enough memory - free the allocated ones
-			 * and return.  `node' may be NULL here.
-			 */
-			kfree(node);
-			while (!list_empty(&pool->elements)) {
-				node = list_entry(pool->elements.next,
-						mempool_node_t, list);
-				list_del(&node->list);
-				pool->free(node->element, pool->pool_data);
-				kfree(node);
-			}
-			kfree(pool);
-			return NULL;
-		}
-		node->element = element;
-		list_add(&node->list, &pool->elements);
-		pool->curr_nr++;
-	}
-	return pool;
-}
-
-/**
- * mempool_resize - resize an existing memory pool
- * @pool:       pointer to the memory pool which was allocated via
- *              mempool_create().
- * @new_min_nr: the new minimum number of elements guaranteed to be
- *              allocated for this pool.
- * @gfp_mask:   the usual allocation bitmask.
- *
- * This function shrinks/grows the pool. In the case of growing,
- * it cannot be guaranteed that the pool will be grown to the new
- * size immediately, but new mempool_free() calls will refill it.
- *
- * Note, the caller must guarantee that no mempool_destroy is called
- * while this function is running. mempool_alloc() & mempool_free()
- * might be called (eg. from IRQ contexts) while this function executes.
- */
-void mempool_resize(mempool_t *pool, int new_min_nr, int gfp_mask)
-{
-	int delta;
-	unsigned long flags;
-
-	if (new_min_nr <= 0)
-		BUG();
-
-	spin_lock_irqsave(&pool->lock, flags);
-	if (new_min_nr < pool->min_nr) {
-		pool->min_nr = new_min_nr;
-		/*
-		 * Free possible excess elements.
-		 */
-		while (pool->curr_nr > pool->min_nr) {
-			mempool_node_t *node;
-
-			if (list_empty(&pool->elements))
-				BUG();
-			node = list_entry(pool->elements.next,
-					mempool_node_t, list);
-			if (node->element == NULL)
-				BUG();
-			list_del(&node->list);
-			pool->curr_nr--;
-			spin_unlock_irqrestore(&pool->lock, flags);
-			pool->free(node->element, pool->pool_data);
-			kfree(node);
-			spin_lock_irqsave(&pool->lock, flags);
-		}
-		spin_unlock_irqrestore(&pool->lock, flags);
-		return;
-	}
-	delta = new_min_nr - pool->min_nr;
-	pool->min_nr = new_min_nr;
-	spin_unlock_irqrestore(&pool->lock, flags);
-
-	/*
-	 * We refill the pool up to the new treshold - but we dont
-	 * (cannot) guarantee that the refill succeeds.
-	 */
-	while (delta) {
-		mempool_node_t *node;
-
-		node = kmalloc(sizeof(*node), gfp_mask);
-		if (!node)
-			break;
-		node->element = pool->alloc(gfp_mask, pool->pool_data);
-		if (!node->element) {
-			kfree(node);
-			break;
-		}
-		spin_lock_irqsave(&pool->lock, flags);
-		list_add(&node->list, &pool->elements);
-		pool->curr_nr++;
-		spin_unlock_irqrestore(&pool->lock, flags);
-		delta--;
-	}
-	wake_up(&pool->wait);
-}
-
-/**
- * mempool_destroy - deallocate a memory pool
- * @pool:      pointer to the memory pool which was allocated via
- *             mempool_create().
- *
- * this function only sleeps if the free_fn() function sleeps. The caller
- * has to guarantee that no mempool_alloc() nor mempool_free() happens in
- * this pool when calling this function.
- *
- * This function will go BUG() if there are outstanding elements in the
- * pool.  The mempool client must put them all back before destroying the
- * mempool.
- */
-void mempool_destroy(mempool_t *pool)
-{
-	if (!pool)
-		return;
-
-	if (pool->curr_nr != pool->min_nr)
-		printk(KERN_ERR "drbd: in %s(%p): curr_nr(%d) != min_nr(%d)\n",
-		       __func__,pool,pool->curr_nr,pool->min_nr);
-	while (!list_empty(&pool->elements)) {
-		mempool_node_t *node;
-
-		node = list_entry(pool->elements.prev,
-				mempool_node_t, list);
-		list_del(&node->list);
-		if (node->element) {
-			pool->curr_nr--;
-			pool->free(node->element, pool->pool_data);
-		}
-		kfree(node);
-	}
-	if (pool->curr_nr)
-		BUG();
-	kfree(pool);
-}
-
-/**
- * mempool_alloc - allocate an element from a specific memory pool
- * @pool:      pointer to the memory pool which was allocated via
- *             mempool_create().
- * @gfp_mask:  the usual allocation bitmask.
- *
- * this function only sleeps if the alloc_fn function sleeps or
- * returns NULL. Note that due to preallocation, this function
- * *never* fails when called from process contexts. (it might
- * fail if called from an IRQ context.)
- */
-void * mempool_alloc(mempool_t *pool, int gfp_mask)
-{
-	void *element;
-	unsigned long flags;
-	int curr_nr;
-	DECLARE_WAITQUEUE(wait, current);
-	int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
-
-repeat_alloc:
-	element = pool->alloc(gfp_nowait, pool->pool_data);
-	if (likely(element != NULL))
-		return element;
-
-	/*
-	 * If the pool is less than 50% full then try harder
-	 * to allocate an element:
-	 */
-	if ((gfp_mask != gfp_nowait) && (pool->curr_nr <= pool->min_nr/2)) {
-		element = pool->alloc(gfp_mask, pool->pool_data);
-		if (likely(element != NULL))
-			return element;
-	}
-
-	/*
-	 * Kick the VM at this point.
-	 */
-	// wakeup_bdflush();  -- Modules can not do this; PRE
-
-	spin_lock_irqsave(&pool->lock, flags);
-	if (likely(pool->curr_nr)) {
-		mempool_node_t *node;
-
-		node = list_entry(pool->elements.next,
-				mempool_node_t, list);
-		list_del(&node->list);
-		element = node->element;
-		if (element == NULL)
-			BUG();
-		node->element = NULL;
-		list_add_tail(&node->list, &pool->elements);
-		pool->curr_nr--;
-		spin_unlock_irqrestore(&pool->lock, flags);
-		return element;
-	}
-	spin_unlock_irqrestore(&pool->lock, flags);
-
-	/* We must not sleep in the GFP_ATOMIC case */
-	if (gfp_mask == gfp_nowait)
-		return NULL;
-
-	run_task_queue(&tq_disk);
-
-	add_wait_queue_exclusive(&pool->wait, &wait);
-	set_task_state(current, TASK_UNINTERRUPTIBLE);
-
-	spin_lock_irqsave(&pool->lock, flags);
-	curr_nr = pool->curr_nr;
-	spin_unlock_irqrestore(&pool->lock, flags);
-
-	if (!curr_nr)
-		schedule();
-
-	current->state = TASK_RUNNING;
-	remove_wait_queue(&pool->wait, &wait);
-
-	goto repeat_alloc;
-}
-
-/**
- * mempool_free - return an element to the pool.
- * @element:   pool element pointer.
- * @pool:      pointer to the memory pool which was allocated via
- *             mempool_create().
- *
- * this function only sleeps if the free_fn() function sleeps.
- */
-void mempool_free(void *element, mempool_t *pool)
-{
-	unsigned long flags;
-
-	if (pool->curr_nr < pool->min_nr) {
-		spin_lock_irqsave(&pool->lock, flags);
-		if (pool->curr_nr < pool->min_nr) {
-			mempool_node_t *node;
-
-			node = list_entry(pool->elements.prev,
-					mempool_node_t, list);
-			list_del(&node->list);
-			if (node->element)
-				BUG();
-			node->element = element;
-			list_add(&node->list, &pool->elements);
-			pool->curr_nr++;
-			spin_unlock_irqrestore(&pool->lock, flags);
-			wake_up(&pool->wait);
-			return;
-		}
-		spin_unlock_irqrestore(&pool->lock, flags);
-	}
-	pool->free(element, pool->pool_data);
-}
-
-/*
- * A commonly used alloc and free fn.
- */
-void *mempool_alloc_slab(int gfp_mask, void *pool_data)
-{
-	kmem_cache_t *mem = (kmem_cache_t *) pool_data;
-	return kmem_cache_alloc(mem, gfp_mask);
-}
-
-void mempool_free_slab(void *element, void *pool_data)
-{
-	kmem_cache_t *mem = (kmem_cache_t *) pool_data;
-	kmem_cache_free(mem, element);
-}

Deleted: trunk/drbd/mempool.h
===================================================================
--- trunk/drbd/mempool.h	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/drbd/mempool.h	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,49 +0,0 @@
-/*
- * memory buffer pool support
- */
-#ifndef _LINUX_MEMPOOL_H
-#define _LINUX_MEMPOOL_H
-
-#include <linux/list.h>
-#include <linux/wait.h>
-
-typedef void * (mempool_alloc_t)(int gfp_mask, void *pool_data);
-typedef void (mempool_free_t)(void *element, void *pool_data);
-
-/*
- * A structure for linking multiple client objects into
- * a mempool_t
- */
-typedef struct mempool_node_s {
-	struct list_head list;
-	void *element;
-} mempool_node_t;
-
-/*
- * The elements list has full mempool_node_t's at ->next, and empty ones
- * at ->prev.  Emptiness is signified by mempool_node_t.element == NULL.
- *
- * curr_nr refers to how many full mempool_node_t's are at ->elements.
- * We don't track the total number of mempool_node_t's at ->elements;
- * it is always equal to min_nr.
- */
-typedef struct mempool_s {
-	spinlock_t lock;
-	int min_nr, curr_nr;
-	struct list_head elements;
-
-	void *pool_data;
-	mempool_alloc_t *alloc;
-	mempool_free_t *free;
-	wait_queue_head_t wait;
-} mempool_t;
-extern mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
-				 mempool_free_t *free_fn, void *pool_data);
-extern void mempool_resize(mempool_t *pool, int new_min_nr, int gfp_mask);
-extern void mempool_destroy(mempool_t *pool);
-extern void * mempool_alloc(mempool_t *pool, int gfp_mask);
-extern void mempool_free(void *element, mempool_t *pool);
-extern void *mempool_alloc_slab(int gfp_mask, void *pool_data);
-extern void mempool_free_slab(void *element, void *pool_data);
-
-#endif /* _LINUX_MEMPOOL_H */

Deleted: trunk/scripts/adjust_drbd_config_h.sh
===================================================================
--- trunk/scripts/adjust_drbd_config_h.sh	2004-09-20 20:46:03 UTC (rev 1545)
+++ trunk/scripts/adjust_drbd_config_h.sh	2004-09-20 23:48:20 UTC (rev 1546)
@@ -1,116 +0,0 @@
-#!/bin/bash
-# drbd_config.h auto edit magic for 2.4 kernels ...
-
-# expects KDIR in the environment to be set correctly!
-
-set -e
-sorry() {
-	cat <<___
-	Sorry, automagic adjustment of drdb_config.h failed.
-	For well known 2.6. kernels, no adjustment to the shipped drbd_config is necessary.
-	You need to verify it yourself.
-___
-}
-trap "sorry" 0
-grep_q() { grep "$@" &>/dev/null ; }
-
-# PARANOIA:
-test -e ./linux/drbd_config.h || {
-       echo >&2 "oops, invoced in unexpected directory..."
-       exit 1
-}
-
-test -n "$KDIR"
-KDIR=${KDIR%/}
-
-ls >/dev/null \
-$KDIR/{.config,Makefile,include/{linux/{version,sched,list,fs},asm/bitops}.h}
-
-
-if grep_q "^PATCHLEVEL *= *4" $KDIR/Makefile ; then
-  # do we have the threadding stuff in the kernel,
-  # and need to use the sighand lock instead of the signal lock?
-  if grep_q "^struct sighand_struct {" $KDIR/include/linux/sched.h ; then
-    need_sighand_hack=1
-  else
-    need_sighand_hack=0
-  fi
-
-  # do we have hlist support already?
-  if grep_q "^struct hlist_head {" $KDIR/include/linux/list.h; then
-    hlist_backport=1
-  else
-    hlist_backport=0
-  fi
-
-  # is this a 2.4.18 kernel, which is supposed to have BH_launder,
-  # but already has BH_Launder?
-  if
-    grep_q '^SUBLEVEL *= *18$' $KDIR/Makefile &&
-    grep_q 'BH_Launder' $KDIR/include/linux/fs.h
-  then
-    need_RH_2_4_18_hack=1
-  else
-    need_RH_2_4_18_hack=0
-  fi
-
-  # do we have find_next_bit?
-  if
-    cat 2>/dev/null $KDIR/include/asm{,/arch}/bitops.h |
-    grep_q 'find_next_bit'
-  then
-    have_find_next_bit=1
-  else
-    have_find_next_bit=0
-  fi
-
-  # TODO autodetect whether we need this:
-  # USE_GENERIC_FIND_NEXT_BIT
-  # 
-
-  # do we have mm_inline, and need to include it explicitly?
-  if grep_q "#define *page_count" $KDIR/include/linux/mm_inline.h ; then
-    have_mm_inline_h=1
-  else
-    have_mm_inline_h=0
-  fi
-else
-    # 2.6. kernel. just leave it alone...
-    need_sighand_hack=0
-    hlist_backport=0
-    need_RH_2_4_18_hack=0
-    have_find_next_bit=0
-    have_mm_inline_h=0
-fi
-
-test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
-
-perl -pe "
- s{.*(#define SIGHAND_HACK.*)}
-  { ( $need_sighand_hack ? '' : '//' ) . \$1}e;
- s{.*(#define REDHAT_HLIST_BACKPORT.*)}
-  { ( $hlist_backport ? '' : '//' ) . \$1}e;
- s{.*(#define REDHAT_2_4_18.*)}
-  { ( $need_RH_2_4_18_hack ? '' : '//' ) . \$1}e;
- s{.*(#define HAVE_FIND_NEXT_BIT.*)}
-  { ( $have_find_next_bit ? '' : '//' ) . \$1}e;
- s{.*(#define HAVE_MM_INLINE_H.*)}
-  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" \
-	  < ./linux/drbd_config.h \
-	  > ./linux/drbd_config.h.new
-
-
-if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{,.new}) ; then
-  mv ./linux/drbd_config.h{.new,}
-  sed -e 's/^/  /' <<___
-
-Adjusted drbd_config.h:
-$DIFF
-
-___
-else
-	rm ./linux/drbd_config.h.new
-	echo -e "\n  Using unmodified drbd_config.h\n"
-fi
-trap - 0
-exit 0



More information about the drbd-cvs mailing list