From a90d90f35bba6208a94d66c00216d06efb2b88c8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 3 Dec 2016 15:39:34 -0500 Subject: [PATCH] add patch mbcache-remove-unnecessary-module_get_put --- mbcache-remove-unnecessary-module_get_put | 57 +++++++++++++++++++++++++++++++ series | 1 + timestamps | 7 ++-- 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 mbcache-remove-unnecessary-module_get_put diff --git a/mbcache-remove-unnecessary-module_get_put b/mbcache-remove-unnecessary-module_get_put new file mode 100644 index 00000000..187f8cfe --- /dev/null +++ b/mbcache-remove-unnecessary-module_get_put @@ -0,0 +1,57 @@ +mbcache: remove unnecessary module_get/module_put + +From: Eric Biggers + +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: Eric Biggers +Signed-off-by: Theodore Ts'o +Reviewed-by: Jan Kara +--- + fs/mbcache.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/fs/mbcache.c b/fs/mbcache.c +index c56ab21..07c5d7d 100644 +--- a/fs/mbcache.c ++++ b/fs/mbcache.c +@@ -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); + +-- +2.8.0.rc3.226.g39d4020 + +-- +To unsubscribe from this list: send the line "unsubscribe linux-ext4" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + diff --git a/series b/series index 92e34e4b..3d363cea 100644 --- a/series +++ b/series @@ -53,6 +53,7 @@ fix-reading-new-encrypted-symlinks-on-no-journal-file-systems mbcache-correctly-handled-e_referenced-bit mbache-dont-bug-if-entry-cache-cannot-be-allocated +mbcache-remove-unnecessary-module_get_put #################################################### # unstable patches diff --git a/timestamps b/timestamps index b3ca2a4f..db51f58f 100755 --- a/timestamps +++ b/timestamps @@ -90,7 +90,8 @@ touch -d @1480622917 validate-s_first_meta_bg-at-mount-time touch -d @1480698773 fix-reading-new-encrypted-symlinks-on-no-journal-file-systems touch -d @1480698833 stable-boundary touch -d @1480795995 mbcache-correctly-handled-e_referenced-bit -touch -d @1480796027 status touch -d @1480796933 mbache-dont-bug-if-entry-cache-cannot-be-allocated -touch -d @1480796969 series -touch -d @1480796973 timestamps +touch -d @1480796984 status +touch -d @1480797509 mbcache-remove-unnecessary-module_get_put +touch -d @1480797552 series +touch -d @1480797554 timestamps -- 2.11.4.GIT