- Timestamp:
- May 20, 2019 11:15:40 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp
r78608 r78609 34 34 35 35 36 /** @name H acks for using the better CcCoherencyFlushAndPurgeCache when37 * available (>= Windows 7) and avoid flushing+pur ingtwice.38 * 39 * We change the cache flushing and purging related imports from 36 /** @name HACK ALERT! Using the better CcCoherencyFlushAndPurgeCache when 37 * available (>= Windows 7) and avoid flushing+purging cache twice. 38 * 39 * We change the cache flushing and purging related imports from the write.obj 40 40 * and read.obj files in the rdbsslib.lib to import so these gets redirected 41 41 * here instead of going directly to ntoskrnl. We will use … … 44 44 * purging on newer systems. 45 45 * 46 * If we don't use CcCoherencyFlushAndPurgeCache we end up not seeing newly 47 * written data in memory mappings, and similarlly not seeing data from freshly 48 * dirtied (but as yet unflushed) memory mapping pages when reading. (Both 49 * these scenarios are tested by FsPerf --mmap.) 50 * 46 51 * See VBoxEditCoffLib and the Makefile.kmk for the rest of the puzzle. 47 52 * 53 * @todo investigate whether we could do it the same way as we do on linux, 54 * where we iterrogate the cache and use cached data when memory mappings 55 * are active. Only troubles are: 56 * 57 * 1. Don't know how to find out whether we've got memory mappings. 58 * 59 * 2. Don't know how to detect dirty pages (we should only read 60 * from dirty ones). 61 * 62 * To really explore this, it would be best to introduce a caching mode 63 * mount parameter (or something) analogous to what we have on linux. In 64 * the relaxed mode, we could get away with more as users could always 65 * disable caching... 48 66 * @{ 49 67 */ 50 68 69 /** For reads. */ 51 70 static VOID NTAPI vbsfNtReadCcFlushCache(PSECTION_OBJECT_POINTERS pSectObjPtrs, PLARGE_INTEGER poffFlush, ULONG cbFlush, 52 71 PIO_STATUS_BLOCK pIos) … … 58 77 } 59 78 79 80 /** 81 * For writes with mmapping/caching section, called before the purging. 82 * 83 * This does both flushing and puring when CcCoherencyFlushAndPurgeCache is 84 * available. 85 */ 60 86 static VOID NTAPI vbsfNtWriteCcFlushCache(PSECTION_OBJECT_POINTERS pSectObjPtrs, PLARGE_INTEGER poffFlush, ULONG cbFlush, 61 87 PIO_STATUS_BLOCK pIos) … … 68 94 69 95 96 /** 97 * For writes with mmapping/caching section, called to purge after flushing. 98 * 99 * We translate this to a no-op when CcCoherencyFlushAndPurgeCache is available. 100 */ 70 101 static BOOLEAN NTAPI vbsfNtWriteCcPurgeCacheSection(PSECTION_OBJECT_POINTERS pSectObjPtrs, PLARGE_INTEGER poffPurge,ULONG cbPurge, 71 102 #if (NTDDI_VERSION >= NTDDI_VISTA) … … 88 119 89 120 extern "C" { 121 /** This is what read.obj gets instead of __imp_CcFlushCache. */ 90 122 decltype(CcFlushCache) *g_pfnRdFlushCache = vbsfNtReadCcFlushCache; 123 /** This is what write.obj gets instead of __imp_CcFlushCache. */ 91 124 decltype(CcFlushCache) *g_pfnWrFlushCache = vbsfNtWriteCcFlushCache; 125 /** This is what write.obj gets instead of __imp_CcPurgeCacheSection. */ 92 126 decltype(CcPurgeCacheSection) *g_pfnWrPurgeCacheSection = vbsfNtWriteCcPurgeCacheSection; 93 127 }
Note:
See TracChangeset
for help on using the changeset viewer.