Windows: remove unused AFSRequestExtents()
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 22 Dec 2011 02:03:52 +0000 (21:03 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 22 Dec 2011 15:09:39 +0000 (07:09 -0800)
Change-Id: I25251827ab2cfb68ba20cf97eaebb669e4f36a82
Reviewed-on: http://gerrit.openafs.org/6393
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

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

index 0738720..86d596c 100644 (file)
@@ -677,295 +677,6 @@ try_exit:
     return retVal;
 }
 
-//
-// Given an FCB and an Offset we look to see whether there extents to
-// Map them all.  If there are then we return TRUE to fullymapped
-// and *FirstExtent points to the first extent to map the extent.
-// If not then we return FALSE, but we request the extents to be mapped.
-// Further *FirstExtent (if non null) is the last extent which doesn't
-// map the extent.
-//
-// Finally on the way *in* if *FirstExtent is non null it is where we start looking
-//
-
-NTSTATUS
-AFSRequestExtents( IN AFSFcb *Fcb,
-                   IN AFSCcb *Ccb,
-                   IN PLARGE_INTEGER Offset,
-                   IN ULONG Size,
-                   OUT BOOLEAN *FullyMapped)
-{
-
-    AFSDeviceExt        *pDevExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension;
-    NTSTATUS             ntStatus = STATUS_SUCCESS;
-    AFSExtent           *pExtent;
-    AFSRequestExtentsCB  request;
-    AFSNonPagedFcb      *pNPFcb = Fcb->NPFcb;
-    AFSExtent           *pFirstExtent;
-    LARGE_INTEGER        liAlignedOffset;
-    ULONG                ulAlignedLength = 0;
-    LARGE_INTEGER        liTimeOut;
-    ULONGLONG            ullProcessId = (ULONGLONG)PsGetCurrentProcessId();
-
-    //
-    // Check our extents, then fire off a request if we need to.
-    // We start off knowing nothing about where we will go.
-    //
-    pFirstExtent = NULL;
-    pExtent = NULL;
-
-    *FullyMapped = AFSDoExtentsMapRegion( Fcb, Offset, Size, &pFirstExtent, &pExtent );
-
-    if (*FullyMapped)
-    {
-
-        ASSERT(AFSExtentContains(pFirstExtent, Offset));
-        LARGE_INTEGER end = *Offset;
-        end.QuadPart += (Size-1);
-        ASSERT(AFSExtentContains(pExtent, &end));
-
-        return STATUS_SUCCESS;
-    }
-
-    //
-    // So we need to queue a request. Since we will be clearing the
-    // ExtentsRequestComplete event we need to do with with the lock
-    // EX
-    //
-
-    liTimeOut.QuadPart = -(50000000);
-
-    while (TRUE)
-    {
-        if (!NT_SUCCESS( pNPFcb->Specific.File.ExtentsRequestStatus))
-        {
-
-            //
-            // If this isn't the same process which caused the failure
-            // then try to request them again
-            //
-
-            if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId)
-            {
-                ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus;
-
-                break;
-            }
-
-            pNPFcb->Specific.File.ExtentsRequestStatus = STATUS_SUCCESS;
-        }
-
-        ntStatus = KeWaitForSingleObject( &pNPFcb->Specific.File.ExtentsRequestComplete,
-                                          Executive,
-                                          KernelMode,
-                                          FALSE,
-                                          &liTimeOut);
-        if (!NT_SUCCESS(ntStatus))
-        {
-
-            //
-            // try again
-            //
-
-            continue;
-        }
-
-        //
-        // Lock resource EX and look again
-        //
-
-        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSRequestExtents Acquiring Fcb extent lock %08lX EXCL %08lX\n",
-                      &pNPFcb->Specific.File.ExtentsResource,
-                      PsGetCurrentThread());
-
-        AFSAcquireExcl( &pNPFcb->Specific.File.ExtentsResource, TRUE );
-
-        if (!NT_SUCCESS( pNPFcb->Specific.File.ExtentsRequestStatus))
-        {
-
-            //
-            // If this isn't the same process which caused the failure then try to request them again
-            //
-
-            if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId)
-            {
-                ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus;
-
-                AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                              AFS_TRACE_LEVEL_VERBOSE,
-                              "AFSRequestExtents Releasing Fcb extent lock %08lX EXCL %08lX\n",
-                              &pNPFcb->Specific.File.ExtentsResource,
-                              PsGetCurrentThread());
-
-                AFSReleaseResource( &pNPFcb->Specific.File.ExtentsResource );
-
-                break;
-            }
-
-            pNPFcb->Specific.File.ExtentsRequestStatus = STATUS_SUCCESS;
-        }
-
-        if( KeReadStateEvent( &pNPFcb->Specific.File.ExtentsRequestComplete) ||
-            ntStatus == STATUS_TIMEOUT)
-        {
-
-            ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus;
-
-            if( !NT_SUCCESS( ntStatus))
-            {
-
-                //
-                // If this isn't the same process which caused the failure
-                // then try to request them again
-                //
-
-                if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId)
-                {
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                                  AFS_TRACE_LEVEL_VERBOSE,
-                                  "AFSRequestExtents Releasing Fcb extent lock %08lX EXCL %08lX\n",
-                                  &pNPFcb->Specific.File.ExtentsResource,
-                                  PsGetCurrentThread());
-
-                    AFSReleaseResource( &pNPFcb->Specific.File.ExtentsResource );
-                }
-                else
-                {
-
-                    pNPFcb->Specific.File.ExtentsRequestStatus = STATUS_SUCCESS;
-
-                    ntStatus = STATUS_SUCCESS;
-                }
-            }
-
-            break;
-        }
-
-        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSRequestExtents Releasing Fcb extent lock %08lX EXCL %08lX\n",
-                      &pNPFcb->Specific.File.ExtentsResource,
-                      PsGetCurrentThread());
-
-        AFSReleaseResource( &pNPFcb->Specific.File.ExtentsResource );
-    }
-
-    if (!NT_SUCCESS(ntStatus))
-    {
-
-        return ntStatus;
-    }
-
-    __Enter
-    {
-        //
-        // We have the lock Ex and there is no filling going on.
-        // Check again to see whether things have moved since we last
-        // checked.  Since we haven't locked against pinning, we will
-        // reset here.
-        //
-
-        pFirstExtent = NULL;
-
-        *FullyMapped = AFSDoExtentsMapRegion(Fcb, Offset, Size, &pFirstExtent, &pExtent);
-
-        if (*FullyMapped)
-        {
-
-            ASSERT(AFSExtentContains(pFirstExtent, Offset));
-            LARGE_INTEGER end = *Offset;
-            end.QuadPart += (Size-1);
-            ASSERT(AFSExtentContains(pExtent, &end));
-
-            try_return (ntStatus = STATUS_SUCCESS);
-        }
-
-        RtlZeroMemory( &request,
-                       sizeof( AFSRequestExtentsCB));
-
-        //
-        // Align the request
-        //
-
-        ulAlignedLength = Size;
-
-        liAlignedOffset = *Offset;
-
-        if( liAlignedOffset.QuadPart % pDevExt->Specific.RDR.CacheBlockSize != 0)
-        {
-
-            liAlignedOffset.QuadPart = (ULONGLONG)( (ULONGLONG)(liAlignedOffset.QuadPart / pDevExt->Specific.RDR.CacheBlockSize) * (ULONGLONG)pDevExt->Specific.RDR.CacheBlockSize);
-
-            ulAlignedLength += (ULONG)(Offset->QuadPart - liAlignedOffset.QuadPart);
-        }
-
-        if( ulAlignedLength % pDevExt->Specific.RDR.CacheBlockSize != 0)
-        {
-
-            ulAlignedLength = (ULONG)(((ulAlignedLength / pDevExt->Specific.RDR.CacheBlockSize) + 1) * pDevExt->Specific.RDR.CacheBlockSize);
-        }
-
-        request.ByteOffset = liAlignedOffset;
-        request.Length = ulAlignedLength;
-
-        if( !AFSIsExtentRequestQueued( &Fcb->ObjectInformation->FileId,
-                                       &request.ByteOffset,
-                                       request.Length))
-        {
-
-            AFSDbgLogMsg( AFS_SUBSYSTEM_EXTENT_PROCESSING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSRequestExtents Request extents for fid %08lX-%08lX-%08lX-%08lX Offset %08lX Len %08lX Thread %08lX\n",
-                          Fcb->ObjectInformation->FileId.Cell,
-                          Fcb->ObjectInformation->FileId.Volume,
-                          Fcb->ObjectInformation->FileId.Vnode,
-                          Fcb->ObjectInformation->FileId.Unique,
-                          request.ByteOffset.LowPart,
-                          request.Length,
-                          PsGetCurrentThread());
-
-            ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS,
-                                          0,
-                                          &Ccb->AuthGroup,
-                                          NULL,
-                                          &Fcb->ObjectInformation->FileId,
-                                          &request,
-                                          sizeof( AFSRequestExtentsCB ),
-                                          NULL,
-                                          NULL);
-
-            if( NT_SUCCESS( ntStatus))
-            {
-                KeClearEvent( &pNPFcb->Specific.File.ExtentsRequestComplete );
-            }
-        }
-        else
-        {
-
-            KeClearEvent( &pNPFcb->Specific.File.ExtentsRequestComplete );
-        }
-
-try_exit:
-
-        if (NT_SUCCESS( ntStatus ))
-        {
-            KeQueryTickCount( &Fcb->Specific.File.LastExtentAccess );
-        }
-
-        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "AFSRequestExtents Releasing Fcb extent lock %08lX EXCL %08lX\n",
-                      &pNPFcb->Specific.File.ExtentsResource,
-                      PsGetCurrentThread());
-
-        AFSReleaseResource( &pNPFcb->Specific.File.ExtentsResource );
-    }
-
-    return ntStatus;
-}
-
 NTSTATUS
 AFSRequestExtentsAsync( IN AFSFcb *Fcb,
                         IN AFSCcb *Ccb,