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 LARGE_INTEGER AllocationSize
;
112 LARGE_INTEGER FileSize
;
113 PCACHE_MANAGER_CALLBACKS Callbacks
;
114 PVOID LazyWriteContext
;
118 BOOLEAN Trace
; /* enable extra trace output for this BCB and it's cache segments */
122 typedef struct _CACHE_SEGMENT
124 /* Base address of the region where the cache segment data is mapped. */
127 * Memory area representing the region where the cache segment data is
130 struct _MEMORY_AREA
* MemoryArea
;
131 /* Are the contents of the cache segment data valid. */
133 /* Are the contents of the cache segment data newer than those on disk. */
135 /* Page out in progress */
138 /* Entry in the list of segments for this BCB. */
139 LIST_ENTRY BcbSegmentListEntry
;
140 /* Entry in the list of segments which are dirty. */
141 LIST_ENTRY DirtySegmentListEntry
;
142 /* Entry in the list of segments. */
143 LIST_ENTRY CacheSegmentListEntry
;
144 LIST_ENTRY CacheSegmentLRUListEntry
;
145 /* Offset in the file which this cache segment maps. */
149 /* Number of references. */
150 ULONG ReferenceCount
;
151 /* Pointer to the BCB for the file which this cache segment maps data for. */
153 /* Pointer to the next cache segment in a chain. */
154 struct _CACHE_SEGMENT
* NextInChain
;
155 } CACHE_SEGMENT
, *PCACHE_SEGMENT
;
157 typedef struct _INTERNAL_BCB
160 PCACHE_SEGMENT CacheSegment
;
162 CSHORT RefCount
; /* (At offset 0x34 on WinNT4) */
163 } INTERNAL_BCB
, *PINTERNAL_BCB
;
167 CcPfInitializePrefetcher(
174 IN PFILE_OBJECT FileObject
,
175 IN PMDL MemoryDescriptorList
181 IN PFILE_OBJECT FileObject
,
182 IN PLARGE_INTEGER FileOffset
,
188 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
192 CcRosGetCacheSegment(
198 PCACHE_SEGMENT
*CacheSeg
207 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
211 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
215 CcInitializeCacheManager(VOID
);
219 CcRosUnmapCacheSegment(
227 CcRosLookupCacheSegment(
234 CcRosGetCacheSegmentChain(
238 PCACHE_SEGMENT
* CacheSeg
243 CcInitCacheZeroPage(VOID
);
247 CcRosMarkDirtyCacheSegment(
254 CcRosFlushDirtyPages(
262 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
266 CcRosReferenceCache(PFILE_OBJECT FileObject
);
270 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
274 CcRosReleaseCacheSegment(
276 CACHE_SEGMENT
*CacheSeg
,
284 CcRosRequestCacheSegment(
289 CACHE_SEGMENT
**CacheSeg
294 CcRosInitializeFileCache(
295 PFILE_OBJECT FileObject
,
296 PCACHE_MANAGER_CALLBACKS CallBacks
,
297 PVOID LazyWriterContext
302 CcRosReleaseFileCache(
303 PFILE_OBJECT FileObject
308 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);
318 if (Offset1
+ Length1
<= Offset2
)
320 if (Offset2
+ Length2
<= Offset1
)
332 return DoSegmentsIntersect(Offset1
, Length1
, Point
, 1);