Skip to content

Commit

Permalink
dm log: use standard kernel module refcount
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Snitzer authored and Alasdair G Kergon committed Apr 2, 2009
1 parent b81d6cf commit 84e67c9
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions drivers/md/dm-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 84e67c9

Please sign in to comment.