Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1742

kernel-2.6.18-238.el5.src.rpm

From: Jonathan Brassow <jbrassow@redhat.com>
Date: Thu, 11 Sep 2008 16:04:16 -0400
Subject: [md] dm-log: move dirty log into separate module
Message-id: 640788213.299821221163456540.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com
O-Subject: Re: [RHEL 5.3 Patch 2 of 8]: device-mapper interface exposure (bz 429337)
Bugzilla: 429337
RH-Acked-by: Alasdair G Kergon <agk@redhat.com>

Repost w/ static attribute.

 brassow

Move the dirty region log code into a separate module so
other targets can share the code.

Originator: Heinz Mauelshagen <hjm@redhat.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>

diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index fd566c0..eb99c74 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -6,7 +6,7 @@ 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-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o
 dm-snapshot-objs := dm-snap.o dm-exception-store.o
-dm-mirror-objs	:= dm-log.o dm-raid1.o
+dm-mirror-objs	:= dm-raid1.o
 dm-rdac-objs	:= dm-mpath-rdac.o
 dm-hp-sw-objs	:= dm-mpath-hp-sw.o
 md-mod-objs     := md.o bitmap.o
@@ -38,7 +38,7 @@ obj-$(CONFIG_DM_MULTIPATH_EMC)	+= dm-emc.o
 obj-$(CONFIG_DM_MULTIPATH_HP)	+= dm-hp-sw.o
 obj-$(CONFIG_DM_MULTIPATH_RDAC)	+= dm-rdac.o
 obj-$(CONFIG_DM_SNAPSHOT)	+= dm-snapshot.o
-obj-$(CONFIG_DM_MIRROR)		+= dm-mirror.o
+obj-$(CONFIG_DM_MIRROR)		+= dm-mirror.o dm-log.o
 obj-$(CONFIG_DM_ZERO)		+= dm-zero.o
 
 quiet_cmd_unroll = UNROLL  $@
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 6b2470f..2f46321 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -806,7 +806,7 @@ static struct dirty_log_type _disk_type = {
 	.get_failure_response = core_get_failure_response,
 };
 
-int __init dm_dirty_log_init(void)
+static int __init dm_dirty_log_init(void)
 {
 	int r;
 
@@ -823,7 +823,7 @@ int __init dm_dirty_log_init(void)
 	return r;
 }
 
-void dm_dirty_log_exit(void)
+static void __exit dm_dirty_log_exit(void)
 {
 	dm_unregister_dirty_log_type(&_disk_type);
 	dm_unregister_dirty_log_type(&_core_type);
@@ -833,3 +833,10 @@ EXPORT_SYMBOL(dm_register_dirty_log_type);
 EXPORT_SYMBOL(dm_unregister_dirty_log_type);
 EXPORT_SYMBOL(dm_create_dirty_log);
 EXPORT_SYMBOL(dm_destroy_dirty_log);
+
+module_init(dm_dirty_log_init);
+module_exit(dm_dirty_log_exit);
+
+MODULE_DESCRIPTION(DM_NAME " dirty region log");
+MODULE_AUTHOR("Joe Thornber, Heinz Mauelshagen <dm-devel@redhat.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/md/dm-log.h b/drivers/md/dm-log.h
index d32eec4..ce6ca9d 100644
--- a/drivers/md/dm-log.h
+++ b/drivers/md/dm-log.h
@@ -151,10 +151,4 @@ struct dirty_log *dm_create_dirty_log(const char *type_name, struct dm_target *t
 				      unsigned int argc, char **argv);
 void dm_destroy_dirty_log(struct dirty_log *log);
 
-/*
- * init/exit functions.
- */
-int dm_dirty_log_init(void);
-void dm_dirty_log_exit(void);
-
 #endif
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 9810fe3..3a2a4a1 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1777,16 +1777,10 @@ static int __init dm_mirror_init(void)
 	if (!bio_map_info_pool)
 		return -ENOMEM;
 
-	r = dm_dirty_log_init();
-	if (r)
-		return r;
-
 	r = dm_register_target(&mirror_target);
-	if (r < 0) {
+	if (r < 0)
 		DMERR("%s: Failed to register mirror target",
 		      mirror_target.name);
-		dm_dirty_log_exit();
-	}
 
 	return r;
 }
@@ -1798,8 +1792,6 @@ static void __exit dm_mirror_exit(void)
 	r = dm_unregister_target(&mirror_target);
 	if (r < 0)
 		DMERR("%s: unregister failed %d", mirror_target.name, r);
-
-	dm_dirty_log_exit();
 }
 
 /* Module hooks */