]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libafs: use afs_ResetVCache in flush volume data
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 7 Jun 2012 16:58:54 +0000 (12:58 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 30 Aug 2013 10:00:16 +0000 (03:00 -0700)
Remove some code duplication by using afs_ResetVCache
in the flush volume data pioctl. Adds a flag to
ResetVCache to avoid unneeded calls to purge dnlc
when reseting all the vcaches in a volume.

Adds freeing of vcache link data in the flush volume
data pioctl.

Reviewed-on: http://gerrit.openafs.org/7538
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 36c6c46bd081e0278611c3bb6ae25dd765f10648)

Change-Id: I0c4a001c20633a404c299359914f2368b4492901
Reviewed-on: http://gerrit.openafs.org/9388
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/afs_disconnected.c
src/afs/afs_pioctl.c
src/afs/afs_prototypes.h
src/afs/afs_vcache.c

index a587538ecf3ff67f42d8785900ca216845dd0896..04107f0ab2e0316fd13413f10997858d633860a8 100644 (file)
@@ -1234,7 +1234,7 @@ afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred)
        } else if (afs_ConflictPolicy == SERVER_WINS) {
            /* DV mismatch, apply collision resolution policy. */
            /* Discard this files chunks and remove from current dir. */
-           afs_ResetVCache(tvc, acred);
+           afs_ResetVCache(tvc, acred, 0);
            tvc->f.truncPos = AFS_NOTRUNC;
        } else {
            /* printf("afs_ResyncDisconFiles: no resolution policy selected.\n"); */
@@ -1327,7 +1327,7 @@ afs_DisconDiscardAllShadows(int squash, afs_ucred_t *acred)
        ObtainWriteLock(&tvc->lock, 706);
 
        if (squash)
-          afs_ResetVCache(tvc, acred);
+          afs_ResetVCache(tvc, acred, 0);
 
        afs_DeleteShadowDir(tvc);
 
@@ -1356,7 +1356,7 @@ afs_DisconDiscardAll(afs_ucred_t *acred)
        ReleaseWriteLock(&afs_disconDirtyLock);
 
        ObtainWriteLock(&tvc->lock, 718);
-       afs_ResetVCache(tvc, acred);
+       afs_ResetVCache(tvc, acred, 0);
        tvc->f.truncPos = AFS_NOTRUNC;
        ReleaseWriteLock(&tvc->lock);
        ObtainWriteLock(&afs_disconDirtyLock, 719);
index e941d2681b1d7ec2de3fa50904b65cb6ffc926ad..fdd8c0255c62e0b387cbe4fabdf4faa6425c1509 100644 (file)
@@ -2128,7 +2128,7 @@ DECL_PIOCTL(PFlush)
     afs_BozonLock(&avc->pvnLock, avc); /* Since afs_TryToSmush will do a pvn_vptrunc */
 #endif
     ObtainWriteLock(&avc->lock, 225);
-    afs_ResetVCache(avc, *acred);
+    afs_ResetVCache(avc, *acred, 0);
     ReleaseWriteLock(&avc->lock);
 #ifdef AFS_BOZONLOCK_ENV
     afs_BozonUnlock(&avc->pvnLock, avc);
@@ -3469,14 +3469,7 @@ DECL_PIOCTL(PFlushVolumeData)
                afs_BozonLock(&tvc->pvnLock, tvc);      /* Since afs_TryToSmush will do a pvn_vptrunc */
 #endif
                ObtainWriteLock(&tvc->lock, 232);
-
-               ObtainWriteLock(&afs_xcbhash, 458);
-               afs_DequeueCallback(tvc);
-               tvc->f.states &= ~(CStatd | CDirty);
-               ReleaseWriteLock(&afs_xcbhash);
-               if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))
-                   osi_dnlc_purgedp(tvc);
-               afs_TryToSmush(tvc, *acred, 1);
+               afs_ResetVCache(tvc, *acred, 1);
                ReleaseWriteLock(&tvc->lock);
 #ifdef AFS_BOZONLOCK_ENV
                afs_BozonUnlock(&tvc->pvnLock, tvc);
index 8b0be90fb418c93944fe2413a923d00ed8b87220..54ce2fd029f1a706a2294bdb8c6d82b63ce414c1 100644 (file)
@@ -1087,7 +1087,7 @@ extern int afs_RemoteLookup(struct VenusFid *afid,
                            struct AFSCallBack *CallBackp,
                            struct server **serverp,
                            struct AFSVolSync *tsyncp);
-extern void afs_ResetVCache(struct vcache *, afs_ucred_t *);
+extern void afs_ResetVCache(struct vcache *, afs_ucred_t *, afs_int32 skipdnlc);
 extern afs_int32 afs_NFSFindVCache(struct vcache **avcp,
                                   struct VenusFid *afid);
 extern void afs_vcacheInit(int astatSize);
index 96cb5883729117da004e61a2d599c774e6cb5d48..9d3a11482272c0d25be51256134a4d86ad3f0342 100644 (file)
@@ -2559,11 +2559,14 @@ afs_PutVCache(struct vcache *avc)
  *
  * \param avc Pointer to the cache entry to reset
  * \param acred
+ * \param skipdnlc  skip the dnlc purge for this vnode
  *
  * \note avc must be write locked on entry
+ *
+ * \note The caller should purge the dnlc when skipdnlc is set.
  */
 void
-afs_ResetVCache(struct vcache *avc, afs_ucred_t *acred)
+afs_ResetVCache(struct vcache *avc, afs_ucred_t *acred, afs_int32 skipdnlc)
 {
     ObtainWriteLock(&afs_xcbhash, 456);
     afs_DequeueCallback(avc);
@@ -2571,7 +2574,9 @@ afs_ResetVCache(struct vcache *avc, afs_ucred_t *acred)
     ReleaseWriteLock(&afs_xcbhash);
     /* now find the disk cache entries */
     afs_TryToSmush(avc, acred, 1);
-    osi_dnlc_purgedp(avc);
+    if (!skipdnlc) {
+       osi_dnlc_purgedp(avc);
+    }
     if (avc->linkData && !(avc->f.states & CCore)) {
        afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
        avc->linkData = NULL;