提交 97c7b18a 编写于 作者: E Eric Biggers 提交者: Theodore Ts'o

mbcache: remove unnecessary module_get/module_put

When mbcache is built as a module, any modules that use it (ext2 and/or
ext4) will depend on its symbols directly, incrementing its reference
count.  Therefore, there is no need to do module_get/module_put.

Also note that since the module_get/module_put were in the mbcache
module itself, executing those lines of code was already dependent on
another reference to the mbcache module being held.
Signed-off-by: NEric Biggers <ebiggers@google.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
Reviewed-by: NJan Kara <jack@suse.cz>
上级 21d0f4fa
......@@ -344,9 +344,6 @@ struct mb_cache *mb_cache_create(int bucket_bits)
int bucket_count = 1 << bucket_bits;
int i;
if (!try_module_get(THIS_MODULE))
return NULL;
cache = kzalloc(sizeof(struct mb_cache), GFP_KERNEL);
if (!cache)
goto err_out;
......@@ -377,7 +374,6 @@ struct mb_cache *mb_cache_create(int bucket_bits)
return cache;
err_out:
module_put(THIS_MODULE);
return NULL;
}
EXPORT_SYMBOL(mb_cache_create);
......@@ -411,7 +407,6 @@ void mb_cache_destroy(struct mb_cache *cache)
}
kfree(cache->c_hash);
kfree(cache);
module_put(THIS_MODULE);
}
EXPORT_SYMBOL(mb_cache_destroy);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册