[DRBD-cvs] r1561 - in trunk: . drbd

svn at svn.drbd.org svn at svn.drbd.org
Fri Sep 24 13:43:20 CEST 2004


Author: lars
Date: 2004-09-24 13:43:17 +0200 (Fri, 24 Sep 2004)
New Revision: 1561

Removed:
   trunk/drbd/hlist.h
Modified:
   trunk/INSTALL
   trunk/drbd/Makefile
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/lru_cache.h
Log:
cleanup of unused defines and macros
update of INSTALL to no longer reference 2.4 kernel

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/INSTALL	2004-09-24 11:43:17 UTC (rev 1561)
@@ -4,14 +4,7 @@
 It should work for SuSE, Debian, RH and other distros with slight
 modifications.
 
-   This was written for 0.6.10, and might not work for releases
-   before that, since we changed our Makefile to use the top level
-   kernel source Makefile, so we no longer need to worry about
-   all those funny kernel compile flags...
-   
-   It is still correct for 0.6.13.
-   Maybe this needs an update for 0.7.x,
-   but most of it probably still applies.
+   This was last reviewed for 0.8.0-pre1.
 
 I tried to indicate what you should type by the prompt-prefix
 on the below command lines. "all#", when it is the same for
@@ -26,9 +19,8 @@
 
 	http://www.drbd.org
 	http://www.drbd.org/drbd-article.html
-	http://www.linux-mag.com/2003-11/drbd_01.html
 	http://www.linux-mag.com/2003-11/toc.html
-	http://linuxha.trick.ca/DRBD_2fFAQ , and of course,
+	http://linuxha.trick.ca/DRBD , and of course,
 	http://www.drbd.org/support.html
 
 == Prerequisites ==
@@ -45,8 +37,8 @@
  Note: this is really kernel-source.rpm, NOT kernel.src.rpm.
  You don't want to use the latter, unless you know _exactly_ why...
 
- If you want to use a 2.6.x kernel, you need to use DRBD-0.7.;
- 0.6 just won't compile.
+ If you want to use a 2.4.x kernel, you need to use DRBD-0.7.;
+ DRBD-0.8 just won't compile.
 
  Obviously you should have a build-system installed, i.e. gcc, make, etc. ;)
 
@@ -56,20 +48,18 @@
  just mentioned here in case you installed gcc 2.9x for some other
  thingy, and then wonder why kernel modules no longer work properly.
 
- Note: for a 2.2.x kernel, you need to add a line to kernel/ksyms.c,
- see debian/kernel-export-wup.patch . But who cares for 2.2, nowadays?
-
  So what next?
 
 == Prepare the kernel source tree ==
 
        all# cd /usr/src/linux
    or wherever your kernel source happens to be, e.g.
-    fedora# cd /usr/src/linux-2.4
+    fedora# cd /usr/src/linux-2.6
 
    The next step is just to be sure. If you know what it does,
    you probably can judge on your own whether it is necessary or
-   not, anyways.
+   not, anyways. If you get strange results on your first try,
+   please do this first. It sometimes really helps!
 
        all# make mrproper
 
@@ -95,65 +85,55 @@
 
    The redhat way seems to be:
 
-       redhat# cp /boot/kernel-2.4.some-thing.config  .config
+       redhat# cp /boot/kernel-2.6.some-thing.config  .config
+        or   # cp configs/kernel-2.6.some-thing.config .config
              # make -s oldconfig_nonint ; make -s oldconfig_nonint
+             # vi Makefile # mod EXTRAVERSION to match installed kernel
+                           # (remove "custom" if neccessary)
 
-       fedora# cp /boot/config-2.4.some-thing  .config
+       fedora# cp /boot/config-2.6.some-thing  .config
              # export CC=gcc32
-             # vi Makefile #mod EXTRAVERSION to match installed kernel
              # yes "" | { make oldconfig ; make oldconfig ; }
+             # vi Makefile # mod EXTRAVERSION to match installed kernel
+                           # (remove "custom" if neccessary)
 
     Note:
     If you consider to not run some vendor kernel, but compile
     your own kernel, you need to build in module support, since
