[DRBD-cvs] drbd by lars; added support for generating a kernel pa...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Tue, 20 Apr 2004 13:36:58 +0200 (CEST)
DRBD CVS committal
Author : lars
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
Makefile drbd_main.c
Added Files:
Tag: rel-0_7-branch
Kconfig Makefile-2.4 Makefile-2.6
Log Message:
added support for generating a kernel patch for in-kernel-trr builds of drbd
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Makefile,v
retrieving revision 1.14.2.25
retrieving revision 1.14.2.26
diff -u -3 -r1.14.2.25 -r1.14.2.26
--- Makefile 9 Apr 2004 06:53:43 -0000 1.14.2.25
+++ Makefile 20 Apr 2004 11:36:53 -0000 1.14.2.26
@@ -31,15 +31,13 @@
ifneq ($(VERSION),2)
$(error "won't compile with this kernel version")
endif
+ ifeq ($(findstring $(PATCHLEVEL),46),$(PATCHLEVEL))
+ include $(DRBDSRC)/Makefile-2.$(PATCHLEVEL)
+ else
+ $(error "won't compile with this kernel version")
+ endif
- # override needed for 2.4.X kbuild
- override CFLAGS += -I$(DRBDSRC)
-
- obj-m += drbd.o
- drbd-objs := drbd_fs.o drbd_main.o drbd_proc.o drbd_dsender.o \
- drbd_receiver.o drbd_req-2.4.o drbd_actlog.o \
- lru_cache.o
-
+ override CFLAGS += -I$(DRBDSRC)
# remember KERNELRELEASE for install target
# .kernelversion can be included in Makefile as well as
# sourced from shell
@@ -50,36 +48,11 @@
"KERNELRELEASE=$(KERNELRELEASE)" \
> $(DRBDSRC)/.kernelrelease.new \
)
-
- # rest is magic for KERNEL_VERSION < 2.6
- ifneq ($(findstring $(PATCHLEVEL),24),)
- # linux 2.2//2.4 style needs in addition:
- drbd-objs += mempool-2.4.o
- list-multi := drbd.o
-
- ifeq ($(PATCHLEVEL),2)
- # include $(SUBDIRS)/Rules-2.2.x.make
- # this rules file would extract the 2.2 variables
- # from the 2.4+ obj-[ynm] ones; but since the code
- # no longer compiles with 2.2.x: sorry!
- $(error "won't compile with a 2.2.x kernel")
- else
- include $(TOPDIR)/Rules.make
- endif
-
- drbd.o: $(drbd-objs)
- $(LD) -r -o $@ $(drbd-objs)
-
- else
- ifneq ($(PATCHLEVEL),6)
- # we only compile for [-2.2,-] 2.4 and 2.6. sorry.
- $(error "won't compile with this kernel version")
- endif
- endif
else
# called from command line in current directory
DRBDSRC := $(shell pwd)
- export DRBDSRC
+ CONFIG_BLK_DEV_DRBD := m
+ export DRBDSRC CONFIG_BLK_DEV_DRBD
KDIR_Makefile_PATCHLEVEL = $(shell grep "^PATCHLEVEL = " $(KDIR)/Makefile | cut -d " " -f 3)
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.151
retrieving revision 1.73.2.152
diff -u -3 -r1.73.2.151 -r1.73.2.152
--- drbd_main.c 18 Apr 2004 10:33:56 -0000 1.73.2.151
+++ drbd_main.c 20 Apr 2004 11:36:53 -0000 1.73.2.152
@@ -98,10 +98,30 @@
MODULE_AUTHOR("Philipp Reisner <phil@linbit.com>, Lars Ellenberg <lars@linbit.com>");
MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
MODULE_LICENSE("GPL");
+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(minor_count,"i");
MODULE_PARM(disable_io_hints,"i");
-MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
-MODULE_PARM_DESC(disable_io_hints, "Necessary if loopback devices are used for DRBD" );
+#else
+#include <linux/moduleparam.h>
+/*
+ * please somebody explain to me what the "perm" of the module_param
+ * macro is good for (yes, permission for it in the "driverfs", but what
+ * do we need to do for them to show up, to begin with?)
+ * once I understand this, and the rest of the sysfs stuff, I probably
+ * be able to understand how we can move from our ioctl interface to a
+ * proper sysfs based one.
+ * -- lge
+ */
+
+/* thanks to these macros, if compiled into the kernel (not-module),
+ * these become boot parameters: drbd.minor_count and
+ * drbd.disable_io_hints
+ */
+module_param(minor_count, int,0);
+module_param(disable_io_hints,int,0);
+#endif
// module parameter, defined
#ifdef MODULE
@@ -1024,7 +1044,7 @@
WRITE_HINT for an other device (which is in primary state).
This could lead to a distributed deadlock!!
- To avoid the deadlock we set the ISSUE_IO_HINT bit and
+ To avoid the deadlock we set the ISSUE_IO_HINT bit and
it will be sent after the current data block.
UPDATE:
since "dontwait" this would no longer deadlock, but probably
@@ -1061,10 +1081,10 @@
Drbd_Header h;
/* In order to avoid deadlocks the receiver should only
- use blk_run_queue(). It must not use blk_run_queues() to
- avoid deadlocks.
+ use blk_run_queue(). It must not use blk_run_queues() to
+ avoid deadlocks.
- Maybe we should consider to use the plain drbd_send_cmd.
+ In 2.6, we should use the plain drbd_send_cmd again.
*/
if (drbd_send_cmd_dontwait(mdev,mdev->data.socket,WriteHint,&h,
@@ -1350,7 +1370,11 @@
if (1 > minor_count||minor_count > 255) {
printk(KERN_ERR DEVICE_NAME
": invalid minor_count (%d)\n",minor_count);
+#ifdef MODULE
return -EINVAL;
+#else
+ minor_count = 8;
+#endif
}
err = register_blkdev(MAJOR_NR, DEVICE_NAME
@@ -1366,8 +1390,8 @@
*/
err = -ENOMEM;
- drbd_proc = NULL; // play safe for drbd_cleanup
- drbd_conf = kcalloc(sizeof(drbd_dev)*minor_count,GFP_KERNEL);
+ drbd_proc = NULL; // play safe for drbd_cleanup
+ drbd_conf = kcalloc(sizeof(drbd_dev)*minor_count,GFP_KERNEL);
if (!drbd_conf)
goto Enomem;