]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/nfsd-streamline-the-rare-found-case.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / nfsd-streamline-the-rare-found-case.patch
1 From 987c4add1f01341650277784069a49897517ba1e Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Tue, 28 Sep 2021 11:40:59 -0400
4 Subject: NFSD: Streamline the rare "found" case
5
6 From: Chuck Lever <chuck.lever@oracle.com>
7
8 [ Upstream commit add1511c38166cf1036765f8c4aa939f0275a799 ]
9
10 Move a rarely called function call site out of the hot path.
11
12 This is an exceptionally small improvement because the compiler
13 inlines most of the functions that nfsd_cache_lookup() calls.
14
15 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
16 ---
17 fs/nfsd/nfscache.c | 7 +++----
18 1 file changed, 3 insertions(+), 4 deletions(-)
19
20 diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
21 index 1523d2e3dae97..7da88bdc0d6c3 100644
22 --- a/fs/nfsd/nfscache.c
23 +++ b/fs/nfsd/nfscache.c
24 @@ -448,11 +448,8 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp)
25 b = nfsd_cache_bucket_find(rqstp->rq_xid, nn);
26 spin_lock(&b->cache_lock);
27 found = nfsd_cache_insert(b, rp, nn);
28 - if (found != rp) {
29 - nfsd_reply_cache_free_locked(NULL, rp, nn);
30 - rp = found;
31 + if (found != rp)
32 goto found_entry;
33 - }
34
35 nfsd_stats_rc_misses_inc();
36 rqstp->rq_cacherep = rp;
37 @@ -470,8 +467,10 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp)
38
39 found_entry:
40 /* We found a matching entry which is either in progress or done. */
41 + nfsd_reply_cache_free_locked(NULL, rp, nn);
42 nfsd_stats_rc_hits_inc();
43 rtn = RC_DROPIT;
44 + rp = found;
45
46 /* Request being processed */
47 if (rp->c_state == RC_INPROG)
48 --
49 2.43.0
50