-    DRBD is a module.  DRBD depends on procfs, but you want to
-    have that anyways.  Make sure that you do not compile NBD
-    into the kernel, since DRBD uses the same major device
-    number. Having it as module is ok, but you cannot use both
-    at the same time.
+    DRBD is a module (but see below for in kernel builds).
+    DRBD depends on procfs, but you want to have that anyways.
 
     If you do not run a selfcompiled kernel, but the binary shipped
     distro kernel, and after "make install" the drbd module ends up in
-    the wrong place (e.g. "/lib/modules/2.4.20custom/", when you want it
-    in "/lib/modules/2.4.20/" ), edit the top-level Makefile of your kernel
+    the wrong place (e.g. "/lib/modules/2.6.6custom/", when you want it
+    in "/lib/modules/2.6.6/" ), edit the top-level Makefile of your kernel
     source tree and remove "custom" from the EXTRAVERSION.  Make sure you
     copied in the .config corresponding to the kernel you use.
-    Don't forget to "make dep" in /usr/src/linux, it sometimes helps, too.
-    (you could of course edit .kernelversion in the drbd directory,
-    or copy by hand, too)
 
-      Update:
-      since we now (0.7.1 and later) have an officially assigned
-      device major number (147) and device nodes (/dev/drbd), we no longer
-      hijack NBDs major numbers. You now in fact _can_ use NBD in parallel
-      with DRBD, if it makes any sense in your setup...
-
    So if necessary, "make menuconfig" and adapt to your own
    preferences, but then you need to compile and install this
    kernel.  Modules compiled against this kernel source tree
    will only work properly with a matching kernel.
 
-       all# make dep
        all# make linux/include/version.h
+          # and since kernel 2.6.6 (some distos 2.6.5-something):
+       all# make modules_prepare
 
 == Build DRBD kernel module (outside of the kernel source) ==
 
    unpack the drbd tgz, I suggest to unpack it into /usr/src/drbd-*
 
        all# cd /usr/src
-       all# tar -xvzf where/you/downloaded/it/drbd-0.6.12.tar.gz
+       all# tar -xvzf where/you/downloaded/it/drbd-0.8.0.tar.gz
 
    now build the module
 
-   Note: On some distros (redhat/fedora typically), you first need to have a 
+   Note:
+   On some distros (redhat/fedora typically), you first need to have a 
    look into ./drbd_config.h, and (un)comment some of the
    settings appropriately, if not done automagically already.
 
-   Since 0.7.3, we have script/adjust_drbd_config_h.sh, which helps you 
-   with this, and gets called during the normal build process,
-   so you "should" no longer need to adjust it by hand.
-
-       all# cd drbd-0.6.12/drbd  # kernel module sub directory
+       all# cd drbd-0.8.0/drbd  # kernel module sub directory
        all# make clean all
     fedora# make clean all CC=gcc32
 
@@ -196,19 +176,16 @@
 == Build DRBD user space tools only ==
 
    If you took the 'patch kernel' approach, you still need to build the
-   user space tools.
+   user space tools:
 
-       all# cd /usr/src/drbd-0.6.12/user
-       all# make
-
-   or with drbd-0.7 simply
+       all# cd /usr/src/drbd-0.8.0
        all# make tools
 
 == Install it ==
 
    If the above steps went ok, you just need to install it.
 
-       all# cd /usr/src/drbd-0.6.12
+       all# cd /usr/src/drbd-0.8.0
        all# make install
 
    If you patched the kernel, you obviously only want to
@@ -228,12 +205,12 @@
 
    Why did I not just "make ; make install" in the toplevel
    directory of the drbd source?
-   Because I seem to be too stupid to get my docbook environment
-   right, and I don't want to screw up the precompiled
-   documentation and man-pages that come with the .tar.gz ...
+   Because I like to do it explicitly step by step.
+   Of course you could do it all in one step,
+   and most of the time it should just work:
 
-   Note: since 0.7, to rebuild the documentation, you need to
-   explicitly ask for it: "make doc"
+       all# cd /usr/src/drbd-0.8.0
+       all# make all install
 
 == Troubleshooting ==
 
@@ -246,8 +223,7 @@
 == Building a .rpm of it ==
 
    This should be fairly easy, there is an example spec
