]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: Streamline the rare "found" case
authorChuck Lever <chuck.lever@oracle.com>
Tue, 28 Sep 2021 15:40:59 +0000 (11:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:00 +0000 (16:19 +0200)
[ Upstream commit add1511c38166cf1036765f8c4aa939f0275a799 ]

Move a rarely called function call site out of the hot path.

This is an exceptionally small improvement because the compiler
inlines most of the functions that nfsd_cache_lookup() calls.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfscache.c

index 1523d2e3dae9780aa34239de22fe3b5a32bf8bbd..7da88bdc0d6c36bdd5da24f69a3870718dd4ee44 100644 (file)
@@ -448,11 +448,8 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp)
        b = nfsd_cache_bucket_find(rqstp->rq_xid, nn);
        spin_lock(&b->cache_lock);
        found = nfsd_cache_insert(b, rp, nn);
-       if (found != rp) {
-               nfsd_reply_cache_free_locked(NULL, rp, nn);
-               rp = found;
+       if (found != rp)
                goto found_entry;
-       }
 
        nfsd_stats_rc_misses_inc();
        rqstp->rq_cacherep = rp;
@@ -470,8 +467,10 @@ out:
 
 found_entry:
        /* We found a matching entry which is either in progress or done. */
+       nfsd_reply_cache_free_locked(NULL, rp, nn);
        nfsd_stats_rc_hits_inc();
        rtn = RC_DROPIT;
+       rp = found;
 
        /* Request being processed */
        if (rp->c_state == RC_INPROG)