filedesc: avoid taking fdesc_mtx when not necessary in fddrop

No functional changes.
This commit is contained in:
Mateusz Guzik 2014-11-06 07:44:10 +00:00
parent eb6021fb96
commit 3ae366de58
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274166

View File

@ -1859,11 +1859,13 @@ fddrop(struct filedesc *fdp)
{
int i;
mtx_lock(&fdesc_mtx);
i = --fdp->fd_holdcnt;
mtx_unlock(&fdesc_mtx);
if (i > 0)
return;
if (fdp->fd_holdcnt > 1) {
mtx_lock(&fdesc_mtx);
i = --fdp->fd_holdcnt;
mtx_unlock(&fdesc_mtx);
if (i > 0)
return;
}
FILEDESC_LOCK_DESTROY(fdp);
uma_zfree(filedesc0_zone, fdp);