-   file, and you can even "make rpm".  If this is a CVS/SVN version,
-   you might need to say "make rpm FORCE=1".
+   file, and you can even "make rpm".
 
    If it does not work for you out of the box, first get "make install"
    to work properly, see the section titled 'prepare the kernel source tree'
@@ -262,13 +238,8 @@
    like in "make rpm KDIR=/usr/src/linux-include/athlon",
    "make rpm KDIR=/usr/src/linux-include/smp", ...
 
-   You then should find packages in "dist/{S,}RPMS/*/*.rpm":
+   You then should find packages in "dist/{S,}RPMS/*/*.rpm".
 
-	./dist/RPMS/i586/drbd-0.6.12-3.i586.rpm
-	./dist/RPMS/i586/kernel-module-drbd-0.6.12-3_2.4.21_166_default.i586.rpm
-	./dist/RPMS/i586/kernel-smp-module-drbd-0.6.12-3_2.4.21_166_4G.i586.rpm
-	...
-
    Note however that your distro most likely handles rpms of kernel modules in
    some special way, so you may want to first ask your ditributor to provide
    some update packages themselves.
@@ -276,56 +247,8 @@
 == Building a .deb of it ==
 
    Have a look into the ./debian/* example files in place.
+   See also: http://article.gmane.org/gmane.comp.linux.drbd/5616
 
-	From: Jens Benecke
-	Subject: [DRBD-dev] Re: RFC: new ./INSTALL hints
-	Date: Wed, 24 Dec 2003 13:14:23 +0100
-	See: http://article.gmane.org/gmane.comp.linux.drbd/5616
-
-   For Debian, IMHO it makes a lot of sense to make a .deb package:
-
-	/tmp/drbd-0.6.12# dpkg-buildpackage -us -uc -b
-
-   creates drbd_*.deb, drbd-source_*.deb and kernel-patch-wup_*.deb.
-   drbd-source_*.deb only contains /usr/src/linux/drbd.tar.gz, which must be
-   unpacked and recompiled with the target kernel.
-
-	/tmp# dpkg -i drbd*deb  # install them all
-	/tmp# cd /usr/src/linux ; tar xvzf drbd.tar.gz
-	/usr/src/linux# make menuconfig
-	/usr/src/linux# make-kpkg --bzimage --revision $FOO \
-		binary-arch modules_image
-
-   creates kernel-image*deb, kernel-headers*deb, and drbd-module*deb,
-   in my case (applied reiserfs data-logging patches and changed
-   EXTRAVERSION in the Makefile to my initials, also used
-   --revision $FOO on the make-kpkg command line :)
-
-	drbd-module-2.4.23-jb-gr+r_0.6.12-1+jb1_i386.deb
-	kernel-headers-2.4.23-jb-gr+r_jb1_i386.deb
-	kernel-image-2.4.23-jb-gr+r_jb1_i386.deb
-
-   These can be installed on any computer now.
-
-   $FOO can be anything you want, like '01' or 'jb1' (which I use). It's the
-   kernel revision number for your build. If you build later .deb packages
-   with the same kernel version, you can use
-
-	# dch -i 'added $foo patches/configure items/whatever'
-
-   to update the Debian changelog in the kernel source directory and then just
-   rebuild the kernel image. It will auto-replace the running kernel on
-   installation.
-
-   If you build another .deb with a different _version_, it will
-   not replace the running kernel. See kernel-package
-   documentation for that.
-
-   Trust me, it's much cleaner and easier (also to upgrade)
-   machines this way.  Especially if you have several machines to
-   upgrade, which is _always_ the case when running drbd, as
-   that's the whole point. :)
-
 ----
 
 Hope this helped, cheers and have fun ...
@@ -334,4 +257,4 @@
 	Lars Ellenberg
 
 
-Last modified: Tue Aug 24 14:07:40 UTC 2004
+Last modified: Do Sep 23 23:29:48 UTC 2004

Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/Makefile	2004-09-24 11:43:17 UTC (rev 1561)
@@ -101,8 +101,8 @@
   kbuild: drbd_buildtag.c
 	@rm -f .kernelrelease*
     # 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
+	$(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"          ; \

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/drbd_int.h	2004-09-24 11:43:17 UTC (rev 1561)
@@ -203,19 +203,6 @@
  * our structs
  *************************/
 
