From: Rod Widdowson Date: Fri, 15 Feb 2013 11:48:08 +0000 (-0500) Subject: Windows: AFSWriteCommon collapse redundant condition X-Git-Tag: upstream/1.8.0_pre1^2~1492 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=6c1d28958db1c0ec50b41274dffa9c58e448a9db;p=packages%2Fo%2Fopenafs.git Windows: AFSWriteCommon collapse redundant condition We never get non cached and yet paging IO. Even if we did it would be inappropriate to call CcCanIWrite. Therefore, collapse two if statements into one. Change-Id: I95c9030836e4f7dc4f7867a8b8b09b97bf57b429 Reviewed-on: http://gerrit.openafs.org/9125 Reviewed-by: Rod Widdowson Tested-by: BuildBot Reviewed-by: Peter Scott Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp index a868630dd..39fe47986 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp @@ -335,74 +335,70 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, bNonCachedIo = FALSE; } - if ( !bNonCachedIo) { + if ( !bNonCachedIo && !bPagingIo) + { - if( !bPagingIo) + if( pFileObject->PrivateCacheMap == NULL) { - if( pFileObject->PrivateCacheMap == NULL) - { - - AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSCommonWrite Acquiring Fcb SectionObject lock %p EXCL %08lX\n", - &pNPFcb->SectionObjectResource, - PsGetCurrentThread()); - - AFSAcquireExcl( &pNPFcb->SectionObjectResource, - TRUE); + AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING, + AFS_TRACE_LEVEL_VERBOSE, + "AFSCommonWrite Acquiring Fcb SectionObject lock %p EXCL %08lX\n", + &pNPFcb->SectionObjectResource, + PsGetCurrentThread()); - bReleaseSectionObject = TRUE; + AFSAcquireExcl( &pNPFcb->SectionObjectResource, + TRUE); - __try - { + bReleaseSectionObject = TRUE; - AFSDbgLogMsg( AFS_SUBSYSTEM_IO_PROCESSING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSCommonWrite Initialize caching on Fcb %p FileObject %p\n", - pFcb, - pFileObject); + __try + { - CcInitializeCacheMap( pFileObject, - (PCC_FILE_SIZES)&pFcb->Header.AllocationSize, - FALSE, - AFSLibCacheManagerCallbacks, - pFcb); + AFSDbgLogMsg( AFS_SUBSYSTEM_IO_PROCESSING, + AFS_TRACE_LEVEL_VERBOSE, + "AFSCommonWrite Initialize caching on Fcb %p FileObject %p\n", + pFcb, + pFileObject); - CcSetReadAheadGranularity( pFileObject, - pDeviceExt->Specific.RDR.MaximumRPCLength); + CcInitializeCacheMap( pFileObject, + (PCC_FILE_SIZES)&pFcb->Header.AllocationSize, + FALSE, + AFSLibCacheManagerCallbacks, + pFcb); - CcSetDirtyPageThreshold( pFileObject, - AFS_DIRTY_CHUNK_THRESHOLD * pDeviceExt->Specific.RDR.MaximumRPCLength / 4096); - } - __except( EXCEPTION_EXECUTE_HANDLER) - { + CcSetReadAheadGranularity( pFileObject, + pDeviceExt->Specific.RDR.MaximumRPCLength); - ntStatus = GetExceptionCode(); + CcSetDirtyPageThreshold( pFileObject, + AFS_DIRTY_CHUNK_THRESHOLD * pDeviceExt->Specific.RDR.MaximumRPCLength / 4096); + } + __except( EXCEPTION_EXECUTE_HANDLER) + { - AFSDbgLogMsg( AFS_SUBSYSTEM_IO_PROCESSING, - AFS_TRACE_LEVEL_ERROR, - "AFSCommonWrite (%p) Exception thrown while initializing cache map Status %08lX\n", - Irp, - ntStatus); - } + ntStatus = GetExceptionCode(); - AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSCommonWrite Releasing Fcb SectionObject lock %p EXCL %08lX\n", - &pNPFcb->SectionObjectResource, - PsGetCurrentThread()); + AFSDbgLogMsg( AFS_SUBSYSTEM_IO_PROCESSING, + AFS_TRACE_LEVEL_ERROR, + "AFSCommonWrite (%p) Exception thrown while initializing cache map Status %08lX\n", + Irp, + ntStatus); + } - AFSReleaseResource( &pNPFcb->SectionObjectResource); + AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING, + AFS_TRACE_LEVEL_VERBOSE, + "AFSCommonWrite Releasing Fcb SectionObject lock %p EXCL %08lX\n", + &pNPFcb->SectionObjectResource, + PsGetCurrentThread()); - bReleaseSectionObject = FALSE; + AFSReleaseResource( &pNPFcb->SectionObjectResource); + bReleaseSectionObject = FALSE; - if( !NT_SUCCESS( ntStatus)) - { + if( !NT_SUCCESS( ntStatus)) + { - try_return( ntStatus); - } + try_return( ntStatus); } }