Windows: AFSRedir code cleanup
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 26 May 2012 22:09:30 +0000 (18:09 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 6 Jun 2012 15:04:50 +0000 (08:04 -0700)
Remove unnecessary intermediate variables.

Do not drop lock only to reacquire.

Formatting.

Change-Id: I7396047f30ee81755927b90a7b3f990d481d8d3e
Reviewed-on: http://gerrit.openafs.org/7519
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp

index 342c338..fc6af33 100644 (file)
@@ -85,6 +85,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
         }
 
         pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension;
+
         pControlDeviceExt = (AFSDeviceExt *)AFSControlDeviceObject->DeviceExtension;
 
         //
@@ -384,23 +385,15 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
                                   &pFcb->NPFcb->Specific.File.ExtentsResource,
                                   PsGetCurrentThread());
 
-                    AFSAcquireExcl( &pObjectInfo->Fcb->NPFcb->Specific.File.ExtentsResource,
+                    AFSAcquireExcl( &pFcb->NPFcb->Specific.File.ExtentsResource,
                                     TRUE);
 
-                    pObjectInfo->Fcb->NPFcb->Specific.File.ExtentsRequestStatus = STATUS_FILE_DELETED;
+                    pFcb->NPFcb->Specific.File.ExtentsRequestStatus = STATUS_FILE_DELETED;
 
-                    KeSetEvent( &pObjectInfo->Fcb->NPFcb->Specific.File.ExtentsRequestComplete,
+                    KeSetEvent( &pFcb->NPFcb->Specific.File.ExtentsRequestComplete,
                                 0,
                                 FALSE);
 
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                                  AFS_TRACE_LEVEL_VERBOSE,
-                                  "AFSCleanup Releasing Fcb extents lock %08lX EXCL %08lX\n",
-                                  &pFcb->NPFcb->Specific.File.ExtentsResource,
-                                  PsGetCurrentThread());
-
-                    AFSReleaseResource( &pObjectInfo->Fcb->NPFcb->Specific.File.ExtentsResource);
-
                     //
                     // Before telling the server about the deleted file, tear down all extents for
                     // the file
@@ -409,6 +402,14 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
                     AFSTearDownFcbExtents( pFcb,
                                            &pCcb->AuthGroup);
 
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSCleanup Releasing Fcb extents lock %08lX EXCL %08lX\n",
+                                  &pFcb->NPFcb->Specific.File.ExtentsResource,
+                                  PsGetCurrentThread());
+
+                    AFSReleaseResource( &pFcb->NPFcb->Specific.File.ExtentsResource);
+
                     ntStatus = STATUS_SUCCESS;
 
                     ulNotificationFlags |= AFS_REQUEST_FLAG_FILE_DELETED;
index 342f066..b90915b 100644 (file)
@@ -55,16 +55,14 @@ AFSEntryForOffset( IN AFSFcb *Fcb,
 VOID
 AFSLockForExtentsTrim( IN AFSFcb *Fcb)
 {
-    NTSTATUS          ntStatus;
-    AFSNonPagedFcb *pNPFcb = Fcb->NPFcb;
 
     AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
                   AFS_TRACE_LEVEL_VERBOSE,
                   "AFSLockForExtentsTrim Acquiring Fcb extents lock %08lX EXCL %08lX\n",
-                  &pNPFcb->Specific.File.ExtentsResource,
+                  &Fcb->NPFcb->Specific.File.ExtentsResource,
                   PsGetCurrentThread());
 
-    AFSAcquireExcl( &pNPFcb->Specific.File.ExtentsResource, TRUE );
+    AFSAcquireExcl( &Fcb->NPFcb->Specific.File.ExtentsResource, TRUE );
 
     return;
 }
@@ -75,15 +73,14 @@ AFSLockForExtentsTrim( IN AFSFcb *Fcb)
 BOOLEAN
 AFSLockForExtentsTrimNoWait( IN AFSFcb *Fcb)
 {
-    AFSNonPagedFcb *pNPFcb = Fcb->NPFcb;
 
     AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
                   AFS_TRACE_LEVEL_VERBOSE,
                   "AFSLockForExtentsTrimNoWait Attempting to acquire Fcb extent lock %08lX EXCL %08lX\n",
-                  &pNPFcb->Specific.File.ExtentsResource,
+                  &Fcb->NPFcb->Specific.File.ExtentsResource,
                   PsGetCurrentThread());
 
-    if (!AFSAcquireExcl( &pNPFcb->Specific.File.ExtentsResource, FALSE ))
+    if (!AFSAcquireExcl( &Fcb->NPFcb->Specific.File.ExtentsResource, FALSE ))
     {
         //
         // Couldn't lock immediately
@@ -92,7 +89,7 @@ AFSLockForExtentsTrimNoWait( IN AFSFcb *Fcb)
         AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
                       AFS_TRACE_LEVEL_VERBOSE,
                       "AFSLockForExtentsTrimNoWait Refused to wait for Fcb extent lock %08lX EXCL %08lX\n",
-                      &pNPFcb->Specific.File.ExtentsResource,
+                      &Fcb->NPFcb->Specific.File.ExtentsResource,
                       PsGetCurrentThread());
 
         return FALSE;