Changeset 78584 in vbox for trunk/src/VBox
- Timestamp:
- May 18, 2019 9:07:57 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/SharedFolders/driver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp
r78577 r78584 114 114 pReq->PgLst.aPages[iPage] = (RTGCPHYS)paPfns[iPage] << PAGE_SHIFT; 115 115 pReq->PgLst.offFirstPage = offPage; 116 117 /* 118 * Flush dirty cache content before we try read it from the host. RDBSS calls 119 * CcFlushCache before it calls us, I think, but CcCoherencyFlushAndPurgeCache 120 * does the right thing whereas CcFlushCache clearly does (FsPerf mmap+read 121 * coherency test fails consistently on W10, XP, ++). 122 */ 123 if ( g_pfnCcCoherencyFlushAndPurgeCache 124 && !(RxContext->CurrentIrp && (RxContext->CurrentIrp->Flags & IRP_PAGING_IO)) 125 && RxContext->NonPagedFcb != NULL 126 && RxContext->NonPagedFcb->SectionObjectPointers.DataSectionObject != NULL) 127 { 128 LARGE_INTEGER offFlush; 129 offFlush.QuadPart = offFile; 130 g_pfnCcCoherencyFlushAndPurgeCache(&RxContext->NonPagedFcb->SectionObjectPointers, &offFlush, cbChunk, 131 &RxContext->CurrentIrp->IoStatus, CC_FLUSH_AND_PURGE_NO_PURGE); 132 } 116 133 117 134 /* … … 294 311 AssertReturn(pBufferMdl, STATUS_INTERNAL_ERROR); 295 312 296 297 313 /* 298 314 * We should never get a zero byte request (RDBSS checks), but in case we … … 358 374 359 375 /* 376 * Flush and purge the cache range we're touching upon now, provided we can and 377 * really needs to. The CcCoherencyFlushAndPurgeCache API seems to work better 378 * than the CcFlushCache + CcPurgeCacheSection that RDBSS does before calling us. 379 */ 380 if ( g_pfnCcCoherencyFlushAndPurgeCache 381 && !(RxContext->CurrentIrp && (RxContext->CurrentIrp->Flags & IRP_PAGING_IO)) 382 && RxContext->NonPagedFcb != NULL 383 && RxContext->NonPagedFcb->SectionObjectPointers.DataSectionObject != NULL) 384 { 385 /** @todo locking. */ 386 LARGE_INTEGER offFlush; 387 offFlush.QuadPart = offFile; 388 g_pfnCcCoherencyFlushAndPurgeCache(&RxContext->NonPagedFcb->SectionObjectPointers, &offFlush, cbChunk, 389 &RxContext->CurrentIrp->IoStatus, 0 /*fFlags*/); 390 } 391 392 /* 360 393 * Issue the request and unlock the pages. 361 394 */ -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp
r78575 r78584 52 52 */ 53 53 PRDBSS_DEVICE_OBJECT VBoxMRxDeviceObject; 54 55 /** Pointer to CcCoherencyFlushAndPurgeCache if present in ntoskrnl. */ 56 PFNCCCOHERENCYFLUSHANDPURGECACHE g_pfnCcCoherencyFlushAndPurgeCache; 54 57 55 58 /** The shared folder service client structure. */ … … 659 662 } 660 663 664 /* Resolve newer kernel APIs we might want to use: */ 665 UNICODE_STRING RoutineName; 666 RtlInitUnicodeString(&RoutineName, L"CcCoherencyFlushAndPurgeCache"); 667 g_pfnCcCoherencyFlushAndPurgeCache = (PFNCCCOHERENCYFLUSHANDPURGECACHE)MmGetSystemRoutineAddress(&RoutineName); 668 661 669 /* Init the driver object. */ 662 670 DriverObject->DriverUnload = VBoxMRxUnload; -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h
r78487 r78584 57 57 extern PRDBSS_DEVICE_OBJECT VBoxMRxDeviceObject; 58 58 extern uint32_t g_uSfLastFunction; 59 /** Pointer to the CcCoherencyFlushAndPurgeCache API (since win 7). */ 60 typedef VOID (NTAPI *PFNCCCOHERENCYFLUSHANDPURGECACHE)(PSECTION_OBJECT_POINTERS, PLARGE_INTEGER, ULONG, PIO_STATUS_BLOCK,ULONG); 61 extern PFNCCCOHERENCYFLUSHANDPURGECACHE g_pfnCcCoherencyFlushAndPurgeCache; 62 #ifndef CC_FLUSH_AND_PURGE_NO_PURGE 63 # define CC_FLUSH_AND_PURGE_NO_PURGE 1 64 #endif 65 59 66 60 67 /**
Note:
See TracChangeset
for help on using the changeset viewer.