Windows: Adjust extent release strategy

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>
This commit is contained in:
Jeffrey Altman 2012-05-26 18:11:06 -04:00 committed by Jeffrey Altman
parent 5335f77bd5
commit cee6a383d3
7 changed files with 26 additions and 14 deletions

View File

@ -557,6 +557,9 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
AFSWaitOnQueuedFlushes( pFcb);
ulNotificationFlags |= AFS_REQUEST_FLAG_FLUSH_FILE;
AFSTearDownFcbExtents( pFcb,
&pCcb->AuthGroup);
}
//

View 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)

View File

@ -126,7 +126,8 @@ AFSFlushBuffers( IN PDEVICE_OBJECT LibDeviceObject,
{
AFSReleaseExtentsWithFlush( pFcb,
&pCcb->AuthGroup);
&pCcb->AuthGroup,
TRUE);
ntStatus = STATUS_SUCCESS;
}

View 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);
}
}

View 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:

View 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);

View 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,