[DRBD-cvs] r1472 - in trunk/drbd: . linux
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Fri, 30 Jul 2004 14:26:18 +0200 (CEST)
Author: lars
Date: 2004-07-30 14:26:17 +0200 (Fri, 30 Jul 2004)
New Revision: 1472
Modified:
trunk/drbd/Kconfig
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/drbd/linux/drbd_config.h
Log:
replace arbitrary major_nr parameter with use_nbd_major fallback parameter
Modified: trunk/drbd/Kconfig
===================================================================
--- trunk/drbd/Kconfig 2004-07-30 11:29:14 UTC (rev 1471)
+++ trunk/drbd/Kconfig 2004-07-30 12:26:17 UTC (rev 1472)
@@ -10,12 +10,10 @@
clusters. This is done by mirroring a whole block device via (a
dedicated) network. You could see it as a network RAID 1.
- This device replaces the regular "network block device".
-
Each device (drbd provides more than one of these devices) has a
state, which can be 'primary' or 'secondary'. On the node with the
primary device the application is supposed to run and to access the
- device (/dev/nbX). Every write is sent to the local 'lower level
+ device (/dev/drbdX). Every write is sent to the local 'lower level
block device' and via network to the node with the device in
'secondary' state.
The secondary device simply writes the data to its lower level block
@@ -23,12 +21,14 @@
Drbd management is done through user-space tools.
+ Historically DRBD hijacked the NBD major number (43)
+ and device nodes (/dev/nbX).
+ We now have an officially assigned major number (147)
+ and /dev/drbdX.
+
+ If for whatever weird reason you want to keep the old behaviour,
+ you can give a "use_nbd_major" module parameter.
+
http://www.drbd.org/
If unsure, say N.
-
-comment "DRBD in kernel, no NBD possible"
- depends on BLK_DEV_DRBD=y
-
-comment "Note: you can _not_ load both NBD and DRBD modules at the same time"
- depends on BLK_DEV_DRBD && BLK_DEV_NBD
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2004-07-30 11:29:14 UTC (rev 1471)
+++ trunk/drbd/drbd_int.h 2004-07-30 12:26:17 UTC (rev 1472)
@@ -67,8 +67,9 @@
extern int minor_count;
extern int disable_io_hints;
extern int major_nr;
+extern int use_nbd_major;
-// major == nbd_major ? "nbd" : "drbd";
+// use_nbd_major ? "nbd" : "drbd";
extern char* drbd_devfs_name;
#include <linux/major.h>
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2004-07-30 11:29:14 UTC (rev 1471)
+++ trunk/drbd/drbd_main.c 2004-07-30 12:26:17 UTC (rev 1472)
@@ -95,11 +95,12 @@
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(major_nr, "Major nr to use -- default " __stringify(CONFIG_DRBD_MAJOR) );
+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(major_nr,"i");
+MODULE_PARM(use_nbd_major,"i");
MODULE_PARM(minor_count,"i");
MODULE_PARM(disable_io_hints,"i");
#else
@@ -118,12 +119,13 @@
* these become boot parameters: [-drbd.major_nr-], drbd.minor_count and
* drbd.disable_io_hints
*/
-module_param(major_nr, int,0);
-module_param(minor_count, int,0);
-module_param(disable_io_hints,int,0);
+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;
int major_nr = LANANA_DRBD_MAJOR;
#ifdef MODULE
int minor_count = 2;
@@ -134,7 +136,7 @@
int disable_io_hints = 0;
// devfs name
-char* drbd_devfs_name = "nbd";
+char* drbd_devfs_name = "drbd";
// global panic flag
@@ -445,9 +447,9 @@
os = mdev->cstate;
-#if DUMP_MD > 1
- INFO("%s [%d]: cstate %s(%d) --> %s(%d)\n", current->comm, current->pid,
- cstate_to_name(os),os, cstate_to_name(ns),ns );
+#if DUMP_MD >= 2
+ INFO("%s [%d]: cstate %s --> %s\n", current->comm, current->pid,
+ cstate_to_name(os), cstate_to_name(ns) );
#endif
mdev->cstate = ns;
@@ -1680,15 +1682,8 @@
return -EINVAL;
}
- /* FIXME maybe allow only certain ranges? */
- if (1 > major_nr||major_nr > 254) {
- printk(KERN_ERR DEVICE_NAME
- ": invalid major_nr (%d)\n",major_nr);
-#ifdef MODULE
- return -EINVAL;
-#else
- major_nr = LANANA_DRBD_MAJOR;
-#endif
+ if (use_nbd_major) {
+ major_nr = NBD_MAJOR;
}
if (1 > minor_count||minor_count > 255) {
@@ -1859,6 +1854,9 @@
"Version: " REL_VERSION " (api:%d/proto:%d)\n",
API_VERSION,PRO_VERSION);
printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
+ if (use_nbd_major) {
+ printk(KERN_INFO DEVICE_NAME": hijacking NBD device major!\n");
+ }
printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", MAJOR_NR);
return 0; // Success!
@@ -2060,7 +2058,7 @@
return 0;
}
-#if DUMP_MD
+#if DUMP_MD >= 1
#define MeGC(x) mdev->gen_cnt[x]
#define PeGC(x) be32_to_cpu(peer->gen_cnt[x])
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2004-07-30 11:29:14 UTC (rev 1471)
+++ trunk/drbd/drbd_receiver.c 2004-07-30 12:26:17 UTC (rev 1472)
@@ -1471,8 +1471,6 @@
}
if(mdev->cstate > Connected ) {
WARN("Resync aborted.\n");
- if(mdev->cstate == SyncTarget)
- set_bit(STOP_SYNC_TIMER,&mdev->flags);
set_cstate(mdev,Connected);
}
} else {
Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h 2004-07-30 11:29:14 UTC (rev 1471)
+++ trunk/drbd/linux/drbd_config.h 2004-07-30 12:26:17 UTC (rev 1472)
@@ -31,7 +31,7 @@
//#define DBG_SPINLOCKS // enables MUST_HOLD macro (assertions for spinlocks)
//#define DBG_ASSERTS // drbd_assert_breakpoint() function
//#define DUMP_MD 1 // Dump metadata to syslog upon connect
-//#define DUMP_MD 2 // Dump even all cstate changes (I like it!)
+#define DUMP_MD 2 // Dump even all cstate changes (I like it!)
//#define DUMP_MD 3 // Dump even all meta data access
// (don't! unless we track down a bug...)