Windows: shuffle trace messages for clarity
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 3 Dec 2012 15:01:24 +0000 (10:01 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Mon, 3 Dec 2012 22:08:00 +0000 (14:08 -0800)
Some of the trace messages for VolumeReferenceLocks and
VolumeReferenceCounts were in odd places.  Move them for consistency and
clarity.

Change-Id: I3cf95de0670af8855b622f8a83d2f0b69dc851df
Reviewed-on: http://gerrit.openafs.org/8581
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/AFSExtentsSupport.cpp

index 078200e..a5c8a73 100644 (file)
@@ -1429,12 +1429,6 @@ AFSProcessSetFileExtents( IN AFSSetFileExtentsCB *SetExtents )
         if( pVolumeCB != NULL)
         {
 
-            AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSProcessSetFileExtents Acquiring VolumeRoot FileIDTree.TreeLock lock %08lX SHARED %08lX\n",
-                          pVolumeCB->ObjectInfoTree.TreeLock,
-                          PsGetCurrentThread());
-
             lCount = InterlockedIncrement( &pVolumeCB->VolumeReferenceCount);
 
             AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
@@ -1465,14 +1459,6 @@ AFSProcessSetFileExtents( IN AFSSetFileExtentsCB *SetExtents )
         AFSAcquireShared( pVolumeCB->ObjectInfoTree.TreeLock,
                           TRUE);
 
-        lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
-
-        AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSProcessSetFileExtents Decrement count on volume %08lX Cnt %d\n",
-                      pVolumeCB,
-                      lCount);
-
         //
         // Now locate the Object in this volume
         //
@@ -1579,6 +1565,18 @@ try_exit:
                           pObjectInfo,
                           lCount);
         }
+
+        if ( pVolumeCB)
+        {
+
+            lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSProcessSetFileExtents Decrement count on volume %08lX Cnt %d\n",
+                          pVolumeCB,
+                          lCount);
+        }
     }
 
     return ntStatus;
@@ -1843,12 +1841,6 @@ AFSFindFcbToClean(ULONG IgnoreTime, AFSFcb *LastFcb, BOOLEAN Block)
         // The Volume list may move under our feet.  Lock it.
         //
 
-        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSFindFcbToClean Acquiring VolumeRoot ObjectInfoTree lock %08lX SHARED %08lX\n",
-                      pVolumeCB->ObjectInfoTree.TreeLock,
-                      PsGetCurrentThread());
-
         lCount = InterlockedIncrement( &pVolumeCB->VolumeReferenceCount);
 
         AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
@@ -1861,6 +1853,12 @@ AFSFindFcbToClean(ULONG IgnoreTime, AFSFcb *LastFcb, BOOLEAN Block)
 
         bReleaseVolumeListLock = FALSE;
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSFindFcbToClean Acquiring VolumeRoot ObjectInfoTree lock %08lX SHARED %08lX\n",
+                      pVolumeCB->ObjectInfoTree.TreeLock,
+                      PsGetCurrentThread());
+
         AFSAcquireShared( pVolumeCB->ObjectInfoTree.TreeLock,
                           TRUE);
 
@@ -2080,12 +2078,6 @@ AFSProcessExtentFailure( PIRP Irp)
         if( pVolumeCB != NULL)
         {
 
-            AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSProcessExtentFailure Acquiring VolumeRoot FileIDTree.TreeLock lock %08lX SHARED %08lX\n",
-                          pVolumeCB->ObjectInfoTree.TreeLock,
-                          PsGetCurrentThread());
-
             lCount = InterlockedIncrement( &pVolumeCB->VolumeReferenceCount);
 
             AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
@@ -2109,16 +2101,15 @@ AFSProcessExtentFailure( PIRP Irp)
             try_return( ntStatus = STATUS_UNSUCCESSFUL);
         }
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSProcessExtentFailure Acquiring VolumeRoot FileIDTree.TreeLock lock %08lX SHARED %08lX\n",
+                      pVolumeCB->ObjectInfoTree.TreeLock,
+                      PsGetCurrentThread());
+
         AFSAcquireShared( pVolumeCB->ObjectInfoTree.TreeLock,
                           TRUE);
 
-        lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
-
-        AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSProcessExtentFailure Decrement count on volume %08lX Cnt %d\n",
-                      pVolumeCB,
-                      lCount);
         //
         // Now locate the Object in this volume
         //
@@ -2208,7 +2199,17 @@ AFSProcessExtentFailure( PIRP Irp)
 
 try_exit:
 
-        NOTHING;
+        if ( pVolumeCB)
+        {
+
+            lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSProcessExtentFailure Decrement count on volume %08lX Cnt %d\n",
+                          pVolumeCB,
+                          lCount);
+        }
     }
 
     return ntStatus;
@@ -2330,12 +2331,6 @@ AFSProcessReleaseFileExtents( IN PIRP Irp)
             if( pVolumeCB != NULL)
             {
 
-                AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                              AFS_TRACE_LEVEL_VERBOSE,
-                              "AFSProcessReleaseFileExtents Acquiring VolumeRoot FileIDTree.TreeLock lock %08lX SHARED %08lX\n",
-                              pVolumeCB->ObjectInfoTree.TreeLock,
-                              PsGetCurrentThread());
-
                 lCount = InterlockedIncrement( &pVolumeCB->VolumeReferenceCount);
 
                 AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
@@ -2359,17 +2354,15 @@ AFSProcessReleaseFileExtents( IN PIRP Irp)
                 try_return( ntStatus = STATUS_UNSUCCESSFUL);
             }
 
+            AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSProcessReleaseFileExtents Acquiring VolumeRoot FileIDTree.TreeLock lock %08lX SHARED %08lX\n",
+                          pVolumeCB->ObjectInfoTree.TreeLock,
+                          PsGetCurrentThread());
+
             AFSAcquireShared( pVolumeCB->ObjectInfoTree.TreeLock,
                               TRUE);
 
-            lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
-
-            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSProcessReleaseFileExtents Decrement count on volume %08lX Cnt %d\n",
-                          pVolumeCB,
-                          lCount);
-
             //
             // Now locate the Object in this volume
             //
@@ -2620,6 +2613,19 @@ try_exit:
                           pObjectInfo,
                           lCount);
         }
+
+        if ( pVolumeCB)
+        {
+
+            lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSProcessReleaseFileExtents Decrement count on volume %08lX Cnt %d\n",
+                          pVolumeCB,
+                          lCount);
+
+        }
     }
 
     return ntStatus;