cache: stop holding the ncneg_hot lock across purging

Only non-hot entries are purged so the lock is not needed in the first place.
This saves one lock/unlock pair.

MFC after:	1 week
This commit is contained in:
Mateusz Guzik 2017-05-04 03:11:59 +00:00
parent c321779676
commit 8066a14a3c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317784

View File

@ -735,13 +735,12 @@ cache_negative_remove(struct namecache *ncp, bool neg_locked)
list_locked = true;
mtx_lock(&neglist->nl_lock);
}
} else {
mtx_assert(&neglist->nl_lock, MA_OWNED);
mtx_assert(&ncneg_hot.nl_lock, MA_OWNED);
}
if (ncp->nc_flag & NCF_HOTNEGATIVE) {
mtx_assert(&ncneg_hot.nl_lock, MA_OWNED);
TAILQ_REMOVE(&ncneg_hot.nl_list, ncp, nc_dst);
} else {
mtx_assert(&neglist->nl_lock, MA_OWNED);
TAILQ_REMOVE(&neglist->nl_list, ncp, nc_dst);
}
if (list_locked)
@ -816,7 +815,6 @@ cache_negative_zap_one(void)
mtx_unlock(&ncneg_hot.nl_lock);
mtx_lock(dvlp);
rw_wlock(blp);
mtx_lock(&ncneg_hot.nl_lock);
mtx_lock(&neglist->nl_lock);
ncp2 = TAILQ_FIRST(&neglist->nl_list);
if (ncp != ncp2 || dvlp != VP2VNODELOCK(ncp2->nc_dvp) ||
@ -830,7 +828,6 @@ cache_negative_zap_one(void)
cache_zap_locked(ncp, true);
out_unlock_all:
mtx_unlock(&neglist->nl_lock);
mtx_unlock(&ncneg_hot.nl_lock);
rw_wunlock(blp);
mtx_unlock(dvlp);
out: