Windows: AFSFindObjectInfo update last access time
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 13 Apr 2013 05:52:45 +0000 (01:52 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 26 Apr 2013 13:23:20 +0000 (06:23 -0700)
Add a boolean parameter to AFSFindObjectInfo() which is used
to indicate whether or not the last access time for the found
ObjectInfoCB should be updated.

Set the new parameter in all calls to AFSFindObjectInfo().

Change-Id: Ib50d772af6857db7b8c13f2054e910f1ef5a1b7e
Reviewed-on: http://gerrit.openafs.org/9783
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSClose.cpp
src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h

index 6f2bcf1..c5aa1fa 100644 (file)
@@ -110,7 +110,8 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
         {
 
             pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                                   &pObjectInfo->ParentFileId);
+                                                   &pObjectInfo->ParentFileId,
+                                                   FALSE);
         }
 
         pRootFcb = pObjectInfo->VolumeCB->RootFcb;
index cddd8fb..5fc49ad 100644 (file)
@@ -162,7 +162,8 @@ AFSClose( IN PDEVICE_OBJECT LibDeviceObject,
                 {
 
                     pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                                           &pObjectInfo->ParentFileId);
+                                                           &pObjectInfo->ParentFileId,
+                                                           FALSE);
                 }
 
                 if( pParentObjectInfo != NULL &&
@@ -327,7 +328,8 @@ AFSClose( IN PDEVICE_OBJECT LibDeviceObject,
                 {
 
                     pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                                           &pObjectInfo->ParentFileId);
+                                                           &pObjectInfo->ParentFileId,
+                                                           FALSE);
                 }
 
                 //
@@ -515,7 +517,8 @@ AFSClose( IN PDEVICE_OBJECT LibDeviceObject,
                 {
 
                     pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                                           &pObjectInfo->ParentFileId);
+                                                           &pObjectInfo->ParentFileId,
+                                                           FALSE);
                 }
 
                 AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING,
index d860701..c7ba719 100644 (file)
@@ -1967,7 +1967,8 @@ AFSNotifyDelete( IN AFSDirectoryCB *DirectoryCB,
         pObjectInfo = DirectoryCB->ObjectInformation;
 
         pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                               &pObjectInfo->ParentFileId);
+                                               &pObjectInfo->ParentFileId,
+                                               FALSE);
 
         stDelete.ParentId = pObjectInfo->ParentFileId;
 
@@ -2688,7 +2689,8 @@ AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo,
         {
 
             pParentObjectInfo = AFSFindObjectInfo( ObjectInfo->VolumeCB,
-                                                   &ObjectInfo->ParentFileId);
+                                                   &ObjectInfo->ParentFileId,
+                                                   TRUE);
 
             stTargetID.ParentId = ObjectInfo->ParentFileId;
         }
