diff options
-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 { | |||
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 | ||
26 | static LIST_HEAD(_log_types); | 25 | static 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 | ||
128 | out: | 120 | out: |
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); |