libafs: Do not osi_FlushPages for dirs
authorAndrew Deason <adeason@sinenomine.net>
Thu, 17 Mar 2011 21:32:00 +0000 (16:32 -0500)
committerDerrick Brashear <shadow@dementia.org>
Mon, 21 Mar 2011 17:24:33 +0000 (10:24 -0700)
Directory contents are never mapped or stored in pages, so dealing
with page invalidation on directories is just overhead. So make
osi_FlushPages a no-op when we're given a directory, which can avoid a
lot of locks and other processing (particularly when we are called in
afs_getattr in BOZONLOCK_ENV).

Change-Id: I56fbd08c74d01a5fcb45a57e08bb31afcec9331d
Reviewed-on: http://gerrit.openafs.org/4259
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/afs_osi_vm.c

index c26df6d..66071ac 100644 (file)
@@ -58,6 +58,11 @@ osi_FlushPages(struct vcache *avc, afs_ucred_t *credp)
      * citi-tr-01-3.
      */
 #endif
+    if (vType(avc) == VDIR) {
+       /* not applicable to directories; they're never mapped or stored in
+        * pages */
+       return;
+    }
     ObtainReadLock(&avc->lock);
     /* If we've already purged this version, or if we're the ones
      * writing this version, don't flush it (could lose the