windows-buf-more-clean-vnode-speedups-20080301
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 1 Mar 2008 18:56:23 +0000 (18:56 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 1 Mar 2008 18:56:23 +0000 (18:56 +0000)
LICENSE MIT

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

src/WINNT/afsd/cm_buf.c

index e914e5f..37f4064 100644 (file)
@@ -1605,18 +1605,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);
         }