aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-log.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2009-04-02 14:55:29 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 14:55:29 -0400
commit84e67c9319eb2232757a022c24f6a461291eaee5 (patch)
tree581e427fa8bc914089de24f70235e471c5bd0c5b /drivers/md/dm-log.c
parentb81d6cf79b57f6123a5d4f7a4932cc359995484d (diff)
dm log: use standard kernel module refcount
Avoid private module usage accounting by removing 'use' from dm_dirty_log_internal. The standard module reference counting is sufficient. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-log.c')
-rw-r--r--drivers/md/dm-log.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 737961f275c1..094c8f0e0097 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -20,7 +20,6 @@ struct dm_dirty_log_internal {
20 struct dm_dirty_log_type *type; 20 struct dm_dirty_log_type *type;
21 21
22 struct list_head list; 22 struct list_head list;
23 long use;
24}; 23};
25 24
26static LIST_HEAD(_log_types); 25static LIST_HEAD(_log_types);
@@ -44,12 +43,8 @@ static struct dm_dirty_log_internal *_get_dirty_log_type(const char *name)
44 spin_lock(&_lock); 43 spin_lock(&_lock);
45 44
46 log_type = __find_dirty_log_type(name); 45 log_type = __find_dirty_log_type(name);
47 if (log_type) { 46 if (log_type && !try_module_get(log_type->type->module))
48 if (!log_type->use && !try_module_get(log_type->type->module)) 47 log_type = NULL;
49 log_type = NULL;
50 else
51 log_type->use++;
52 }
53 48
54 spin_unlock(&_lock); 49 spin_unlock(&_lock);
55 50
@@ -120,10 +115,7 @@ static void put_type(struct dm_dirty_log_type *type)
120 if (!log_type) 115 if (!log_type)
121 goto out; 116 goto out;
122 117
123 if (!--log_type->use) 118 module_put(type->module);
124 module_put(type->module);
125
126 BUG_ON(log_type->use < 0);
127 119
128out: 120out:
129 spin_unlock(&_lock); 121 spin_unlock(&_lock);
@@ -173,11 +165,6 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type)
173 return -EINVAL; 165 return -EINVAL;
174 } 166 }
175 167
176 if (log_type->use) {
177 spin_unlock(&_lock);
178 return -ETXTBSY;
179 }
180
181 list_del(&log_type->list); 168 list_del(&log_type->list);
182 169
183 spin_unlock(&_lock); 170 spin_unlock(&_lock);