Windows: AFSCommonWrite add bWriteToEndOfFile var
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 14 Apr 2014 20:48:32 +0000 (16:48 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 16 Apr 2014 13:05:33 +0000 (06:05 -0700)
To improve readability add a bWriteToEndOfFile variable which
stores the value of

  liStartingByte.LowPart == FILE_WRITE_TO_END_OF_FILE &&
  liStartingByte.HighPart == -1

Change-Id: I6594196a6c8c3ab41561ffdbd3eddf3d34b410de
Reviewed-on: http://gerrit.openafs.org/11068
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index df3c2e8..3fcdbbd 100644 (file)
@@ -121,6 +121,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject,
     BOOLEAN            bReleasePaging = FALSE;
     BOOLEAN            bExtendingWrite = FALSE;
     BOOLEAN            bSynchronousFo = FALSE;
+    BOOLEAN           bWriteToEndOfFile = FALSE;
     BOOLEAN           bWait = FALSE;
     BOOLEAN            bCompleteIrp = TRUE;
     BOOLEAN            bForceFlush = FALSE;
@@ -547,10 +548,12 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject,
             else
             {
 
-                bExtendingWrite = (((liStartingByte.QuadPart + ulByteCount) >=
-                                     pFcb->Header.FileSize.QuadPart) ||
-                                    (liStartingByte.LowPart == FILE_WRITE_TO_END_OF_FILE &&
-                                      liStartingByte.HighPart == -1)) ;
+               bWriteToEndOfFile = liStartingByte.LowPart == FILE_WRITE_TO_END_OF_FILE &&
+                                   liStartingByte.HighPart == -1;
+
+               bExtendingWrite = ( bWriteToEndOfFile ||
+                                   ((liStartingByte.QuadPart + ulByteCount) >=
+                                     pFcb->Header.FileSize.QuadPart));
 
                 if( bExtendingWrite || bNonCachedIo)
                 {
@@ -587,8 +590,7 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject,
 
                     bReleaseSectionObject = TRUE;
 
-                    if (liStartingByte.LowPart == FILE_WRITE_TO_END_OF_FILE &&
-                         liStartingByte.HighPart == -1)
+                   if ( bWriteToEndOfFile)
                     {
                         if (pFcb->Header.ValidDataLength.QuadPart > pFcb->Header.FileSize.QuadPart)
                         {