Skip to content

Commit

Permalink
NFSD: Streamline the rare "found" case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chuck Lever committed Feb 28, 2022
1 parent 0f29ce3 commit add1511
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/nfsd/nfscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -470,8 +467,10 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp)

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)
Expand Down

0 comments on commit add1511

Please sign in to comment.