Windows: Avoid unnecessary Ccb->DirectoryCB->ObjectInformation
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 4 Apr 2013 14:47:38 +0000 (10:47 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 6 Apr 2013 02:28:54 +0000 (19:28 -0700)
In almost all cases where an AFSCcb is present the associated AFSFcb
is also present.  The AFSFcb has a direct pointer to the AFSObjectInfoCB.
This patchset replaces the Ccb->DirectoryCB->ObjectInformation references
with Fcb->ObjectInformation.  This avoids one level of pointer indirection
and will make it easier to remove the DirectoryCB ObjectInformation
pointer in the future.

Change-Id: I2a6f5d2ed8ef1ad85691f07f425f99e3fb6cce31
Reviewed-on: http://gerrit.openafs.org/9724
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSFSControl.cpp
src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index f995291..16012f7 100644 (file)
@@ -330,14 +330,14 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                               AFS_TRACE_LEVEL_VERBOSE_2,
                               "AFSProcessUserFsRequest Processing FSCTL_GET_REPARSE_POINT request %wZ Type 0x%x Attrib 0x%x\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileType,
-                              pCcb->DirectoryCB->ObjectInformation->FileAttributes));
+                              pFcb->ObjectInformation->FileType,
+                              pFcb->ObjectInformation->FileAttributes));
 
                 //
                 // Check if we have the reparse entry set on the entry
                 //
 
-                if( !BooleanFlagOn( pCcb->DirectoryCB->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
+                if( !BooleanFlagOn( pFcb->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
                 {
 
                     ntStatus = STATUS_NOT_A_REPARSE_POINT;
@@ -346,7 +346,7 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                 }
 
 
-                switch ( pCcb->DirectoryCB->ObjectInformation->FileType) {
+                switch ( pFcb->ObjectInformation->FileType) {
                 case AFS_FILE_TYPE_MOUNTPOINT:
 
                     if( ulOutputBufferLen < FIELD_OFFSET( REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer.DataBuffer))
@@ -396,18 +396,18 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                     // We'll reset the DV to ensure we validate the metadata content
                     //
 
-                    pCcb->DirectoryCB->ObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1;
+                    pFcb->ObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1;
 
-                    SetFlag( pCcb->DirectoryCB->ObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY);
+                    SetFlag( pFcb->ObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY);
 
                     AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING,
                                   AFS_TRACE_LEVEL_VERBOSE,
                                   "AFSProcessUserFsRequest Verifying symlink %wZ FID %08lX-%08lX-%08lX-%08lX\n",
                                   &pCcb->DirectoryCB->NameInformation.FileName,
-                                  pCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                                  pCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                                  pCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                                  pCcb->DirectoryCB->ObjectInformation->FileId.Unique));
+                                  pFcb->ObjectInformation->FileId.Cell,
+                                  pFcb->ObjectInformation->FileId.Volume,
+                                  pFcb->ObjectInformation->FileId.Vnode,
+                                  pFcb->ObjectInformation->FileId.Unique));
 
                     ntStatus = AFSVerifyEntry( &pCcb->AuthGroup,
                                                pCcb->DirectoryCB);
@@ -419,10 +419,10 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                                       AFS_TRACE_LEVEL_ERROR,
                                       "AFSProcessUserFsRequest Failed to verify symlink %wZ FID %08lX-%08lX-%08lX-%08lX Status %08lX\n",
                                       &pCcb->DirectoryCB->NameInformation.FileName,
-                                      pCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                                      pCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                                      pCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                                      pCcb->DirectoryCB->ObjectInformation->FileId.Unique,
+                                      pFcb->ObjectInformation->FileId.Cell,
+                                      pFcb->ObjectInformation->FileId.Volume,
+                                      pFcb->ObjectInformation->FileId.Vnode,
+                                      pFcb->ObjectInformation->FileId.Unique,
                                       ntStatus));
 
                         AFSReleaseResource( &pCcb->DirectoryCB->NonPaged->Lock);
@@ -433,7 +433,7 @@ AFSProcessUserFsRequest( IN PIRP Irp)
 
                 pReparseInfo = (AFSReparseTagInfo *)&pReparseBuffer->GenericReparseBuffer.DataBuffer[ 0];
 