index ea0d7bc..81d9d8a 100644 (file)
@@ -2372,7 +2372,8 @@ AFSOpenTargetDirectory( IN PIRP Irp,
         {
 
             pGrandParentObject = AFSFindObjectInfo( pParentObject->VolumeCB,
-                                                    &pParentObject->ParentFileId);
+                                                    &pParentObject->ParentFileId,
+                                                    TRUE);
 
             if ( pGrandParentObject)
             {
@@ -3710,7 +3711,8 @@ AFSOpenSpecialShareFcb( IN PIRP Irp,
         {
 
             pParentObjectInfo = AFSFindObjectInfo( pObjectInfo->VolumeCB,
-                                                   &pObjectInfo->ParentFileId);
+                                                   &pObjectInfo->ParentFileId,
+                                                   TRUE);
         }
 
         if( DirectoryCB->ObjectInformation->Fcb == NULL)
index cbc272b..3846237 100644 (file)
@@ -2011,7 +2011,8 @@ AFSSetBasicInfo( IN PIRP Irp,
             {
 
                 AFSObjectInfoCB * pParentObjectInfo = AFSFindObjectInfo( DirectoryCB->ObjectInformation->VolumeCB,
-                                                                         &DirectoryCB->ObjectInformation->ParentFileId);
+                                                                         &DirectoryCB->ObjectInformation->ParentFileId,
+                                                                         TRUE);
 
                 if ( pParentObjectInfo != NULL)
                 {
@@ -2343,7 +2344,8 @@ AFSSetFileLinkInfo( IN PIRP Irp)
         {
 
             pSrcParentObject = AFSFindObjectInfo( pSrcFcb->ObjectInformation->VolumeCB,
-                                                  &pSrcFcb->ObjectInformation->ParentFileId);
+                                                  &pSrcFcb->ObjectInformation->ParentFileId,
+                                                  TRUE);
         }
 
         if( pSrcParentObject == NULL)
@@ -2778,7 +2780,8 @@ AFSSetRenameInfo( IN PIRP Irp)
         {
 
             pSrcParentObject = AFSFindObjectInfo( pSrcFcb->ObjectInformation->VolumeCB,
-                                                  &pSrcFcb->ObjectInformation->ParentFileId);
+                                                  &pSrcFcb->ObjectInformation->ParentFileId,
+                                                  TRUE);
         }
 
         if( pSrcParentObject == NULL)
index 2c4dc07..6417b19 100644 (file)
@@ -1705,7 +1705,8 @@ AFSInvalidateObject( IN OUT AFSObjectInfoCB **ppObjectInfo,
     {
 
         pParentObjectInfo = AFSFindObjectInfo( (*ppObjectInfo)->VolumeCB,
-                                               &(*ppObjectInfo)->ParentFileId);
+                                               &(*ppObjectInfo)->ParentFileId,
+                                               FALSE);
     }
 
     if( (*ppObjectInfo)->FileType == AFS_FILE_TYPE_SYMLINK ||
@@ -2251,7 +2252,8 @@ AFSIsChildOfParent( IN AFSFcb *Dcb,
         }
 
         pParentObjectInfo = AFSFindObjectInfo( pCurrentFcb->ObjectInformation->VolumeCB,
-                                               &pCurrentFcb->ObjectInformation->ParentFileId);
+                                               &pCurrentFcb->ObjectInformation->ParentFileId,
+                                               FALSE);
 
         if ( pParentObjectInfo != NULL)
         {
@@ -6170,7 +6172,8 @@ AFSObjectInfoDecrement( IN AFSObjectInfoCB *ObjectInfo,
 
 AFSObjectInfoCB *
 AFSFindObjectInfo( IN AFSVolumeCB *VolumeCB,
-                   IN AFSFileID   *FileId)
+                   IN AFSFileID   *FileId,
+                   IN BOOLEAN      bUpdateLastUse)
 {
     DWORD            ntStatus = STATUS_SUCCESS;
     ULONGLONG        ullIndex;
@@ -6205,6 +6208,12 @@ AFSFindObjectInfo( IN AFSVolumeCB *VolumeCB,
                       "AFSFindObjectInfo Decrement count on object %p Cnt %d\n",
                       pObjectInfo,
                       lCount));
+
+        if ( bUpdateLastUse)
+        {
+
+            KeQueryTickCount( &pObjectInfo->LastAccessCount);
+        }
     }
 
     AFSReleaseResource( VolumeCB->ObjectInfoTree.TreeLock);
@@ -6292,7 +6301,9 @@ AFSDeleteObjectInfo( IN AFSObjectInfoCB **ppObjectInfo)
         {
 
             pParentObjectInfo = AFSFindObjectInfo( pVolume,
-                                                   &pObjectInfo->ParentFileId);
+                                                   &pObjectInfo->ParentFileId,
+                                                   FALSE);
+
             if( pParentObjectInfo != NULL)
             {
 
index 94d6154..4bb0203 100644 (file)
@@ -1947,7 +1947,8 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                 {
 
                     pParentObjectInfo = AFSFindObjectInfo( pCurrentObject->VolumeCB,
-                                                           &pCurrentObject->ParentFileId);
+                                                           &pCurrentObject->ParentFileId,
+                                                           FALSE);
                 }
 
                 ASSERT( pParentObjectInfo != NULL);
index 490438d..32b2bd9 100644 (file)
@@ -1650,7 +1650,7 @@ AFSExamineVolume( IN AFSVolumeCB *pVolumeCB)
                 //
 
                 bReleaseVolumeTreeLock = AFSAcquireExcl( pVolumeCB->ObjectInfoTree.TreeLock,
-                                                         FALSE);
+                                                         TRUE);
             }
 
             pCurrentObject = pNextObject;
index 2a70bfe..6cb2d45 100644 (file)
@@ -1340,7 +1340,8 @@ AFSDeleteObjectInfo( IN AFSObjectInfoCB **ppObjectInfo);
 
 AFSObjectInfoCB *
 AFSFindObjectInfo( IN AFSVolumeCB * VolumeCB,
-                   IN AFSFileID   * FileID);
+                   IN AFSFileID   * FileID,
+                   IN BOOLEAN       bUpdateLastUse);
 
 void
 AFSReleaseObjectInfo( IN OUT AFSObjectInfoCB **ppObjectInfo);