From 41e6d32086e7b69002505c29bacb610b86bba232 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 1 Mar 2008 18:57:24 +0000 Subject: [PATCH] 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) --- src/WINNT/afsd/cm_buf.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index e0928feec3..e041d09513 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -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); }