-                switch( pCcb->DirectoryCB->ObjectInformation->FileType)
+                switch( pFcb->ObjectInformation->FileType)
                 {
 
                     case AFS_FILE_TYPE_SYMLINK:
@@ -791,7 +791,7 @@ AFSProcessUserFsRequest( IN PIRP Irp)
 
                     ulRemainingLen -= pReparseBuffer->ReparseDataLength;
 
-                    if ( pCcb->DirectoryCB->ObjectInformation->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+                    if ( pFcb->ObjectInformation->FileType == AFS_FILE_TYPE_MOUNTPOINT)
                     {
 
                         pReparseBuffer->ReparseTag = IO_REPARSE_TAG_SURROGATE|IO_REPARSE_TAG_OPENAFS_DFS;
@@ -833,8 +833,8 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                               AFS_TRACE_LEVEL_VERBOSE,
                               "AFSProcessUserFsRequest Processing FSCTL_SET_REPARSE_POINT request %wZ Type 0x%x Attrib 0x%x\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileType,
-                              pCcb->DirectoryCB->ObjectInformation->FileAttributes));
+                              pFcb->ObjectInformation->FileType,
+                              pFcb->ObjectInformation->FileAttributes));
 
                 if( ulInputBufferLen < FIELD_OFFSET( REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer.DataBuffer))
                 {
@@ -995,19 +995,19 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                 // for this entry
                 //
 
-                AFSAcquireExcl( pCcb->DirectoryCB->ObjectInformation->VolumeCB->ObjectInfoTree.TreeLock,
+                AFSAcquireExcl( pFcb->ObjectInformation->VolumeCB->ObjectInfoTree.TreeLock,
                                 TRUE);
 
-                if ( AFSIsVolumeFID( &pCcb->DirectoryCB->ObjectInformation->ParentFileId))
+                if ( AFSIsVolumeFID( &pFcb->ObjectInformation->ParentFileId))
                 {
 
-                    pParentObjectInfo = &pCcb->DirectoryCB->ObjectInformation->VolumeCB->ObjectInformation;
+                    pParentObjectInfo = &pFcb->ObjectInformation->VolumeCB->ObjectInformation;
                 }
                 else
                 {
-                    ullIndex = AFSCreateLowIndex( &pCcb->DirectoryCB->ObjectInformation->ParentFileId);
+                    ullIndex = AFSCreateLowIndex( &pFcb->ObjectInformation->ParentFileId);
 
-                    ntStatus = AFSLocateHashEntry( pCcb->DirectoryCB->ObjectInformation->VolumeCB->ObjectInfoTree.TreeHead,
+                    ntStatus = AFSLocateHashEntry( pFcb->ObjectInformation->VolumeCB->ObjectInfoTree.TreeHead,
                                                    ullIndex,
                                                    (AFSBTreeEntry **)&pParentObjectInfo);
                 }
@@ -1025,7 +1025,7 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                                   lCount));
                 }
 
-                AFSReleaseResource( pCcb->DirectoryCB->ObjectInformation->VolumeCB->ObjectInfoTree.TreeLock);
+                AFSReleaseResource( pFcb->ObjectInformation->VolumeCB->ObjectInfoTree.TreeLock);
 
                 if ( NT_SUCCESS( ntStatus))
                 {
@@ -1037,15 +1037,15 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                     ntStatus = AFSCreateSymlink( &pCcb->AuthGroup,
                                                  pParentObjectInfo,
                                                  &pCcb->DirectoryCB->NameInformation.FileName,
-                                                 pCcb->DirectoryCB->ObjectInformation,
+                                                 pFcb->ObjectInformation,
                                                  &uniTargetName);
 
                     AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING,
                                   AFS_TRACE_LEVEL_VERBOSE_2,
                                   "AFSProcessUserFsRequest Processed FSCTL_SET_REPARSE_POINT request %wZ Type 0x%x Attrib 0x%x Status %08lX\n",
                                   &pCcb->DirectoryCB->NameInformation.FileName,
-                                  pCcb->DirectoryCB->ObjectInformation->FileType,
-                                  pCcb->DirectoryCB->ObjectInformation->FileAttributes,
+                                  pFcb->ObjectInformation->FileType,
+                                  pFcb->ObjectInformation->FileAttributes,
                                   ntStatus));
 
                     lCount = AFSObjectInfoDecrement( pParentObjectInfo,
@@ -1070,14 +1070,14 @@ AFSProcessUserFsRequest( IN PIRP Irp)
                               AFS_TRACE_LEVEL_VERBOSE_2,
                               "AFSProcessUserFsRequest Processing FSCTL_DELETE_REPARSE_POINT request %wZ Type 0x%x Attrib 0x%x\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileType,
-                              pCcb->DirectoryCB->ObjectInformation->FileAttributes));
+                              pFcb->ObjectInformation->FileType,
+                              pFcb->ObjectInformation->FileAttributes));
 
                 //
                 // Check if we have the reparse entry set on the entry
                 //
 
