3 typedef struct _PF_SCENARIO_ID
7 } PF_SCENARIO_ID
, *PPF_SCENARIO_ID
;
9 typedef struct _PF_LOG_ENTRY
16 ULONG FileSequenceNumber
;
18 } PF_LOG_ENTRY
, *PPF_LOG_ENTRY
;
20 typedef struct _PFSN_LOG_ENTRIES
22 LIST_ENTRY TraceBuffersLink
;
25 PF_LOG_ENTRY Entries
[ANYSIZE_ARRAY
];
26 } PFSN_LOG_ENTRIES
, *PPFSN_LOG_ENTRIES
;
28 typedef struct _PF_SECTION_INFO
31 ULONG FileSequenceNumber
;
34 } PF_SECTION_INFO
, *PPF_SECTION_INFO
;
36 typedef struct _PF_TRACE_HEADER
41 PF_SCENARIO_ID ScenarioId
;
42 ULONG ScenarioType
; // PF_SCENARIO_TYPE
43 ULONG EventEntryIdxs
[8];
44 ULONG NumEventEntryIdxs
;
45 ULONG TraceBufferOffset
;
47 ULONG SectionInfoOffset
;
49 ULONG FaultsPerPeriod
[10];
50 LARGE_INTEGER LaunchTime
;
51 ULONGLONG Reserved
[5];
52 } PF_TRACE_HEADER
, *PPF_TRACE_HEADER
;
54 typedef struct _PFSN_TRACE_DUMP
56 LIST_ENTRY CompletedTracesLink
;
57 PF_TRACE_HEADER Trace
;
58 } PFSN_TRACE_DUMP
, *PPFSN_TRACE_DUMP
;
60 typedef struct _PFSN_TRACE_HEADER
63 LIST_ENTRY ActiveTracesLink
;
64 PF_SCENARIO_ID ScenarioId
;
65 ULONG ScenarioType
; // PF_SCENARIO_TYPE
66 ULONG EventEntryIdxs
[8];
67 ULONG NumEventEntryIdxs
;
68 PPFSN_LOG_ENTRIES CurrentTraceBuffer
;
69 LIST_ENTRY TraceBuffersList
;
70 ULONG NumTraceBuffers
;
71 KSPIN_LOCK TraceBufferSpinLock
;
73 LARGE_INTEGER TraceTimerPeriod
;
75 KSPIN_LOCK TraceTimerSpinLock
;
76 ULONG FaultsPerPeriod
[10];
82 EX_RUNDOWN_REF RefCount
;
83 WORK_QUEUE_ITEM EndTraceWorkItem
;
85 PPFSN_TRACE_DUMP TraceDump
;
86 NTSTATUS TraceDumpStatus
;
87 LARGE_INTEGER LaunchTime
;
88 PPF_SECTION_INFO SectionInfo
;
89 ULONG SectionInfoCount
;
90 } PFSN_TRACE_HEADER
, *PPFSN_TRACE_HEADER
;
92 typedef struct _PFSN_PREFETCHER_GLOBALS
94 LIST_ENTRY ActiveTraces
;
95 KSPIN_LOCK ActiveTracesLock
;
96 PPFSN_TRACE_HEADER SystemWideTrace
;
97 LIST_ENTRY CompletedTraces
;
98 FAST_MUTEX CompletedTracesLock
;
99 LONG NumCompletedTraces
;
100 PKEVENT CompletedTracesEvent
;
101 LONG ActivePrefetches
;
102 } PFSN_PREFETCHER_GLOBALS
, *PPFSN_PREFETCHER_GLOBALS
;
106 LIST_ENTRY BcbSegmentListHead
;
107 LIST_ENTRY BcbRemoveListEntry
;
108 BOOLEAN RemoveOnClose
;
110 PFILE_OBJECT FileObject
;
111 ULONG CacheSegmentSize
;
112 LARGE_INTEGER AllocationSize
;
113 LARGE_INTEGER FileSize
;
114 PCACHE_MANAGER_CALLBACKS Callbacks
;
115 PVOID LazyWriteContext
;
119 BOOLEAN Trace
; /* enable extra trace output for this BCB and it's cache segments */
123 typedef struct _CACHE_SEGMENT
125 /* Base address of the region where the cache segment data is mapped. */
128 * Memory area representing the region where the cache segment data is
131 struct _MEMORY_AREA
* MemoryArea
;
132 /* Are the contents of the cache segment data valid. */
134 /* Are the contents of the cache segment data newer than those on disk. */
136 /* Page out in progress */
139 /* Entry in the list of segments for this BCB. */
140 LIST_ENTRY BcbSegmentListEntry
;
141 /* Entry in the list of segments which are dirty. */
142 LIST_ENTRY DirtySegmentListEntry
;
143 /* Entry in the list of segments. */
144 LIST_ENTRY CacheSegmentListEntry
;
145 LIST_ENTRY CacheSegmentLRUListEntry
;
146 /* Offset in the file which this cache segment maps. */
150 /* Number of references. */
151 ULONG ReferenceCount
;
152 /* Pointer to the BCB for the file which this cache segment maps data for. */
154 /* Pointer to the next cache segment in a chain. */
155 struct _CACHE_SEGMENT
* NextInChain
;
156 } CACHE_SEGMENT
, *PCACHE_SEGMENT
;
158 typedef struct _INTERNAL_BCB
161 PCACHE_SEGMENT CacheSegment
;
163 CSHORT RefCount
; /* (At offset 0x34 on WinNT4) */
164 } INTERNAL_BCB
, *PINTERNAL_BCB
;
168 CcPfInitializePrefetcher(
175 IN PMDL MemoryDescriptorList
,
176 IN PFILE_OBJECT FileObject
182 IN PFILE_OBJECT FileObject
,
183 IN PLARGE_INTEGER FileOffset
,
189 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
193 CcRosGetCacheSegment(
199 PCACHE_SEGMENT
*CacheSeg
208 CcRosFreeCacheSegment(
215 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
219 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
223 CcInitializeCacheManager(VOID
);
227 CcRosUnmapCacheSegment(
235 CcRosLookupCacheSegment(
242 CcRosGetCacheSegmentChain(
246 PCACHE_SEGMENT
* CacheSeg
251 CcInitCacheZeroPage(VOID
);
255 CcRosMarkDirtyCacheSegment(
262 CcRosFlushDirtyPages(
269 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
273 CcRosReferenceCache(PFILE_OBJECT FileObject
);
277 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
281 CcRosReleaseCacheSegment(
283 CACHE_SEGMENT
*CacheSeg
,
291 CcRosRequestCacheSegment(
296 CACHE_SEGMENT
**CacheSeg
301 CcRosInitializeFileCache(
302 PFILE_OBJECT FileObject
,
303 ULONG CacheSegmentSize
,
304 PCACHE_MANAGER_CALLBACKS CallBacks
,
305 PVOID LazyWriterContext
310 CcRosReleaseFileCache(
311 PFILE_OBJECT FileObject
316 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);