DEVEL15-windows-buf-more-clean-vnode-speedups-20080301

LICENSE MIT

do not call buf_CleanAsync if you know the buffer isn't dirty


(cherry picked from commit b47407ae72491a129fc9ed6990585e426fc2a223)
This commit is contained in:
Jeffrey Altman 2008-03-01 18:57:24 +00:00
parent 47801d13e0
commit 41e6d32086

View File

@ -1655,18 +1655,20 @@ long buf_CleanVnode(struct cm_scache *scp, cm_user_t *userp, cm_req_t *reqp)
/* clean buffer synchronously */
if (cm_FidCmp(&bp->fid, &scp->fid) == 0) {
lock_ObtainMutex(&bp->mx);
if (userp) {
cm_HoldUser(userp);
if (bp->userp)
cm_ReleaseUser(bp->userp);
bp->userp = userp;
}
wasDirty = buf_CleanAsyncLocked(bp, reqp);
buf_CleanWait(scp, bp, TRUE);
if (bp->flags & CM_BUF_ERROR) {
code = bp->error;
if (code == 0)
code = -1;
if (bp->flags & CM_BUF_DIRTY) {
if (userp) {
cm_HoldUser(userp);
if (bp->userp)
cm_ReleaseUser(bp->userp);
bp->userp = userp;
}
wasDirty = buf_CleanAsyncLocked(bp, reqp);
buf_CleanWait(scp, bp, TRUE);
if (bp->flags & CM_BUF_ERROR) {
code = bp->error;
if (code == 0)
code = -1;
}
}
lock_ReleaseMutex(&bp->mx);
}