diff options
author | Mike Snitzer <snitzer@redhat.com> | 2009-04-02 20:55:29 +0200 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-04-02 20:55:29 +0200 |
commit | 84e67c9319eb2232757a022c24f6a461291eaee5 (patch) | |
tree | 581e427fa8bc914089de24f70235e471c5bd0c5b /drivers/md/dm-log.c | |
parent | dm crypt: use kzfree (diff) | |
download | linux-84e67c9319eb2232757a022c24f6a461291eaee5.tar.xz linux-84e67c9319eb2232757a022c24f6a461291eaee5.zip |
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.c | 19 |
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 { struct dm_dirty_log_type *type; struct list_head list; - long use; }; static LIST_HEAD(_log_types); @@ -44,12 +43,8 @@ static struct dm_dirty_log_internal *_get_dirty_log_type(const char *name) spin_lock(&_lock); log_type = __find_dirty_log_type(name); - if (log_type) { - if (!log_type->use && !try_module_get(log_type->type->module)) - log_type = NULL; - else - log_type->use++; - } + if (log_type && !try_module_get(log_type->type->module)) + log_type = NULL; spin_unlock(&_lock); @@ -120,10 +115,7 @@ static void put_type(struct dm_dirty_log_type *type) if (!log_type) goto out; - if (!--log_type->use) - module_put(type->module); - - BUG_ON(log_type->use < 0); + module_put(type->module); out: spin_unlock(&_lock); @@ -173,11 +165,6 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type) return -EINVAL; } - if (log_type->use) { - spin_unlock(&_lock); - return -ETXTBSY; - } - list_del(&log_type->list); spin_unlock(&_lock); |