-                if( !BooleanFlagOn( pCcb->DirectoryCB->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
+                if( !BooleanFlagOn( pFcb->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
                 {
 
                     ntStatus = STATUS_NOT_A_REPARSE_POINT;
index aae6d8c..b7ffcaf 100644 (file)
@@ -458,10 +458,10 @@ try_exit:
                               AFS_TRACE_LEVEL_ERROR,
                               "AFSQueryFileInfo Failed to process request for %wZ FID %08lX-%08lX-%08lX-%08lX Status %08lX\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Unique,
+                              pFcb->ObjectInformation->FileId.Cell,
+                              pFcb->ObjectInformation->FileId.Volume,
+                              pFcb->ObjectInformation->FileId.Vnode,
+                              pFcb->ObjectInformation->FileId.Unique,
                               ntStatus));
             }
         }
@@ -737,10 +737,10 @@ try_exit:
                               AFS_TRACE_LEVEL_ERROR,
                               "AFSSetFileInfo Failed to send file info update to service request for %wZ FID %08lX-%08lX-%08lX-%08lX Status %08lX\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Unique,
+                              pFcb->ObjectInformation->FileId.Cell,
+                              pFcb->ObjectInformation->FileId.Volume,
+                              pFcb->ObjectInformation->FileId.Vnode,
+                              pFcb->ObjectInformation->FileId.Unique,
                               ntStatus));
 
                 AFSReleaseResource( &pFcb->NPFcb->Resource);
@@ -758,10 +758,10 @@ try_exit:
                               AFS_TRACE_LEVEL_ERROR,
                               "AFSSetFileInfo Failed to process request for %wZ FID %08lX-%08lX-%08lX-%08lX Status %08lX\n",
                               &pCcb->DirectoryCB->NameInformation.FileName,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                              pCcb->DirectoryCB->ObjectInformation->FileId.Unique,
+                              pFcb->ObjectInformation->FileId.Cell,
+                              pFcb->ObjectInformation->FileId.Volume,
+                              pFcb->ObjectInformation->FileId.Vnode,
+                              pFcb->ObjectInformation->FileId.Unique,
                               ntStatus));
             }
         }
@@ -886,8 +886,8 @@ AFSQueryBasicInfo( IN PIRP Irp,
                       AFS_TRACE_LEVEL_VERBOSE_2,
                       "AFSQueryBasicInfo %wZ Type 0x%x Attrib 0x%x -> 0x%x\n",
                       &pCcb->DirectoryCB->NameInformation.FileName,
-                      pCcb->DirectoryCB->ObjectInformation->FileType,
-                      pCcb->DirectoryCB->ObjectInformation->FileAttributes,
+                      pFcb->ObjectInformation->FileType,
+                      pFcb->ObjectInformation->FileAttributes,
                       ulFileAttribs));
 
         Buffer->CreationTime = DirectoryCB->ObjectInformation->CreationTime;
@@ -1011,8 +1011,8 @@ AFSQueryStandardInfo( IN PIRP Irp,
                       AFS_TRACE_LEVEL_VERBOSE_2,
                       "AFSQueryStandardInfo %wZ Type 0x%x Attrib 0x%x -> 0x%x\n",
                       &pCcb->DirectoryCB->NameInformation.FileName,
-                      pCcb->DirectoryCB->ObjectInformation->FileType,
-                      pCcb->DirectoryCB->ObjectInformation->FileAttributes,
+                      pFcb->ObjectInformation->FileType,
+                      pFcb->ObjectInformation->FileAttributes,
                       ulFileAttribs));
 
         Buffer->Directory = BooleanFlagOn( ulFileAttribs, FILE_ATTRIBUTE_DIRECTORY);
@@ -1527,8 +1527,8 @@ AFSQueryNetworkInfo( IN PIRP Irp,
                       AFS_TRACE_LEVEL_VERBOSE_2,
                       "AFSQueryNetworkInfo %wZ Type 0x%x Attrib 0x%x -> 0x%x\n",
                       &pCcb->DirectoryCB->NameInformation.FileName,
-                      pCcb->DirectoryCB->ObjectInformation->FileType,
-                      pCcb->DirectoryCB->ObjectInformation->FileAttributes,
+                      pFcb->ObjectInformation->FileType,
+                      pFcb->ObjectInformation->FileAttributes,
                       ulFileAttribs));
 
         Buffer->CreationTime.QuadPart = DirectoryCB->ObjectInformation->CreationTime.QuadPart;
@@ -1722,8 +1722,8 @@ AFSQueryAttribTagInfo( IN PIRP Irp,
                       AFS_TRACE_LEVEL_VERBOSE_2,
                       "AFSAttribTagInfo %wZ Type 0x%x Attrib 0x%x -> 0x%x\n",
                       &pCcb->DirectoryCB->NameInformation.FileName,
-                      pCcb->DirectoryCB->ObjectInformation->FileType,
-                      pCcb->DirectoryCB->ObjectInformation->FileAttributes,
+                      pFcb->ObjectInformation->FileType,
+                      pFcb->ObjectInformation->FileAttributes,
                       ulFileAttribs));
 
         Buffer->FileAttributes = ulFileAttribs;
