[dm-devel] [PATCH] 2.6.0-t6-mm1-dm2: 7/7: Build snapshot as part of dm-mod

Kevin Corry kevcorry at us.ibm.com
Mon Oct 20 13:34:03 UTC 2003


Building snapshot as its own kernel module currently creates circular module
dependencies.  Build dm-snapshot as part of dm-mod (just like dm-linear and
dm-stripe) to avoid this problem.

If we really want to be able to build snapshot as its own module, then the
other option (as I mentioned in an email last week) is to rename dm-snapshot.c
to dm-snap.c (or something like that) and make some changes to the Makefile.
If you'd prefer this method, let me know and I'll send a different patch.

--- a/drivers/md/Kconfig	2003-10-20 12:21:30.000000000 -0500
+++ b/drivers/md/Kconfig	2003-10-20 12:12:10.000000000 -0500
@@ -143,12 +143,6 @@
 	  Recent tools use a new version of the ioctl interface, only
           select this option if you intend using such tools.
 
-config DM_SNAPSHOT
-	tristate "Snapshot target (EXPERIMENTAL)"
-	depends on BLK_DEV_DM && EXPERIMENTAL
-	---help---
-	  Allow volume managers to take writeable snapshots of a device.
-
 config DM_MIRROR
 	tristate "Mirror target (EXPERIMENTAL)"
 	depends on BLK_DEV_DM && EXPERIMENTAL
--- a/drivers/md/Makefile	2003-10-20 12:21:30.000000000 -0500
+++ b/drivers/md/Makefile	2003-10-20 12:11:58.000000000 -0500
@@ -3,7 +3,8 @@
 #
 
 dm-mod-objs	:= dm.o dm-table.o dm-target.o dm-linear.o dm-stripe.o \
-		   dm-ioctl.o dm-io.o kcopyd.o dm-daemon.o
+		   dm-ioctl.o dm-io.o kcopyd.o dm-daemon.o \
+		   dm-snapshot.o dm-exception-store.o
 
 dm-mirror-objs	:= dm-log.o dm-raid1.o
 
@@ -19,5 +20,4 @@
 obj-$(CONFIG_MD_MULTIPATH)	+= multipath.o
 obj-$(CONFIG_BLK_DEV_MD)	+= md.o
 obj-$(CONFIG_BLK_DEV_DM)	+= dm-mod.o
-obj-$(CONFIG_DM_SNAPSHOT)	+= dm-snapshot.o dm-exception-store.o
 obj-$(CONFIG_DM_MIRROR)		+= dm-mirror.o
--- a/drivers/md/dm-snapshot.c	2003-10-20 12:21:30.000000000 -0500
+++ b/drivers/md/dm-snapshot.c	2003-10-20 12:10:36.000000000 -0500
@@ -1205,7 +1205,7 @@
 	status:	snapshot_status,
 };
 
-static int __init dm_snapshot_init(void)
+int __init dm_snapshot_init(void)
 {
 	int r;
 
@@ -1271,7 +1271,7 @@
 	return r;
 }
 
-static void __exit dm_snapshot_exit(void)
+void __exit dm_snapshot_exit(void)
 {
 	int r;
 
@@ -1289,10 +1289,3 @@
 	kmem_cache_destroy(exception_cache);
 }
 
-/* Module hooks */
-module_init(dm_snapshot_init);
-module_exit(dm_snapshot_exit);
-
-MODULE_DESCRIPTION(DM_NAME " snapshot target");
-MODULE_AUTHOR("Joe Thornber");
-MODULE_LICENSE("GPL");
--- a/drivers/md/dm.c	2003-10-20 12:21:30.000000000 -0500
+++ b/drivers/md/dm.c	2003-10-20 12:10:36.000000000 -0500
@@ -153,6 +153,7 @@
 	xx(dm_linear)
 	xx(dm_stripe)
 	xx(kcopyd)
+	xx(dm_snapshot)
 	xx(dm_interface)
 #undef xx
 };
--- a/drivers/md/dm.h	2003-10-20 12:21:30.000000000 -0500
+++ b/drivers/md/dm.h	2003-10-20 12:10:36.000000000 -0500
@@ -180,6 +180,9 @@
 int kcopyd_init(void);
 void kcopyd_exit(void);
 
+int dm_snapshot_init(void);
+void dm_snapshot_exit(void);
+
 void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
 
 #endif





More information about the dm-devel mailing list