-#ifndef typecheck
-/*
- * Check at compile time that something is of a particular type.
- * Always evaluates to 1 so you may use it easily in comparisons.
- */
-#define typecheck(type,x) \
-({	type __dummy; \
-	typeof(x) __dummy2; \
-	(void)(&__dummy == &__dummy2); \
-	1; \
-})
-#endif
-
 #define SET_MAGIC(x)       ((x)->magic = (long)(x) ^ DRBD_MAGIC)
 #define VALID_POINTER(x)   ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0)
 #define INVALIDATE_MAGIC(x) (x->magic--)
@@ -1010,58 +997,6 @@
 extern void drbd_al_shrink(struct Drbd_Conf *mdev);
 
 /*
- * event macros
- *************************/
-
-// we use these within spin_lock_irq() ...
-#ifndef wq_write_lock
-#if USE_RW_WAIT_QUEUE_SPINLOCK
-# define wq_write_lock write_lock
-# define wq_write_unlock write_unlock
-# define wq_write_unlock_irq write_unlock_irq
-#else
-# define wq_write_lock spin_lock
-# define wq_write_unlock spin_unlock
-# define wq_write_unlock_irq spin_unlock_irq
-#endif
-#endif
-
-// sched.h does not have it with timeout, so here goes:
-
-#ifndef wait_event_interruptible_timeout
-#define __wait_event_interruptible_timeout(wq, condition, ret)		\
-do {									\
-	wait_queue_t __wait;						\
-	init_waitqueue_entry(&__wait, current);				\
-									\
-	add_wait_queue(&wq, &__wait);					\
-	for (;;) {							\
-		set_current_state(TASK_INTERRUPTIBLE);			\
-		if (condition)						\
-			break;						\
-		if (!signal_pending(current)) {				\
-			ret = schedule_timeout(ret);			\
-			if (!ret)					\
-				break;					\
-			continue;					\
-		}							\
-		ret = -EINTR;						\
-		break;							\
-	}								\
-	current->state = TASK_RUNNING;					\
-	remove_wait_queue(&wq, &__wait);				\
-} while (0)
-
-#define wait_event_interruptible_timeout(wq, condition, timeout)	\
-({									\
-	long __ret = timeout;						\
-	if (!(condition))						\
-		__wait_event_interruptible_timeout(wq, condition, __ret); \
-	__ret;								\
-})
-#endif
-
-/*
  * inline helper functions
  *************************/
 

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/drbd_main.c	2004-09-24 11:43:17 UTC (rev 1561)
@@ -74,11 +74,6 @@
 STATIC int drbd_open(struct inode *inode, struct file *file);
 STATIC int drbd_close(struct inode *inode, struct file *file);
 
