]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Adjust extent release strategy
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 26 May 2012 22:11:06 +0000 (18:11 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 6 Jun 2012 15:06:44 +0000 (08:06 -0700)
All extents were flushed whenever AFSReleaseExtentsWithFlush was
executed.  This included a call at the completion of each
NonCached Read operation which could result in heavy thrashing
as the data would be released prior to it being needed by the
application.

This patchset makes the following adjustments.  First,
AFSReleaseExtentsWithFlush() has been modified to release all
but 1024 extents belonging to the file.  Second, NonCached Reads
only execute AFSReleaseExtentsWithFlush() when there are more
than 4096 extents associated with the file.  Third,
AFSReleaseExtentsWithFlush() now has a 'bReleaseAll' parameter
which is used for calls from AFSCleanup() and AFSFlushExtents()
which need to be able to flush all extents attached to a FCB.

Change-Id: Id8b05f02c59eb46b1881e4d905a511a2597455e8
Reviewed-on: http://gerrit.openafs.org/7520
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
src/WINNT/afsrdr/kernel/lib/AFSFlushBuffers.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSRead.cpp
src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSCommon.h

index fc6af333383ba163e083f07638f9be569c181674..28d4ffc424ae2b33f01b859df05af397307e78cd 100644 (file)
@@ -557,6 +557,9 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
                         AFSWaitOnQueuedFlushes( pFcb);
 
                         ulNotificationFlags |= AFS_REQUEST_FLAG_FLUSH_FILE;
+
+                        AFSTearDownFcbExtents( pFcb,
+                                               &pCcb->AuthGroup);
                     }
 
                     //
index b90915b22bcc200420b415a8d4e28fa14dcf8775..6d503d4fca067b079d8d0a9cdd97abc4c440123d 100644 (file)
@@ -2885,7 +2885,8 @@ try_exit:
 
 NTSTATUS
 AFSReleaseExtentsWithFlush( IN AFSFcb *Fcb,
-                            IN GUID *AuthGroup)
+                            IN GUID *AuthGroup,
+                            IN BOOLEAN bReleaseAll)
 {
     AFSNonPagedFcb      *pNPFcb = Fcb->NPFcb;
     AFSExtent           *pExtent;
@@ -2956,18 +2957,15 @@ AFSReleaseExtentsWithFlush( IN AFSFcb *Fcb,
             try_return ( ntStatus = STATUS_INSUFFICIENT_RESOURCES );
         }
 
-        if( Fcb->OpenHandleCount > 0)
+        if( Fcb->OpenHandleCount > 0 &&
+            !bReleaseAll)
         {
 
             //
             // Don't release everything ...
             //
 
-            //
-            // For now release everything
-            //
-
-            //ulRemainingExtentLength = 1500;
+            ulRemainingExtentLength = 1024;
         }
 
         while( Fcb->Specific.File.ExtentLength > (LONG)ulRemainingExtentLength)
index d868a4999dcee7ab5e9d9016946d4ea114763994..eedfd9a2255041ae892ed79ba5c918e6b370b10a 100644 (file)
@@ -126,7 +126,8 @@ AFSFlushBuffers( IN PDEVICE_OBJECT LibDeviceObject,
         {
 
             AFSReleaseExtentsWithFlush( pFcb,
-                                        &pCcb->AuthGroup);
+                                        &pCcb->AuthGroup,
+                                        TRUE);
 
             ntStatus = STATUS_SUCCESS;
         }
index a8804f668b16410f3d890e944c5414a937ae9b3d..ac81d7c3cd2fb31da397d28d8b0b5c4935d71f2a 100644 (file)
@@ -7028,7 +7028,8 @@ AFSCleanupFcb( IN AFSFcb *Fcb,
                 {
 
                     AFSReleaseExtentsWithFlush( Fcb,
-                                                NULL);
+                                                NULL,
+                                                TRUE);
                 }
             }
 
@@ -7073,7 +7074,8 @@ AFSCleanupFcb( IN AFSFcb *Fcb,
             {
 
                 AFSReleaseExtentsWithFlush( Fcb,
-                                            NULL);
+                                            NULL,
+                                            TRUE);
             }
         }
 
index 1e8dbb97fbe1da9dc7bd7d51fa317bb69c962101..775c9aa57718fa5bd6400ba50513ef1006123c6c 100644 (file)
@@ -691,8 +691,14 @@ AFSNonCachedRead( IN PDEVICE_OBJECT DeviceObject,
         // The data is there now.  Give back the extents now so the service
         // has some in hand
         //
-        (VOID) AFSReleaseExtentsWithFlush( pFcb,
-                                           &pCcb->AuthGroup);
+
+        if ( pFcb->Specific.File.ExtentLength > 4096)
+        {
+
+            (VOID) AFSReleaseExtentsWithFlush( pFcb,
+                                               &pCcb->AuthGroup,
+                                               FALSE);
+        }
 
 try_exit:
 
index 2af9c67d40a87cd9902d4029d67aa11aceef406e..9239c40e87945b74e184c91beb97cde1bc5abe34 100644 (file)
@@ -739,7 +739,8 @@ AFSWorkerThread( IN PVOID Context)
                         {
 
                             AFSReleaseExtentsWithFlush( pWorkItem->Specific.Fcb.Fcb,
-                                                        &pWorkItem->AuthGroup);
+                                                        &pWorkItem->AuthGroup,
+                                                        FALSE);
                         }
 
                         ASSERT( pWorkItem->Specific.Fcb.Fcb->OpenReferenceCount != 0);
index 0b666696e30d56e66f54f06f25bb9d2928afa0f9..ffe175434b302ec18307a1fff96d5f1ac747e647 100644 (file)
@@ -395,7 +395,8 @@ AFSFlushExtents( IN AFSFcb *pFcb,
 
 NTSTATUS
 AFSReleaseExtentsWithFlush( IN AFSFcb *Fcb,
-                            IN GUID *AuthGroup);
+                            IN GUID *AuthGroup,
+                            IN BOOLEAN bReleaseAll);
 
 NTSTATUS
 AFSReleaseCleanExtents( IN AFSFcb *Fcb,