From 41b865212b7576c0840bfc0f7c34c900e46f41c8 Mon Sep 17 00:00:00 2001 From: Rod Widdowson Date: Mon, 14 Apr 2014 16:45:37 -0400 Subject: [PATCH] Windows: Do not defer Synchronous operations There is nothing to be gained by posting a synchronous write. Let it hang out in CcCopyWrite until there is enough memory unless the write became synchronous after a deferral in which case it can be deferred again. Introduce bWait variable which is set to the result of IoIsSynchronousWrite( Irp). This change is being introduced after further analysis of the FastFat example. Change-Id: I0942975a142b0413e52076ee94977401c1d00dc9 Reviewed-on: http://gerrit.openafs.org/11067 Tested-by: BuildBot Reviewed-by: Rod Widdowson Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp index d9809e057..df3c2e8fb 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC. - * Copyright (c) 2009, 2010, 2011 Your File System, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Your File System, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,6 +121,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, BOOLEAN bReleasePaging = FALSE; BOOLEAN bExtendingWrite = FALSE; BOOLEAN bSynchronousFo = FALSE; + BOOLEAN bWait = FALSE; BOOLEAN bCompleteIrp = TRUE; BOOLEAN bForceFlush = FALSE; BOOLEAN bLockOK; @@ -177,6 +178,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, liStartingByte = pIrpSp->Parameters.Write.ByteOffset; bPagingIo = BooleanFlagOn( Irp->Flags, IRP_PAGING_IO); bNonCachedIo = BooleanFlagOn( Irp->Flags, IRP_NOCACHE); + bWait = IoIsOperationSynchronous( Irp); ulByteCount = pIrpSp->Parameters.Write.Length; bSynchronousFo = BooleanFlagOn( pFileObject->Flags, FO_SYNCHRONOUS_IO); @@ -430,7 +432,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, while (!CcCanIWrite( pFileObject, ulByteCount, - FALSE, + bWait && !bRetry, bRetry)) { static const LONGLONG llWriteDelay = (LONGLONG)-100000; @@ -450,7 +452,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, if (!CcCanIWrite( pFileObject, ulByteCount, - FALSE, + bWait && !bRetry, bRetry)) { -- 2.39.5