diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2020-10-16 00:55:31 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2020-10-16 00:55:31 +0000 |
commit | 640e6162ee80e33d90155b3bb22ab2607da6e160 (patch) | |
tree | 41d7a5dde47461456175605dbdb43c1dc81cc869 /sys | |
parent | c97c8746c0abd8ac4e90bdecb1f351e44d5ccfff (diff) | |
download | src-test2-640e6162ee80e33d90155b3bb22ab2607da6e160.tar.gz src-test2-640e6162ee80e33d90155b3bb22ab2607da6e160.zip |
Notes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_cache.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 2687deb27ce8..bf9ddc9bf22c 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -807,22 +807,34 @@ cache_negative_init(struct namecache *ncp) } static void -cache_negative_hit(struct namecache *ncp) +cache_negative_promote(struct namecache *ncp) { struct neglist *nl; struct negstate *ns; ns = NCP2NEGSTATE(ncp); - if ((ns->neg_flag & NEG_HOT) != 0) - return; nl = NCP2NEGLIST(ncp); - mtx_lock(&nl->nl_lock); + mtx_assert(&nl->nl_lock, MA_OWNED); if ((ns->neg_flag & NEG_HOT) == 0) { TAILQ_REMOVE(&nl->nl_list, ncp, nc_dst); TAILQ_INSERT_TAIL(&nl->nl_hotlist, ncp, nc_dst); nl->nl_hotnum++; ns->neg_flag |= NEG_HOT; } +} + +static void +cache_negative_hit(struct namecache *ncp) +{ + struct neglist *nl; + struct negstate *ns; + + ns = NCP2NEGSTATE(ncp); + if ((ns->neg_flag & NEG_HOT) != 0) + return; + nl = NCP2NEGLIST(ncp); + mtx_lock(&nl->nl_lock); + cache_negative_promote(ncp); mtx_unlock(&nl->nl_lock); } @@ -3376,7 +3388,6 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, struct componentname *cnp; struct namecache *ncp; struct neglist *nl; - struct negstate *ns; struct vnode *dvp; u_char nc_flag; @@ -3434,13 +3445,7 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, goto out_abort; } - ns = NCP2NEGSTATE(ncp); - if ((ns->neg_flag & NEG_HOT) == 0) { - TAILQ_REMOVE(&nl->nl_list, ncp, nc_dst); - TAILQ_INSERT_TAIL(&nl->nl_hotlist, ncp, nc_dst); - nl->nl_hotnum++; - ns->neg_flag |= NEG_HOT; - } + cache_negative_promote(ncp); SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); counter_u64_add(numneghits, 1); |