public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Olien <dmo@osdl.org>
To: thornber@redhat.com
Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] trivial patch to dm-log.c
Date: Wed, 28 Apr 2004 20:26:12 -0700	[thread overview]
Message-ID: <20040429032612.GA4193@osdl.org> (raw)



This patches dm-log.c.  In dm-register-dirty-log-type, I didn't
seem any reason for the try_module_get to be within locked region
of code. So I moved it.  I also added the error return case, in 
the event try_module_get() fails.

I added THIS_MODULE intializers to the _core_type and _disk_type
declarations.  This isn't strictly necessary, but I think is
good for consistency.

I reordered the __init declaration in dm_dirty_log_init() I removed
dm_dirty_log_init and dm_dirty_log_exit() from the EXPORT_SYMBOL()
list.



diff -ur linux-2.6.6-rc2-udm1-original/drivers/md/dm-log.c linux-2.6.6-rc2-udm1-patched/drivers/md/dm-log.c
--- linux-2.6.6-rc2-udm1-original/drivers/md/dm-log.c	2004-04-28 11:41:52.000000000 -0700
+++ linux-2.6.6-rc2-udm1-patched/drivers/md/dm-log.c	2004-04-28 20:15:59.000000000 -0700
@@ -17,10 +17,11 @@
 
 int dm_register_dirty_log_type(struct dirty_log_type *type)
 {
+	if (!try_module_get(type->module))
+		return -EINVAL;
+
 	spin_lock(&_lock);
 	type->use_count = 0;
-	try_module_get(type->module);
-
 	list_add(&type->list, &_log_types);
 	spin_unlock(&_lock);
 
@@ -567,6 +568,7 @@
 
 static struct dirty_log_type _core_type = {
 	.name = "core",
+	.module = THIS_MODULE,
 	.ctr = core_ctr,
 	.dtr = core_dtr,
 	.get_region_size = core_get_region_size,
@@ -582,6 +584,7 @@
 
 static struct dirty_log_type _disk_type = {
 	.name = "disk",
+	.module = THIS_MODULE,
 	.ctr = disk_ctr,
 	.dtr = disk_dtr,
 	.suspend = disk_flush,
@@ -597,7 +600,7 @@
         .get_sync_count = core_get_sync_count
 };
 
-__init int dm_dirty_log_init(void)
+int __init dm_dirty_log_init(void)
 {
 	int r;
 
@@ -622,7 +625,5 @@
 
 EXPORT_SYMBOL(dm_register_dirty_log_type);
 EXPORT_SYMBOL(dm_unregister_dirty_log_type);
-EXPORT_SYMBOL(dm_dirty_log_init);
-EXPORT_SYMBOL(dm_dirty_log_exit);
 EXPORT_SYMBOL(dm_create_dirty_log);
 EXPORT_SYMBOL(dm_destroy_dirty_log);

                 reply	other threads:[~2004-04-29  3:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040429032612.GA4193@osdl.org \
    --to=dmo@osdl.org \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thornber@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox