windows-afsd-dir-prefetch-20081226
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 26 Dec 2008 23:34:26 +0000 (23:34 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 26 Dec 2008 23:34:26 +0000 (23:34 +0000)
LICENSE MIT

when prefetching the directory buffers do not call cm_FlushFile to
discard locally modified buffers.  Instead just set the cm_scache_t
bufDataVersionLow to the current version.  out of date buffers will
therefore be ignored without requiring that locks be dropped and
reacquired and without searching all of the buffers associated with
the directory.

src/WINNT/afsd/cm_dir.c

index 5f2439c..ceb92ff 100644 (file)
@@ -600,6 +600,8 @@ cm_DirLookup(cm_dirOp_t * op, char *entry, cm_fid_t * cfid)
     LARGE_INTEGER       start;
     LARGE_INTEGER       end;
 
+    lock_AssertNone(&op->scp->rw);
+
     QueryPerformanceCounter(&start);
 
     osi_Log2(afsd_logp, "cm_DirLookup for op 0x%p, entry[%s]",
@@ -1498,13 +1500,8 @@ cm_DirPrefetchBuffers(cm_dirOp_t * op)
        contents just to make sure that we don't end up with buffers
        that was locally modified. */
 
-    if (op->scp->flags & CM_SCACHEFLAG_LOCAL) {
-        lock_ReleaseWrite(&op->scp->rw);
-        code = cm_FlushFile(op->scp, op->userp, &op->req);
-        if (code != 0)
-            return code;
-        lock_ObtainWrite(&op->scp->rw);
-    }
+    if (op->scp->flags & CM_SCACHEFLAG_LOCAL)
+        op->scp->bufDataVersionLow = op->scp->dataVersion;
 
     offset = ConvertLongToLargeInteger(0);
     while (LargeIntegerLessThan(offset, op->scp->length)) {