@@ -3057,7 +3057,7 @@ AFSSetRenameInfo( IN PIRP Irp)
             ulNotificationAction = FILE_ACTION_REMOVED;
         }
 
-        if( pSrcCcb->DirectoryCB->ObjectInformation->FileType == AFS_FILE_TYPE_DIRECTORY)
+        if( pSrcFcb->ObjectInformation->FileType == AFS_FILE_TYPE_DIRECTORY)
         {
 
             ulNotifyFilter = FILE_NOTIFY_CHANGE_DIR_NAME;
@@ -3240,9 +3240,9 @@ AFSSetRenameInfo( IN PIRP Irp)
                           pSrcParentObject,
                           lCount));
 
-            pSrcCcb->DirectoryCB->ObjectInformation->ParentFileId = pTargetParentObject->FileId;
+            pSrcFcb->ObjectInformation->ParentFileId = pTargetParentObject->FileId;
 
-            SetFlag( pSrcCcb->DirectoryCB->ObjectInformation->Flags, AFS_OBJECT_FLAGS_PARENT_FID);
+            SetFlag( pSrcFcb->ObjectInformation->Flags, AFS_OBJECT_FLAGS_PARENT_FID);
 
             pSrcParentObject = pTargetParentObject;
 
index 42ac41b..91991bc 100644 (file)
@@ -7519,27 +7519,27 @@ AFSUnwindFileInfo( IN AFSFcb *Fcb,
     UNREFERENCED_PARAMETER(Fcb);
     if( Ccb->FileUnwindInfo.FileAttributes != (ULONG)-1)
     {
-        Ccb->DirectoryCB->ObjectInformation->FileAttributes = Ccb->FileUnwindInfo.FileAttributes;
+        Fcb->ObjectInformation->FileAttributes = Ccb->FileUnwindInfo.FileAttributes;
     }
 
     if( Ccb->FileUnwindInfo.CreationTime.QuadPart != (ULONGLONG)-1)
     {
-        Ccb->DirectoryCB->ObjectInformation->CreationTime.QuadPart = Ccb->FileUnwindInfo.CreationTime.QuadPart;
+        Fcb->ObjectInformation->CreationTime.QuadPart = Ccb->FileUnwindInfo.CreationTime.QuadPart;
     }
 
     if( Ccb->FileUnwindInfo.LastAccessTime.QuadPart != (ULONGLONG)-1)
     {
-        Ccb->DirectoryCB->ObjectInformation->LastAccessTime.QuadPart = Ccb->FileUnwindInfo.LastAccessTime.QuadPart;
+        Fcb->ObjectInformation->LastAccessTime.QuadPart = Ccb->FileUnwindInfo.LastAccessTime.QuadPart;
     }
 
     if( Ccb->FileUnwindInfo.LastWriteTime.QuadPart != (ULONGLONG)-1)
     {
-        Ccb->DirectoryCB->ObjectInformation->LastWriteTime.QuadPart = Ccb->FileUnwindInfo.LastWriteTime.QuadPart;
+        Fcb->ObjectInformation->LastWriteTime.QuadPart = Ccb->FileUnwindInfo.LastWriteTime.QuadPart;
     }
 
     if( Ccb->FileUnwindInfo.ChangeTime.QuadPart != (ULONGLONG)-1)
     {
-        Ccb->DirectoryCB->ObjectInformation->ChangeTime.QuadPart = Ccb->FileUnwindInfo.ChangeTime.QuadPart;
+        Fcb->ObjectInformation->ChangeTime.QuadPart = Ccb->FileUnwindInfo.ChangeTime.QuadPart;
     }
 
     return;
index 64f2760..94d6154 100644 (file)
@@ -3107,10 +3107,10 @@ AFSParseName( IN PIRP Irp,
                           "AFSParseName (%p) Relative open for %wZ FID %08lX-%08lX-%08lX-%08lX component %wZ\n",
                           Irp,
                           &pRelatedCcb->DirectoryCB->NameInformation.FileName,
-                          pRelatedCcb->DirectoryCB->ObjectInformation->FileId.Cell,
-                          pRelatedCcb->DirectoryCB->ObjectInformation->FileId.Volume,
-                          pRelatedCcb->DirectoryCB->ObjectInformation->FileId.Vnode,
-                          pRelatedCcb->DirectoryCB->ObjectInformation->FileId.Unique,
+                          pRelatedFcb->ObjectInformation->FileId.Cell,
+                          pRelatedFcb->ObjectInformation->FileId.Volume,
+                          pRelatedFcb->ObjectInformation->FileId.Vnode,
+                          pRelatedFcb->ObjectInformation->FileId.Unique,
                           &uniFullName));
 
             if( FsRtlDoesNameContainWildCards( &uniFullName))