-#ifdef DEVICE_REQUEST
-#undef DEVICE_REQUEST
-#endif
-#define DEVICE_REQUEST drbd_do_request
-
 MODULE_AUTHOR("Philipp Reisner <phil at linbit.com>, Lars Ellenberg <lars at linbit.com>");
 MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
 MODULE_LICENSE("GPL");

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/drbd_receiver.c	2004-09-24 11:43:17 UTC (rev 1561)
@@ -2007,10 +2007,6 @@
 STATIC int got_NegAck(drbd_dev *mdev, Drbd_Header* h)
 {
 	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
-#if 0
-	sector_t sector = be64_to_cpu(p->sector);
-	int size = be32_to_cpu(p->blksize);
-#endif
 
 	/* do nothing here.
 	 * we expect to get a "report param" on the data socket soon,
@@ -2019,14 +2015,6 @@
 	if(is_syncer_blk(mdev,p->block_id)) {
 		dec_rs_pending(mdev,HERE);
 	}
-#if 0
-	else {
-		D_ASSERT(bm_get_bit(mdev->mbds_id,sector,size));
-		// tl_clear() must have set this out of sync!
-		D_ASSERT(mdev->conf.wire_protocol != DRBD_PROT_A);
-		dec_ap_pending(mdev,HERE);
-	}
-#endif
 	if (DRBD_ratelimit(5*HZ,5))
 		WARN("Got NegAck packet. Peer is in troubles?\n");
 

Deleted: trunk/drbd/hlist.h
===================================================================
--- trunk/drbd/hlist.h	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/hlist.h	2004-09-24 11:43:17 UTC (rev 1561)
@@ -1,129 +0,0 @@
-#ifndef HLIST_HEAD_INIT
-#ifndef HLIST_H
-#define HLIST_H
-
-#ifdef REDHAT_HLIST_BACKPORT
-#undef hlist_node
-#undef hlist_head
-#undef HLIST_HEAD
-#undef INIT_HLIST_HEAD
-#undef hlist_empty
-#undef hlist_del_init
-#undef hlist_entry
-#undef hlist_add_head
-#undef hlist_for_each
-#undef hlist_for_each_safe
-#endif
-
-// from linux-2.6.x linux/list.h
-// I copied only the part which actually is used in lru_cache.h
-
-// ok, this is from linux/kernel.h
-/**
- * container_of - cast a member of a structure out to the containing structure
- *
- * @ptr:	the pointer to the member.
- * @type:	the type of the container struct this is embedded in.
- * @member:	the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({			\
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
-        (type *)( (char *)__mptr - offsetof(type,member) );})
-
-/*
- * Double linked lists with a single pointer list head.
- * Mostly useful for hash tables where the two pointer list head is
- * too wasteful.
- * You lose the ability to access the tail in O(1).
- */
-
-struct hlist_node {
-	struct hlist_node *next, **pprev;
-};
-
-struct hlist_head {
-	struct hlist_node *first;
-};
-
-
-#define HLIST_HEAD_INIT { .first = NULL }
-#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
-#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
-#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL)
-
-static __inline__ int hlist_unhashed(const struct hlist_node *h)
-{
-	return !h->pprev;
-}
-
-static __inline__ int hlist_empty(const struct hlist_head *h)
-{
-	return !h->first;
-}
-
-static __inline__ void __hlist_del(struct hlist_node *n)
-{
-	struct hlist_node *next = n->next;
-	struct hlist_node **pprev = n->pprev;
-	*pprev = next;
-	if (next)
-		next->pprev = pprev;
-}
-
-#ifndef LIST_POISON1
-#define LIST_POISON1  ((void *) 0x00100100)
-#define LIST_POISON2  ((void *) 0x00200200)
-#endif
-
-static __inline__ void hlist_del(struct hlist_node *n)
-{
-	__hlist_del(n);
-	n->next = LIST_POISON1;
-	n->pprev = LIST_POISON2;
-}
-
-static __inline__ void hlist_del_init(struct hlist_node *n)
-{
-	if (n->pprev)  {
-		__hlist_del(n);
-		INIT_HLIST_NODE(n);
-	}
-}
-
-static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
-{
-	struct hlist_node *first = h->first;
-	n->next = first;
-	if (first)
-		first->pprev = &n->next;
-	h->first = n;
-	n->pprev = &h->first;
-}
-
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-/* Cannot easily do prefetch unfortunately */
-#define hlist_for_each(pos, head) \
-	for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
-	     pos = pos->next)
-
-#define hlist_for_each_safe(pos, n, head) \
-	for (pos = (head)->first; n = pos ? pos->next : 0, pos; \
-	     pos = n)
-
-/**
- * hlist_for_each_entry	- iterate over list of given type
- * @tpos:	the type * to use as a loop counter.
- * @pos:	the &struct hlist_node to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the hlist_node within the struct.
- */
-#define hlist_for_each_entry(tpos, pos, head, member)			 \
-	for (pos = (head)->first;					 \
-	     pos && ({ prefetch(pos->next); 1;}) &&			 \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-#endif
-#endif

Modified: trunk/drbd/lru_cache.h
===================================================================
--- trunk/drbd/lru_cache.h	2004-09-24 11:38:25 UTC (rev 1560)
+++ trunk/drbd/lru_cache.h	2004-09-24 11:43:17 UTC (rev 1561)
@@ -28,7 +28,7 @@
   The lru_cache describes a big set of objects that are addressed
   by an index number (=lc_number). Only a small fraction of this set
   is present in the cache.
-  (You set the size of the cache using lc_resize)
+  (You set the size of the cache during lc_alloc)
   Once created, the api consists of
     lc_find(,nr) -- finds the object with the given number, if present
     lc_get(,nr)  -- finds the object and increases the usage count



More information about the drbd-cvs mailing list