Currently, fscache_get_cache_maybe() has a where parameter passed only
by fscache_lookup_cache(). And it is always fscache_cache_get_acquire
due to not using the candidate cache. So, do not pass the where
indication in, we use fscache_cache_get_acquire directly instead.

Signed-off-by: Yue Hu <huy...@coolpad.com>
---
 fs/fscache/cache.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/fs/fscache/cache.c b/fs/fscache/cache.c
index d645f8b302a2..70c953e82fa0 100644
--- a/fs/fscache/cache.c
+++ b/fs/fscache/cache.c
@@ -41,15 +41,15 @@ static struct fscache_cache *fscache_alloc_cache(const char 
*name)
        return cache;
 }
 
-static bool fscache_get_cache_maybe(struct fscache_cache *cache,
-                                   enum fscache_cache_trace where)
+static bool fscache_get_cache_maybe(struct fscache_cache *cache)
 {
        bool success;
        int ref;
 
        success = __refcount_inc_not_zero(&cache->ref, &ref);
        if (success)
-               trace_fscache_cache(cache->debug_id, ref + 1, where);
+               trace_fscache_cache(cache->debug_id, ref + 1,
+                                   fscache_cache_get_acquire);
        return success;
 }
 
@@ -65,17 +65,15 @@ struct fscache_cache *fscache_lookup_cache(const char 
*name, bool is_cache)
 
        list_for_each_entry(cache, &fscache_caches, cache_link) {
                if (cache->name && name && strcmp(cache->name, name) == 0 &&
-                   fscache_get_cache_maybe(cache, fscache_cache_get_acquire))
+                   fscache_get_cache_maybe(cache))
                        goto got_cache_r;
-               if (!cache->name && !name &&
-                   fscache_get_cache_maybe(cache, fscache_cache_get_acquire))
+               if (!cache->name && !name && fscache_get_cache_maybe(cache))
                        goto got_cache_r;
        }
 
        if (!name) {
                list_for_each_entry(cache, &fscache_caches, cache_link) {
-                       if (cache->name &&
-                           fscache_get_cache_maybe(cache, 
fscache_cache_get_acquire))
+                       if (cache->name && fscache_get_cache_maybe(cache))
                                goto got_cache_r;
                }
        }
@@ -92,24 +90,21 @@ struct fscache_cache *fscache_lookup_cache(const char 
*name, bool is_cache)
 
        list_for_each_entry(cache, &fscache_caches, cache_link) {
                if (cache->name && name && strcmp(cache->name, name) == 0 &&
-                   fscache_get_cache_maybe(cache, fscache_cache_get_acquire))
+                   fscache_get_cache_maybe(cache))
                        goto got_cache_w;
                if (!cache->name) {
                        unnamed = cache;
-                       if (!name &&
-                           fscache_get_cache_maybe(cache, 
fscache_cache_get_acquire))
+                       if (!name && fscache_get_cache_maybe(cache))
                                goto got_cache_w;
                }
        }
 
-       if (unnamed && is_cache &&
-           fscache_get_cache_maybe(unnamed, fscache_cache_get_acquire))
+       if (unnamed && is_cache && fscache_get_cache_maybe(unnamed))
                goto use_unnamed_cache;
 
        if (!name) {
                list_for_each_entry(cache, &fscache_caches, cache_link) {
-                       if (cache->name &&
-                           fscache_get_cache_maybe(cache, 
fscache_cache_get_acquire))
+                       if (cache->name && fscache_get_cache_maybe(cache))
                                goto got_cache_w;
                }
        }
-- 
2.17.1
--
Linux-cachefs mailing list
Linux-cachefs@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-cachefs

Reply via email to