Commit 84e67c93 authored by Mike Snitzer's avatar Mike Snitzer Committed by Alasdair G Kergon

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: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent b81d6cf7
...@@ -20,7 +20,6 @@ struct dm_dirty_log_internal { ...@@ -20,7 +20,6 @@ struct dm_dirty_log_internal {
struct dm_dirty_log_type *type; struct dm_dirty_log_type *type;
struct list_head list; struct list_head list;
long use;
}; };
static LIST_HEAD(_log_types); static LIST_HEAD(_log_types);
...@@ -44,12 +43,8 @@ static struct dm_dirty_log_internal *_get_dirty_log_type(const char *name) ...@@ -44,12 +43,8 @@ static struct dm_dirty_log_internal *_get_dirty_log_type(const char *name)
spin_lock(&_lock); spin_lock(&_lock);
log_type = __find_dirty_log_type(name); log_type = __find_dirty_log_type(name);
if (log_type) { if (log_type && !try_module_get(log_type->type->module))
if (!log_type->use && !try_module_get(log_type->type->module)) log_type = NULL;
log_type = NULL;
else
log_type->use++;
}
spin_unlock(&_lock); spin_unlock(&_lock);
...@@ -120,10 +115,7 @@ static void put_type(struct dm_dirty_log_type *type) ...@@ -120,10 +115,7 @@ static void put_type(struct dm_dirty_log_type *type)
if (!log_type) if (!log_type)
goto out; goto out;
if (!--log_type->use) module_put(type->module);
module_put(type->module);
BUG_ON(log_type->use < 0);
out: out:
spin_unlock(&_lock); spin_unlock(&_lock);
...@@ -173,11 +165,6 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type) ...@@ -173,11 +165,6 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type)
return -EINVAL; return -EINVAL;
} }
if (log_type->use) {
spin_unlock(&_lock);
return -ETXTBSY;
}
list_del(&log_type->list); list_del(&log_type->list);
spin_unlock(&_lock); spin_unlock(&_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment