ReactOS 0.4.15-dev-7931-gfd331f1
cc.h File Reference

Go to the source code of this file.

Classes

struct  _PF_SCENARIO_ID
 
struct  _PF_LOG_ENTRY
 
struct  _PFSN_LOG_ENTRIES
 
struct  _PF_SECTION_INFO
 
struct  _PF_TRACE_HEADER
 
struct  _PFSN_TRACE_DUMP
 
struct  _PFSN_TRACE_HEADER
 
struct  _PFSN_PREFETCHER_GLOBALS
 
struct  _ROS_SHARED_CACHE_MAP
 
struct  _ROS_VACB
 
struct  _INTERNAL_BCB
 
struct  _LAZY_WRITER
 
struct  _WORK_QUEUE_ENTRY
 

Macros

#define _CC_DEBUG_   0x00
 
#define CC_API_DEBUG   0x01
 
#define CCTRACE(x, fmt, ...)   DPRINT(fmt, ##__VA_ARGS__)
 
#define READAHEAD_DISABLED   0x1
 
#define WRITEBEHIND_DISABLED   0x2
 
#define SHARED_CACHE_MAP_IN_CREATION   0x4
 
#define SHARED_CACHE_MAP_IN_LAZYWRITE   0x8
 
#define NODE_TYPE_DEFERRED_WRITE   0x02FC
 
#define NODE_TYPE_PRIVATE_MAP   0x02FE
 
#define NODE_TYPE_SHARED_MAP   0x02FF
 
#define CcBugCheck(A, B, C)   KeBugCheckEx(CACHE_MANAGER, BugCheckFileId | ((ULONG)(__LINE__)), A, B, C)
 
#define CcRosVacbIncRefCount(vacb)   InterlockedIncrement((PLONG)&(vacb)->ReferenceCount)
 
#define CcRosVacbGetRefCount(vacb)   InterlockedCompareExchange((PLONG)&(vacb)->ReferenceCount, 0, 0)
 

Typedefs

typedef struct _PF_SCENARIO_ID PF_SCENARIO_ID
 
typedef struct _PF_SCENARIO_IDPPF_SCENARIO_ID
 
typedef struct _PF_LOG_ENTRY PF_LOG_ENTRY
 
typedef struct _PF_LOG_ENTRYPPF_LOG_ENTRY
 
typedef struct _PFSN_LOG_ENTRIES PFSN_LOG_ENTRIES
 
typedef struct _PFSN_LOG_ENTRIESPPFSN_LOG_ENTRIES
 
typedef struct _PF_SECTION_INFO PF_SECTION_INFO
 
typedef struct _PF_SECTION_INFOPPF_SECTION_INFO
 
typedef struct _PF_TRACE_HEADER PF_TRACE_HEADER
 
typedef struct _PF_TRACE_HEADERPPF_TRACE_HEADER
 
typedef struct _PFSN_TRACE_DUMP PFSN_TRACE_DUMP
 
typedef struct _PFSN_TRACE_DUMPPPFSN_TRACE_DUMP
 
typedef struct _PFSN_TRACE_HEADER PFSN_TRACE_HEADER
 
typedef struct _PFSN_TRACE_HEADERPPFSN_TRACE_HEADER
 
typedef struct _PFSN_PREFETCHER_GLOBALS PFSN_PREFETCHER_GLOBALS
 
typedef struct _PFSN_PREFETCHER_GLOBALSPPFSN_PREFETCHER_GLOBALS
 
typedef struct _ROS_SHARED_CACHE_MAP ROS_SHARED_CACHE_MAP
 
typedef struct _ROS_SHARED_CACHE_MAPPROS_SHARED_CACHE_MAP
 
typedef struct _ROS_VACB ROS_VACB
 
typedef struct _ROS_VACBPROS_VACB
 
typedef struct _INTERNAL_BCB INTERNAL_BCB
 
typedef struct _INTERNAL_BCBPINTERNAL_BCB
 
typedef struct _LAZY_WRITER LAZY_WRITER
 
typedef struct _LAZY_WRITERPLAZY_WRITER
 
typedef struct _WORK_QUEUE_ENTRY WORK_QUEUE_ENTRY
 
typedef struct _WORK_QUEUE_ENTRYPWORK_QUEUE_ENTRY
 
typedef enum _WORK_QUEUE_FUNCTIONS WORK_QUEUE_FUNCTIONS
 
typedef enum _WORK_QUEUE_FUNCTIONSPWORK_QUEUE_FUNCTIONS
 

Enumerations

enum  _WORK_QUEUE_FUNCTIONS { ReadAhead = 1 , WriteBehind = 2 , LazyScan = 3 , SetDone = 4 }
 

Functions

VOID NTAPI CcPfInitializePrefetcher (VOID)
 
VOID NTAPI CcMdlReadComplete2 (IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList)
 
VOID NTAPI CcMdlWriteComplete2 (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
 
NTSTATUS CcRosFlushVacb (_In_ PROS_VACB Vacb, _Out_opt_ PIO_STATUS_BLOCK Iosb)
 
NTSTATUS CcRosGetVacb (PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
 
BOOLEAN CcRosEnsureVacbResident (_In_ PROS_VACB Vacb, _In_ BOOLEAN Wait, _In_ BOOLEAN NoRead, _In_ ULONG Offset, _In_ ULONG Length)
 
VOID NTAPI CcInitView (VOID)
 
VOID NTAPI CcShutdownLazyWriter (VOID)
 
BOOLEAN CcInitializeCacheManager (VOID)
 
PROS_VACB CcRosLookupVacb (PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset)
 
VOID NTAPI CcInitCacheZeroPage (VOID)
 
VOID CcRosMarkDirtyVacb (PROS_VACB Vacb)
 
VOID CcRosUnmarkDirtyVacb (PROS_VACB Vacb, BOOLEAN LockViews)
 
NTSTATUS CcRosFlushDirtyPages (ULONG Target, PULONG Count, BOOLEAN Wait, BOOLEAN CalledFromLazy)
 
VOID CcRosDereferenceCache (PFILE_OBJECT FileObject)
 
VOID CcRosReferenceCache (PFILE_OBJECT FileObject)
 
NTSTATUS CcRosReleaseVacb (PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
 
NTSTATUS CcRosRequestVacb (PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
 
NTSTATUS CcRosInitializeFileCache (PFILE_OBJECT FileObject, PCC_FILE_SIZES FileSizes, BOOLEAN PinAccess, PCACHE_MANAGER_CALLBACKS CallBacks, PVOID LazyWriterContext)
 
NTSTATUS CcRosReleaseFileCache (PFILE_OBJECT FileObject)
 
VOID NTAPI CcShutdownSystem (VOID)
 
VOID NTAPI CcWorkerThread (PVOID Parameter)
 
VOID NTAPI CcScanDpc (PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
 
VOID CcScheduleLazyWriteScan (BOOLEAN NoDelay)
 
VOID CcPostDeferredWrites (VOID)
 
VOID CcPostWorkQueue (IN PWORK_QUEUE_ENTRY WorkItem, IN PLIST_ENTRY WorkQueue)
 
VOID CcPerformReadAhead (IN PFILE_OBJECT FileObject)
 
NTSTATUS CcRosInternalFreeVacb (IN PROS_VACB Vacb)
 
FORCEINLINE BOOLEAN DoRangesIntersect (_In_ LONGLONG Offset1, _In_ LONGLONG Length1, _In_ LONGLONG Offset2, _In_ LONGLONG Length2)
 
FORCEINLINE BOOLEAN IsPointInRange (_In_ LONGLONG Offset1, _In_ LONGLONG Length1, _In_ LONGLONG Point)
 
FORCEINLINE ULONG CcRosVacbDecRefCount (PROS_VACB vacb)
 
BOOLEAN CcRosFreeOneUnusedVacb (VOID)
 

Variables

ULONG CcRosTraceLevel
 
LIST_ENTRY DirtyVacbListHead
 
ULONG CcDirtyPageThreshold
 
ULONG CcTotalDirtyPages
 
LIST_ENTRY CcDeferredWrites
 
KSPIN_LOCK CcDeferredWriteSpinLock
 
ULONG CcNumberWorkerThreads
 
LIST_ENTRY CcIdleWorkerThreadList
 
LIST_ENTRY CcExpressWorkQueue
 
LIST_ENTRY CcRegularWorkQueue
 
LIST_ENTRY CcPostTickWorkQueue
 
NPAGED_LOOKASIDE_LIST CcTwilightLookasideList
 
LARGE_INTEGER CcIdleDelay
 
ULONG CcLazyWritePages
 
ULONG CcLazyWriteIos
 
ULONG CcMapDataWait
 
ULONG CcMapDataNoWait
 
ULONG CcPinReadWait
 
ULONG CcPinReadNoWait
 
ULONG CcPinMappedDataCount
 
ULONG CcDataPages
 
ULONG CcDataFlushes
 
LAZY_WRITER LazyWriter
 

Macro Definition Documentation

◆ _CC_DEBUG_

#define _CC_DEBUG_   0x00

Definition at line 6 of file cc.h.

◆ CC_API_DEBUG

#define CC_API_DEBUG   0x01

Definition at line 11 of file cc.h.

◆ CcBugCheck

#define CcBugCheck (   A,
  B,
  C 
)    KeBugCheckEx(CACHE_MANAGER, BugCheckFileId | ((ULONG)(__LINE__)), A, B, C)

Definition at line 469 of file cc.h.

◆ CcRosVacbGetRefCount

#define CcRosVacbGetRefCount (   vacb)    InterlockedCompareExchange((PLONG)&(vacb)->ReferenceCount, 0, 0)

Definition at line 510 of file cc.h.

◆ CcRosVacbIncRefCount

#define CcRosVacbIncRefCount (   vacb)    InterlockedIncrement((PLONG)&(vacb)->ReferenceCount)

Definition at line 495 of file cc.h.

◆ CCTRACE

#define CCTRACE (   x,
  fmt,
  ... 
)    DPRINT(fmt, ##__VA_ARGS__)

Definition at line 36 of file cc.h.

◆ NODE_TYPE_DEFERRED_WRITE

#define NODE_TYPE_DEFERRED_WRITE   0x02FC

Definition at line 286 of file cc.h.

◆ NODE_TYPE_PRIVATE_MAP

#define NODE_TYPE_PRIVATE_MAP   0x02FE

Definition at line 287 of file cc.h.

◆ NODE_TYPE_SHARED_MAP

#define NODE_TYPE_SHARED_MAP   0x02FF

Definition at line 288 of file cc.h.

◆ READAHEAD_DISABLED

#define READAHEAD_DISABLED   0x1

Definition at line 201 of file cc.h.

◆ SHARED_CACHE_MAP_IN_CREATION

#define SHARED_CACHE_MAP_IN_CREATION   0x4

Definition at line 203 of file cc.h.

◆ SHARED_CACHE_MAP_IN_LAZYWRITE

#define SHARED_CACHE_MAP_IN_LAZYWRITE   0x8

Definition at line 204 of file cc.h.

◆ WRITEBEHIND_DISABLED

#define WRITEBEHIND_DISABLED   0x2

Definition at line 202 of file cc.h.

Typedef Documentation

◆ INTERNAL_BCB

◆ LAZY_WRITER

◆ PF_LOG_ENTRY

◆ PF_SCENARIO_ID

◆ PF_SECTION_INFO

◆ PF_TRACE_HEADER

◆ PFSN_LOG_ENTRIES

◆ PFSN_PREFETCHER_GLOBALS

◆ PFSN_TRACE_DUMP

◆ PFSN_TRACE_HEADER

◆ PINTERNAL_BCB

◆ PLAZY_WRITER

◆ PPF_LOG_ENTRY

◆ PPF_SCENARIO_ID

◆ PPF_SECTION_INFO

◆ PPF_TRACE_HEADER

◆ PPFSN_LOG_ENTRIES

◆ PPFSN_PREFETCHER_GLOBALS

◆ PPFSN_TRACE_DUMP

◆ PPFSN_TRACE_HEADER

◆ PROS_SHARED_CACHE_MAP

◆ PROS_VACB

◆ PWORK_QUEUE_ENTRY

◆ PWORK_QUEUE_FUNCTIONS

◆ ROS_SHARED_CACHE_MAP

◆ ROS_VACB

◆ WORK_QUEUE_ENTRY

◆ WORK_QUEUE_FUNCTIONS

Enumeration Type Documentation

◆ _WORK_QUEUE_FUNCTIONS

Enumerator
ReadAhead 
WriteBehind 
LazyScan 
SetDone 

Definition at line 276 of file cc.h.

277{
278 ReadAhead = 1,
279 WriteBehind = 2,
280 LazyScan = 3,
281 SetDone = 4,
enum _WORK_QUEUE_FUNCTIONS WORK_QUEUE_FUNCTIONS
enum _WORK_QUEUE_FUNCTIONS * PWORK_QUEUE_FUNCTIONS
@ SetDone
Definition: cc.h:281
@ LazyScan
Definition: cc.h:280
@ WriteBehind
Definition: cc.h:279
@ ReadAhead
Definition: cc.h:278

Function Documentation

◆ CcInitCacheZeroPage()

VOID NTAPI CcInitCacheZeroPage ( VOID  )

Definition at line 56 of file copy.c.

58{
60
62 //MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
64 if (!NT_SUCCESS(Status))
65 {
66 DbgPrint("Can't allocate CcZeroPage.\n");
67 KeBugCheck(CACHE_MANAGER);
68 }
70}
LONG NTSTATUS
Definition: precomp.h:26
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1431
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
#define DbgPrint
Definition: hal.h:12
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
static PFN_NUMBER CcZeroPage
Definition: copy.c:19
@ MI_USAGE_CACHE
Definition: mm.h:342
#define MC_SYSTEM
Definition: mm.h:115
#define MI_SET_USAGE(x)
Definition: mm.h:317
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:313

◆ CcInitializeCacheManager()

BOOLEAN CcInitializeCacheManager ( VOID  )

Definition at line 83 of file fssup.c.

84{
85 int i;
86
87 DPRINT("Initialize\n");
88 for (i = 0; i < CACHE_NUM_SECTIONS; i++)
89 {
90 KeInitializeEvent(&CcCacheSections[i].ExclusiveWait,
92 FALSE);
93
94 InitializeListHead(&CcCacheSections[i].ThisFileList);
95 }
96
98
102
105 DPRINT1("Cache has %d entries\n", CcCacheBitmap->SizeOfBitMap);
107
108 return TRUE;
109}
#define DPRINT1
Definition: precomp.h:8
#define FALSE
Definition: types.h:117
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ROUND_UP(n, align)
Definition: eventvwr.h:34
KEVENT CcpLazyWriteEvent
Definition: lazyrite.c:18
KEVENT CcFinalizeEvent
Definition: pinsup.c:103
LIST_ENTRY CcpAllSharedCacheMaps
Definition: fssup.c:76
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FAST_MUTEX CcMutex
Definition: pinsup.c:101
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
KEVENT CcDeleteEvent
Definition: pinsup.c:102
#define CACHE_NUM_SECTIONS
Definition: newcc.h:125
@ SynchronizationEvent
#define DPRINT
Definition: sndvol32.h:71
ULONG SizeOfBitMap
Definition: typedefs.h:90
PULONG Buffer
Definition: typedefs.h:91
uint32_t * PULONG
Definition: typedefs.h:59
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274

Referenced by Phase1InitializationDiscard().

◆ CcInitView()

VOID NTAPI CcInitView ( VOID  )

Definition at line 1449 of file view.c.

1451{
1452 DPRINT("CcInitView()\n");
1453
1460 NULL,
1461 NULL,
1462 0,
1463 sizeof(INTERNAL_BCB),
1464 TAG_BCB,
1465 20);
1467 NULL,
1468 NULL,
1469 0,
1470 sizeof(ROS_SHARED_CACHE_MAP),
1472 20);
1474 NULL,
1475 NULL,
1476 0,
1477 sizeof(ROS_VACB),
1478 TAG_VACB,
1479 20);
1480
1482}
#define NULL
Definition: types.h:112
#define TAG_BCB
Definition: nodetype.h:157
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:218
VOID NTAPI CcInitCacheZeroPage(VOID)
Definition: copy.c:56
LIST_ENTRY CcCleanSharedCacheMapList
Definition: view.c:59
static LIST_ENTRY VacbLruListHead
Definition: view.c:42
KSPIN_LOCK CcDeferredWriteSpinLock
Definition: view.c:58
LIST_ENTRY CcDeferredWrites
Definition: view.c:57
NPAGED_LOOKASIDE_LIST iBcbLookasideList
Definition: view.c:44
LIST_ENTRY DirtyVacbListHead
Definition: view.c:41
static NPAGED_LOOKASIDE_LIST SharedCacheMapLookasideList
Definition: view.c:45
static NPAGED_LOOKASIDE_LIST VacbLookasideList
Definition: view.c:46
Definition: cc.h:207
#define TAG_SHARED_CACHE_MAP
Definition: tag.h:16
#define TAG_VACB
Definition: tag.h:15

◆ CcMdlReadComplete2()

VOID NTAPI CcMdlReadComplete2 ( IN PFILE_OBJECT  FileObject,
IN PMDL  MemoryDescriptorList 
)

Definition at line 83 of file mdlsup.c.

85{
87}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by CcMdlReadComplete(), and FsRtlMdlReadCompleteDev().

◆ CcMdlWriteComplete2()

VOID NTAPI CcMdlWriteComplete2 ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN PMDL  MdlChain 
)

Definition at line 111 of file mdlsup.c.

114{
116}

Referenced by CcMdlWriteComplete(), and FsRtlMdlWriteCompleteDev().

◆ CcPerformReadAhead()

VOID CcPerformReadAhead ( IN PFILE_OBJECT  FileObject)

Definition at line 130 of file copy.c.

132{
134 LONGLONG CurrentOffset;
136 PROS_SHARED_CACHE_MAP SharedCacheMap;
137 PROS_VACB Vacb;
138 ULONG PartialLength;
140 PPRIVATE_CACHE_MAP PrivateCacheMap;
143
144 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
145
146 /* Critical:
147 * PrivateCacheMap might disappear in-between if the handle
148 * to the file is closed (private is attached to the handle not to
149 * the file), so we need to lock the master lock while we deal with
150 * it. It won't disappear without attempting to lock such lock.
151 */
153 PrivateCacheMap = FileObject->PrivateCacheMap;
154 /* If the handle was closed since the read ahead was scheduled, just quit */
155 if (PrivateCacheMap == NULL)
156 {
159 return;
160 }
161 /* Otherwise, extract read offset and length and release private map */
162 else
163 {
165 CurrentOffset = PrivateCacheMap->ReadAheadOffset[1].QuadPart;
166 Length = PrivateCacheMap->ReadAheadLength[1];
168 }
170
171 /* Time to go! */
172 DPRINT("Doing ReadAhead for %p\n", FileObject);
173 /* Lock the file, first */
174 if (!SharedCacheMap->Callbacks->AcquireForReadAhead(SharedCacheMap->LazyWriteContext, FALSE))
175 {
176 Locked = FALSE;
177 goto Clear;
178 }
179
180 /* Remember it's locked */
181 Locked = TRUE;
182
183 /* Don't read past the end of the file */
184 if (CurrentOffset >= SharedCacheMap->FileSize.QuadPart)
185 {
186 goto Clear;
187 }
188 if (CurrentOffset + Length > SharedCacheMap->FileSize.QuadPart)
189 {
190 Length = SharedCacheMap->FileSize.QuadPart - CurrentOffset;
191 }
192
193 /* Next of the algorithm will lock like CcCopyData with the slight
194 * difference that we don't copy data back to an user-backed buffer
195 * We just bring data into Cc
196 */
197 PartialLength = CurrentOffset % VACB_MAPPING_GRANULARITY;
198 if (PartialLength != 0)
199 {
200 PartialLength = min(Length, VACB_MAPPING_GRANULARITY - PartialLength);
201 Status = CcRosRequestVacb(SharedCacheMap,
202 ROUND_DOWN(CurrentOffset, VACB_MAPPING_GRANULARITY),
203 &Vacb);
204 if (!NT_SUCCESS(Status))
205 {
206 DPRINT1("Failed to request VACB: %lx!\n", Status);
207 goto Clear;
208 }
209
211 {
213 CurrentOffset % VACB_MAPPING_GRANULARITY, PartialLength);
214 }
216 {
217 Success = FALSE;
218 }
220
221 if (!Success)
222 {
223 CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
224 DPRINT1("Failed to read data: %lx!\n", Status);
225 goto Clear;
226 }
227
228 CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
229
230 Length -= PartialLength;
231 CurrentOffset += PartialLength;
232 }
233
234 while (Length > 0)
235 {
236 ASSERT(CurrentOffset % VACB_MAPPING_GRANULARITY == 0);
237 PartialLength = min(VACB_MAPPING_GRANULARITY, Length);
238 Status = CcRosRequestVacb(SharedCacheMap,
239 CurrentOffset,
240 &Vacb);
241 if (!NT_SUCCESS(Status))
242 {
243 DPRINT1("Failed to request VACB: %lx!\n", Status);
244 goto Clear;
245 }
246
248 {
249 Success = CcRosEnsureVacbResident(Vacb, TRUE, FALSE, 0, PartialLength);
250 }
252 {
253 Success = FALSE;
254 }
256
257 if (!Success)
258 {
259 CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
260 DPRINT1("Failed to read data: %lx!\n", Status);
261 goto Clear;
262 }
263
264 CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
265
266 Length -= PartialLength;
267 CurrentOffset += PartialLength;
268 }
269
270Clear:
271 /* See previous comment about private cache map */
273 PrivateCacheMap = FileObject->PrivateCacheMap;
274 if (PrivateCacheMap != NULL)
275 {
276 /* Mark read ahead as unactive */
278 InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, ~PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE);
280 }
282
283 /* If file was locked, release it */
284 if (Locked)
285 {
286 SharedCacheMap->Callbacks->ReleaseFromReadAhead(SharedCacheMap->LazyWriteContext);
287 }
288
289 /* And drop our extra reference (See: CcScheduleReadAhead) */
291
292 return;
293}
unsigned char BOOLEAN
UCHAR KIRQL
Definition: env_spec_w32.h:591
@ Success
Definition: eventcreate.c:712
#define ROUND_DOWN(n, align)
Definition: eventvwr.h:33
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define InterlockedAnd
Definition: interlocked.h:62
#define ASSERT(a)
Definition: mode.c:44
static void Clear(void)
Definition: treeview.c:386
#define min(a, b)
Definition: monoChain.cc:55
#define PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE
Definition: cctypes.h:64
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:209
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:574
NTSTATUS CcRosRequestVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:1008
BOOLEAN CcRosEnsureVacbResident(_In_ PROS_VACB Vacb, _In_ BOOLEAN Wait, _In_ BOOLEAN NoRead, _In_ ULONG Offset, _In_ ULONG Length)
Definition: view.c:910
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
Definition: ke.h:135
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
ULONG ReadAheadLength[2]
Definition: cctypes.h:82
LARGE_INTEGER ReadAheadOffset[2]
Definition: cctypes.h:81
KSPIN_LOCK ReadAheadSpinLock
Definition: cctypes.h:83
ULONG UlongFlags
Definition: cctypes.h:73
LARGE_INTEGER FileSize
Definition: cc.h:175
PCACHE_MANAGER_CALLBACKS Callbacks
Definition: cc.h:185
PVOID LazyWriteContext
Definition: cc.h:186
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define VACB_MAPPING_GRANULARITY
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ LockQueueMasterLock
Definition: ketypes.h:663
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by CcWorkerThread().

◆ CcPfInitializePrefetcher()

VOID NTAPI CcPfInitializePrefetcher ( VOID  )

Definition at line 114 of file fssup.c.

115{
116 /* Notify debugger */
119 "CCPF: InitializePrefetecher()\n");
120
121 /* Setup the Prefetcher Data */
125
126 /* FIXME: Setup the rest of the prefetecher */
127}
@ DPFLTR_PREFETCHER_ID
Definition: dpfilter.h:91
PFSN_PREFETCHER_GLOBALS CcPfGlobals
Definition: fssup.c:20
#define DPFLTR_TRACE_LEVEL
Definition: kdtypes.h:32
NTSYSAPI ULONG __cdecl DbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ _Printf_format_string_ PCSTR Format,...)
LIST_ENTRY ActiveTraces
Definition: cc.h:160
LIST_ENTRY CompletedTraces
Definition: cc.h:163
FAST_MUTEX CompletedTracesLock
Definition: cc.h:164

Referenced by Phase1InitializationDiscard().

◆ CcPostDeferredWrites()

VOID CcPostDeferredWrites ( VOID  )

Definition at line 73 of file copy.c.

74{
75 LIST_ENTRY ToInsertBack;
76
77 InitializeListHead(&ToInsertBack);
78
79 /* We'll try to write as much as we can */
80 while (TRUE)
81 {
82 PDEFERRED_WRITE DeferredWrite;
83 PLIST_ENTRY ListEntry;
84
85 DeferredWrite = NULL;
86
88
89 if (!ListEntry)
90 break;
91
92 DeferredWrite = CONTAINING_RECORD(ListEntry, DEFERRED_WRITE, DeferredWriteLinks);
93
94 /* Check if we can write */
95 if (CcCanIWrite(DeferredWrite->FileObject, DeferredWrite->BytesToWrite, FALSE, RetryForceCheckPerFile))
96 {
97 /* If we have an event, set it and go along */
98 if (DeferredWrite->Event)
99 {
100 KeSetEvent(DeferredWrite->Event, IO_NO_INCREMENT, FALSE);
101 }
102 /* Otherwise, call the write routine and free the context */
103 else
104 {
105 DeferredWrite->PostRoutine(DeferredWrite->Context1, DeferredWrite->Context2);
106 ExFreePoolWithTag(DeferredWrite, 'CcDw');
107 }
108 continue;
109 }
110
111 /* Keep it for later */
112 InsertHeadList(&ToInsertBack, &DeferredWrite->DeferredWriteLinks);
113
114 /* If we don't accept modified pages, stop here */
115 if (!DeferredWrite->LimitModifiedPages)
116 {
117 break;
118 }
119 }
120
121 /* Insert what we couldn't write back in the list */
122 while (!IsListEmpty(&ToInsertBack))
123 {
124 PLIST_ENTRY ListEntry = RemoveTailList(&ToInsertBack);
126 }
127}
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define RemoveTailList(ListHead)
Definition: env_spec_w32.h:975
PLIST_ENTRY NTAPI ExInterlockedInsertHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:114
PLIST_ENTRY NTAPI ExInterlockedRemoveHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:166
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
BOOLEAN NTAPI CcCanIWrite(IN PFILE_OBJECT FileObject, IN ULONG BytesToWrite, IN BOOLEAN Wait, IN BOOLEAN Retrying)
Definition: copy.c:300
@ RetryForceCheckPerFile
Definition: copy.c:27
PCC_POST_DEFERRED_WRITE PostRoutine
Definition: cctypes.h:175
PKEVENT Event
Definition: cctypes.h:174
ULONG BytesToWrite
Definition: cctypes.h:172
BOOLEAN LimitModifiedPages
Definition: cctypes.h:178
PVOID Context1
Definition: cctypes.h:176
PFILE_OBJECT FileObject
Definition: cctypes.h:171
PVOID Context2
Definition: cctypes.h:177
LIST_ENTRY DeferredWriteLinks
Definition: cctypes.h:173
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by CcCanIWrite(), CcDeferWrite(), and CcLazyWriteScan().

◆ CcPostWorkQueue()

VOID CcPostWorkQueue ( IN PWORK_QUEUE_ENTRY  WorkItem,
IN PLIST_ENTRY  WorkQueue 
)

Definition at line 53 of file lazywrite.c.

56{
58 PWORK_QUEUE_ITEM ThreadToSpawn;
59
60 /* First of all, insert the item in the queue */
62 InsertTailList(WorkQueue, &WorkItem->WorkQueueLinks);
63
64 /* Now, define whether we have to spawn a new work thread
65 * We will spawn a new one if:
66 * - There's no throttle in action
67 * - There's still at least one idle thread
68 */
69 ThreadToSpawn = NULL;
71 {
72 PLIST_ENTRY ListEntry;
73
74 /* Get the idle thread */
76 ThreadToSpawn = CONTAINING_RECORD(ListEntry, WORK_QUEUE_ITEM, List);
77
78 /* We're going to have one more! */
80 }
81
83
84 /* If we have a thread to spawn, do it! */
85 if (ThreadToSpawn != NULL)
86 {
87 /* We NULLify it to be consistent with initialization */
88 ThreadToSpawn->List.Flink = NULL;
89 ExQueueWorkItem(ThreadToSpawn, CriticalWorkQueue);
90 }
91}
#define InsertTailList(ListHead, Entry)
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
ULONG CcNumberActiveWorkerThreads
Definition: lazywrite.c:44
LIST_ENTRY CcIdleWorkerThreadList
Definition: lazywrite.c:41
BOOLEAN CcQueueThrottle
Definition: lazywrite.c:43
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY List
Definition: extypes.h:203
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
LIST_ENTRY WorkQueue
Definition: workqueue.c:16
@ CriticalWorkQueue
Definition: extypes.h:189
@ LockQueueWorkQueueLock
Definition: ketypes.h:666

Referenced by CcLazyWriteScan(), CcScanDpc(), and CcScheduleReadAhead().

◆ CcRosDereferenceCache()

VOID CcRosDereferenceCache ( PFILE_OBJECT  FileObject)

◆ CcRosEnsureVacbResident()

BOOLEAN CcRosEnsureVacbResident ( _In_ PROS_VACB  Vacb,
_In_ BOOLEAN  Wait,
_In_ BOOLEAN  NoRead,
_In_ ULONG  Offset,
_In_ ULONG  Length 
)

Definition at line 910 of file view.c.

917{
919
921
922#if 0
923 if ((Vacb->FileOffset.QuadPart + Offset) > Vacb->SharedCacheMap->SectionSize.QuadPart)
924 {
925 DPRINT1("Vacb read beyond the file size!\n");
926 return FALSE;
927 }
928#endif
929
930 BaseAddress = (PVOID)((ULONG_PTR)Vacb->BaseAddress + Offset);
931
932 /* Check if the pages are resident */
934 {
935 if (!Wait)
936 {
937 return FALSE;
938 }
939
940 if (!NoRead)
941 {
942 PROS_SHARED_CACHE_MAP SharedCacheMap = Vacb->SharedCacheMap;
943 NTSTATUS Status = MmMakeDataSectionResident(SharedCacheMap->FileObject->SectionObjectPointer,
944 Vacb->FileOffset.QuadPart + Offset,
945 Length,
946 &SharedCacheMap->ValidDataLength);
947 if (!NT_SUCCESS(Status))
949 }
950 }
951
952 return TRUE;
953}
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
BOOLEAN NTAPI MmArePagesResident(_In_ PEPROCESS Process, _In_ PVOID BaseAddress, _In_ ULONG Length)
Definition: section.c:4775
NTSTATUS NTAPI MmMakeDataSectionResident(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_ LONGLONG Offset, _In_ ULONG Length, _In_ PLARGE_INTEGER ValidDataLength)
Definition: section.c:4920
#define ExRaiseStatus
Definition: ntoskrnl.h:114
LARGE_INTEGER ValidDataLength
Definition: cc.h:178
PFILE_OBJECT FileObject
Definition: cc.h:179
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170

Referenced by CcCopyRead(), CcCopyWrite(), CcMapData(), CcPerformReadAhead(), CcpPinData(), and CcZeroData().

◆ CcRosFlushDirtyPages()

NTSTATUS CcRosFlushDirtyPages ( ULONG  Target,
PULONG  Count,
BOOLEAN  Wait,
BOOLEAN  CalledFromLazy 
)

Definition at line 308 of file view.c.

313{
314 PLIST_ENTRY current_entry;
317 BOOLEAN FlushAll = (Target == MAXULONG);
318
319 DPRINT("CcRosFlushDirtyPages(Target %lu)\n", Target);
320
321 (*Count) = 0;
322
325
326 current_entry = DirtyVacbListHead.Flink;
327 if (current_entry == &DirtyVacbListHead)
328 {
329 DPRINT("No Dirty pages\n");
330 }
331
332 while (((current_entry != &DirtyVacbListHead) && (Target > 0)) || FlushAll)
333 {
334 PROS_SHARED_CACHE_MAP SharedCacheMap;
337
338 if (current_entry == &DirtyVacbListHead)
339 {
340 ASSERT(FlushAll);
342 break;
343 current_entry = DirtyVacbListHead.Flink;
344 }
345
346 current = CONTAINING_RECORD(current_entry,
347 ROS_VACB,
348 DirtyVacbListEntry);
349 current_entry = current_entry->Flink;
350
352
353 SharedCacheMap = current->SharedCacheMap;
354
355 /* When performing lazy write, don't handle temporary files */
356 if (CalledFromLazy && BooleanFlagOn(SharedCacheMap->FileObject->Flags, FO_TEMPORARY_FILE))
357 {
359 continue;
360 }
361
362 /* Don't attempt to lazy write the files that asked not to */
363 if (CalledFromLazy && BooleanFlagOn(SharedCacheMap->Flags, WRITEBEHIND_DISABLED))
364 {
366 continue;
367 }
368
369 ASSERT(current->Dirty);
370
371 /* Do not lazy-write the same file concurrently. Fastfat ASSERTS on that */
372 if (SharedCacheMap->Flags & SHARED_CACHE_MAP_IN_LAZYWRITE)
373 {
375 continue;
376 }
377
378 SharedCacheMap->Flags |= SHARED_CACHE_MAP_IN_LAZYWRITE;
379
380 /* Keep a ref on the shared cache map */
381 SharedCacheMap->OpenCount++;
382
384
385 Locked = SharedCacheMap->Callbacks->AcquireForLazyWrite(SharedCacheMap->LazyWriteContext, Wait);
386 if (!Locked)
387 {
388 DPRINT("Not locked!");
389 ASSERT(!Wait);
392 SharedCacheMap->Flags &= ~SHARED_CACHE_MAP_IN_LAZYWRITE;
393
394 if (--SharedCacheMap->OpenCount == 0)
395 CcRosDeleteFileCache(SharedCacheMap->FileObject, SharedCacheMap, &OldIrql);
396
397 continue;
398 }
399
402
403 SharedCacheMap->Callbacks->ReleaseFromLazyWrite(SharedCacheMap->LazyWriteContext);
404
405 /* We release the VACB before acquiring the lock again, because
406 * CcRosVacbDecRefCount might free the VACB, as CcRosFlushVacb dropped a
407 * Refcount. Freeing must be done outside of the lock.
408 * The refcount is decremented atomically. So this is OK. */
411
412 SharedCacheMap->Flags &= ~SHARED_CACHE_MAP_IN_LAZYWRITE;
413
414 if (--SharedCacheMap->OpenCount == 0)
415 CcRosDeleteFileCache(SharedCacheMap->FileObject, SharedCacheMap, &OldIrql);
416
419 {
420 DPRINT1("CC: Failed to flush VACB.\n");
421 }
422 else
423 {
424 ULONG PagesFreed;
425
426 /* How many pages did we free? */
427 PagesFreed = Iosb.Information / PAGE_SIZE;
428 (*Count) += PagesFreed;
429
430 if (!Wait)
431 {
432 /* Make sure we don't overflow target! */
433 if (Target < PagesFreed)
434 {
435 /* If we would have, jump to zero directly */
436 Target = 0;
437 }
438 else
439 {
440 Target -= PagesFreed;
441 }
442 }
443 }
444
445 current_entry = DirtyVacbListHead.Flink;
446 }
447
450
451 DPRINT("CcRosFlushDirtyPages() finished\n");
452 return STATUS_SUCCESS;
453}
return Iosb
Definition: create.c:4402
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
struct task_struct * current
Definition: linux.c:32
static NTSTATUS CcRosDeleteFileCache(PFILE_OBJECT FileObject, PROS_SHARED_CACHE_MAP SharedCacheMap, PKIRQL OldIrql)
Definition: view.c:208
NTSTATUS CcRosFlushVacb(_In_ PROS_VACB Vacb, _Out_opt_ PIO_STATUS_BLOCK Iosb)
Definition: view.c:162
#define CcRosVacbIncRefCount(vacb)
Definition: cc.h:495
#define WRITEBEHIND_DISABLED
Definition: cc.h:202
#define SHARED_CACHE_MAP_IN_LAZYWRITE
Definition: cc.h:204
FORCEINLINE ULONG CcRosVacbDecRefCount(PROS_VACB vacb)
Definition: cc.h:498
#define STATUS_END_OF_FILE
Definition: shellext.h:67
#define STATUS_SUCCESS
Definition: shellext.h:65
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
ULONG OpenCount
Definition: cc.h:174
#define MAXULONG
Definition: typedefs.h:251
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
#define FO_TEMPORARY_FILE
Definition: iotypes.h:1791

Referenced by CcRosTrimCache(), CcWriteBehind(), and NtSetSystemPowerState().

◆ CcRosFlushVacb()

NTSTATUS CcRosFlushVacb ( _In_ PROS_VACB  Vacb,
_Out_opt_ PIO_STATUS_BLOCK  Iosb 
)

Definition at line 162 of file view.c.

165{
167 BOOLEAN HaveLock = FALSE;
168 PROS_SHARED_CACHE_MAP SharedCacheMap = Vacb->SharedCacheMap;
169
171
172 /* Lock for flush, if we are not already the top-level */
174 {
175 Status = FsRtlAcquireFileForCcFlushEx(Vacb->SharedCacheMap->FileObject);
176 if (!NT_SUCCESS(Status))
177 goto quit;
178 HaveLock = TRUE;
179 }
180
181 Status = MmFlushSegment(SharedCacheMap->FileObject->SectionObjectPointer,
182 &Vacb->FileOffset,
184 Iosb);
185
186 if (HaveLock)
187 {
188 FsRtlReleaseFileForCcFlush(Vacb->SharedCacheMap->FileObject);
189 }
190
191quit:
192 if (!NT_SUCCESS(Status))
193 CcRosMarkDirtyVacb(Vacb);
194 else
195 {
196 /* Update VDL */
197 if (SharedCacheMap->ValidDataLength.QuadPart < (Vacb->FileOffset.QuadPart + VACB_MAPPING_GRANULARITY))
198 {
199 SharedCacheMap->ValidDataLength.QuadPart = Vacb->FileOffset.QuadPart + VACB_MAPPING_GRANULARITY;
200 }
201 }
202
203 return Status;
204}
void quit(int argc, const char *argv[])
Definition: cmds.c:1606
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
VOID CcRosMarkDirtyVacb(PROS_VACB Vacb)
Definition: view.c:649
VOID CcRosUnmarkDirtyVacb(PROS_VACB Vacb, BOOLEAN LockViews)
Definition: view.c:685
NTSTATUS NTAPI FsRtlAcquireFileForCcFlushEx(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1692
VOID NTAPI FsRtlReleaseFileForCcFlush(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1765
NTSTATUS NTAPI MmFlushSegment(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER Offset, _In_ ULONG Length, _Out_opt_ PIO_STATUS_BLOCK Iosb)
Definition: section.c:4940
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843

Referenced by CcFlushCache(), and CcRosFlushDirtyPages().

◆ CcRosFreeOneUnusedVacb()

BOOLEAN CcRosFreeOneUnusedVacb ( VOID  )

Definition at line 720 of file view.c.

722{
723 KIRQL oldIrql;
724 PLIST_ENTRY current_entry;
725 PROS_VACB to_free = NULL;
726
728
729 /* Browse all the available VACB */
730 current_entry = VacbLruListHead.Flink;
731 while ((current_entry != &VacbLruListHead) && (to_free == NULL))
732 {
733 ULONG Refs;
735
736 current = CONTAINING_RECORD(current_entry,
737 ROS_VACB,
738 VacbLruListEntry);
739
740 KeAcquireSpinLockAtDpcLevel(&current->SharedCacheMap->CacheMapLock);
741
742 /* Only deal with unused VACB, we will free them */
744 if (Refs < 2)
745 {
746 ASSERT(!current->Dirty);
747 ASSERT(!current->MappedCount);
748 ASSERT(Refs == 1);
749
750 /* Reset it, this is the one we want to free */
751 RemoveEntryList(&current->CacheMapVacbListEntry);
752 InitializeListHead(&current->CacheMapVacbListEntry);
753 RemoveEntryList(&current->VacbLruListEntry);
754 InitializeListHead(&current->VacbLruListEntry);
755
756 to_free = current;
757 }
758
759 KeReleaseSpinLockFromDpcLevel(&current->SharedCacheMap->CacheMapLock);
760
761 current_entry = current_entry->Flink;
762 }
763
765
766 /* And now, free the VACB that we found, if any. */
767 if (to_free == NULL)
768 {
769 return FALSE;
770 }
771
772 /* This must be its last ref */
773 NT_VERIFY(CcRosVacbDecRefCount(to_free) == 0);
774
775 return TRUE;
776}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define CcRosVacbGetRefCount(vacb)
Definition: cc.h:510
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3287

Referenced by CcRosCreateVacb(), and CcWriteBehind().

◆ CcRosGetVacb()

NTSTATUS CcRosGetVacb ( PROS_SHARED_CACHE_MAP  SharedCacheMap,
LONGLONG  FileOffset,
PROS_VACB Vacb 
)

Definition at line 957 of file view.c.

961{
964 ULONG Refs;
966
967 ASSERT(SharedCacheMap);
968
969 DPRINT("CcRosGetVacb()\n");
970
971 /*
972 * Look for a VACB already mapping the same data.
973 */
974 current = CcRosLookupVacb(SharedCacheMap, FileOffset);
975 if (current == NULL)
976 {
977 /*
978 * Otherwise create a new VACB.
979 */
980 Status = CcRosCreateVacb(SharedCacheMap, FileOffset, &current);
981 if (!NT_SUCCESS(Status))
982 {
983 return Status;
984 }
985 }
986
988
990
991 /* Move to the tail of the LRU list */
992 RemoveEntryList(&current->VacbLruListEntry);
993 InsertTailList(&VacbLruListHead, &current->VacbLruListEntry);
994
996
997 /*
998 * Return the VACB to the caller.
999 */
1000 *Vacb = current;
1001
1002 ASSERT(Refs > 1);
1003
1004 return STATUS_SUCCESS;
1005}
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
PROS_VACB CcRosLookupVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset)
Definition: view.c:606
static NTSTATUS CcRosCreateVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:780

Referenced by CcCopyRead(), CcCopyWrite(), CcMapData(), CcpPinData(), CcRosRequestVacb(), and CcZeroData().

◆ CcRosInitializeFileCache()

NTSTATUS CcRosInitializeFileCache ( PFILE_OBJECT  FileObject,
PCC_FILE_SIZES  FileSizes,
BOOLEAN  PinAccess,
PCACHE_MANAGER_CALLBACKS  CallBacks,
PVOID  LazyWriterContext 
)

Definition at line 1260 of file view.c.

1269{
1270 KIRQL OldIrql;
1272 PROS_SHARED_CACHE_MAP SharedCacheMap;
1273
1274 DPRINT("CcRosInitializeFileCache(FileObject 0x%p)\n", FileObject);
1275
1277
1278 Allocated = FALSE;
1279 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
1280 if (SharedCacheMap == NULL)
1281 {
1282 Allocated = TRUE;
1283 SharedCacheMap = ExAllocateFromNPagedLookasideList(&SharedCacheMapLookasideList);
1284 if (SharedCacheMap == NULL)
1285 {
1287 }
1288 RtlZeroMemory(SharedCacheMap, sizeof(*SharedCacheMap));
1289 SharedCacheMap->NodeTypeCode = NODE_TYPE_SHARED_MAP;
1290 SharedCacheMap->NodeByteSize = sizeof(*SharedCacheMap);
1291 SharedCacheMap->FileObject = FileObject;
1292 SharedCacheMap->Callbacks = CallBacks;
1293 SharedCacheMap->LazyWriteContext = LazyWriterContext;
1294 SharedCacheMap->SectionSize = FileSizes->AllocationSize;
1295 SharedCacheMap->FileSize = FileSizes->FileSize;
1296 SharedCacheMap->ValidDataLength = FileSizes->ValidDataLength;
1297 SharedCacheMap->PinAccess = PinAccess;
1298 SharedCacheMap->DirtyPageThreshold = 0;
1299 SharedCacheMap->DirtyPages = 0;
1300 InitializeListHead(&SharedCacheMap->PrivateList);
1301 KeInitializeSpinLock(&SharedCacheMap->CacheMapLock);
1302 InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
1303 InitializeListHead(&SharedCacheMap->BcbList);
1304
1305 SharedCacheMap->Flags = SHARED_CACHE_MAP_IN_CREATION;
1306
1309 NULL,
1310 KernelMode);
1311
1312 FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;
1313
1314 //CcRosTraceCacheMap(SharedCacheMap, TRUE);
1315 }
1316 else if (SharedCacheMap->Flags & SHARED_CACHE_MAP_IN_CREATION)
1317 {
1318 /* The shared cache map is being created somewhere else. Wait for that to happen */
1319 KEVENT Waiter;
1320 PKEVENT PreviousWaiter = SharedCacheMap->CreateEvent;
1321
1323 SharedCacheMap->CreateEvent = &Waiter;
1324
1326
1328
1329 if (PreviousWaiter)
1330 KeSetEvent(PreviousWaiter, IO_NO_INCREMENT, FALSE);
1331
1333 }
1334
1335 if (FileObject->PrivateCacheMap == NULL)
1336 {
1337 PPRIVATE_CACHE_MAP PrivateMap;
1338
1339 /* Allocate the private cache map for this handle */
1340 if (SharedCacheMap->PrivateCacheMap.NodeTypeCode != 0)
1341 {
1343 }
1344 else
1345 {
1346 PrivateMap = &SharedCacheMap->PrivateCacheMap;
1347 }
1348
1349 if (PrivateMap == NULL)
1350 {
1351 /* If we also allocated the shared cache map for this file, kill it */
1352 if (Allocated)
1353 {
1354 RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks);
1355
1356 FileObject->SectionObjectPointer->SharedCacheMap = NULL;
1358 ExFreeToNPagedLookasideList(&SharedCacheMapLookasideList, SharedCacheMap);
1359 }
1360
1363 }
1364
1365 /* Initialize it */
1366 RtlZeroMemory(PrivateMap, sizeof(PRIVATE_CACHE_MAP));
1367 PrivateMap->NodeTypeCode = NODE_TYPE_PRIVATE_MAP;
1368 PrivateMap->ReadAheadMask = PAGE_SIZE - 1;
1369 PrivateMap->FileObject = FileObject;
1371
1372 /* Link it to the file */
1373 KeAcquireSpinLockAtDpcLevel(&SharedCacheMap->CacheMapLock);
1374 InsertTailList(&SharedCacheMap->PrivateList, &PrivateMap->PrivateLinks);
1376
1377 FileObject->PrivateCacheMap = PrivateMap;
1378 SharedCacheMap->OpenCount++;
1379 }
1380
1382
1383 /* Create the section */
1384 if (Allocated)
1385 {
1387
1388 ASSERT(SharedCacheMap->Section == NULL);
1389
1391 &SharedCacheMap->Section,
1393 NULL,
1394 &SharedCacheMap->SectionSize,
1397 NULL,
1398 FileObject);
1399
1401
1402 if (!NT_SUCCESS(Status))
1403 {
1405 return Status;
1406 }
1407
1409
1411 SharedCacheMap->Flags &= ~SHARED_CACHE_MAP_IN_CREATION;
1412
1413 if (SharedCacheMap->CreateEvent)
1414 {
1415 KeSetEvent(SharedCacheMap->CreateEvent, IO_NO_INCREMENT, FALSE);
1416 SharedCacheMap->CreateEvent = NULL;
1417 }
1418
1420 }
1421
1422 return STATUS_SUCCESS;
1423}
static CC_FILE_SIZES FileSizes
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define NonPagedPool
Definition: env_spec_w32.h:307
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
Definition: fatprocs.h:310
#define KernelMode
Definition: asm.h:34
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define SEC_RESERVE
Definition: nt_native.h:1323
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
@ NotificationEvent
NTSTATUS CcRosReleaseFileCache(PFILE_OBJECT FileObject)
Definition: view.c:1204
#define NODE_TYPE_PRIVATE_MAP
Definition: cc.h:287
#define SHARED_CACHE_MAP_IN_CREATION
Definition: cc.h:203
#define NODE_TYPE_SHARED_MAP
Definition: cc.h:288
NTSTATUS NTAPI ObReferenceObjectByPointer(IN PVOID Object, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode)
Definition: obref.c:381
NTSTATUS NTAPI MmCreateSection(OUT PVOID *Section, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL, IN PFILE_OBJECT FileObject OPTIONAL)
Definition: section.c:4620
LARGE_INTEGER FileSize
Definition: cctypes.h:16
LARGE_INTEGER ValidDataLength
Definition: cctypes.h:17
LARGE_INTEGER AllocationSize
Definition: cctypes.h:15
PFILE_OBJECT FileObject
Definition: cctypes.h:76
ULONG ReadAheadMask
Definition: cctypes.h:75
CSHORT NodeTypeCode
Definition: cctypes.h:71
LIST_ENTRY PrivateLinks
Definition: cctypes.h:84
LIST_ENTRY CacheMapVacbListHead
Definition: cc.h:193
PRIVATE_CACHE_MAP PrivateCacheMap
Definition: cc.h:190
KSPIN_LOCK CacheMapLock
Definition: cc.h:195
PKEVENT CreateEvent
Definition: cc.h:184
LIST_ENTRY SharedCacheMapLinks
Definition: cc.h:181
CSHORT NodeTypeCode
Definition: cc.h:172
ULONG DirtyPageThreshold
Definition: cc.h:188
ULONG DirtyPages
Definition: cc.h:180
LIST_ENTRY PrivateList
Definition: cc.h:187
LARGE_INTEGER SectionSize
Definition: cc.h:177
CSHORT NodeByteSize
Definition: cc.h:173
BOOLEAN PinAccess
Definition: cc.h:194
LIST_ENTRY BcbList
Definition: cc.h:176
#define TAG_PRIVATE_CACHE_MAP
Definition: tag.h:17
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
@ Executive
Definition: ketypes.h:415

Referenced by CcInitializeCacheMap().

◆ CcRosInternalFreeVacb()

NTSTATUS CcRosInternalFreeVacb ( IN PROS_VACB  Vacb)

Referenced by CcRosVacbDecRefCount().

◆ CcRosLookupVacb()

PROS_VACB CcRosLookupVacb ( PROS_SHARED_CACHE_MAP  SharedCacheMap,
LONGLONG  FileOffset 
)

Definition at line 606 of file view.c.

609{
610 PLIST_ENTRY current_entry;
612 KIRQL oldIrql;
613
614 ASSERT(SharedCacheMap);
615
616 DPRINT("CcRosLookupVacb(SharedCacheMap 0x%p, FileOffset %I64u)\n",
617 SharedCacheMap, FileOffset);
618
621
622 current_entry = SharedCacheMap->CacheMapVacbListHead.Flink;
623 while (current_entry != &SharedCacheMap->CacheMapVacbListHead)
624 {
625 current = CONTAINING_RECORD(current_entry,
626 ROS_VACB,
627 CacheMapVacbListEntry);
628 if (IsPointInRange(current->FileOffset.QuadPart,
630 FileOffset))
631 {
635 return current;
636 }
637 if (current->FileOffset.QuadPart > FileOffset)
638 break;
639 current_entry = current_entry->Flink;
640 }
641
644
645 return NULL;
646}
FORCEINLINE BOOLEAN IsPointInRange(_In_ LONGLONG Offset1, _In_ LONGLONG Length1, _In_ LONGLONG Point)
Definition: cc.h:461

Referenced by CcFlushCache(), and CcRosGetVacb().

◆ CcRosMarkDirtyVacb()

VOID CcRosMarkDirtyVacb ( PROS_VACB  Vacb)

Definition at line 649 of file view.c.

651{
652 KIRQL oldIrql;
653 PROS_SHARED_CACHE_MAP SharedCacheMap;
654
655 SharedCacheMap = Vacb->SharedCacheMap;
656
659
660 ASSERT(!Vacb->Dirty);
661
663 /* FIXME: There is no reason to account for the whole VACB. */
667
668 /* Move to the tail of the LRU list */
671
672 Vacb->Dirty = TRUE;
673
675
676 /* Schedule a lazy writer run to now that we have dirty VACB */
678 {
680 }
682}
VOID CcScheduleLazyWriteScan(IN BOOLEAN NoDelay)
Definition: lazywrite.c:210
LAZY_WRITER LazyWriter
Definition: lazywrite.c:37
ULONG CcTotalDirtyPages
Definition: view.c:56
BOOLEAN ScanActive
Definition: cc.h:246
BOOLEAN Dirty
Definition: cc.h:211
PROS_SHARED_CACHE_MAP SharedCacheMap
Definition: cc.h:226
LIST_ENTRY DirtyVacbListEntry
Definition: cc.h:218
LIST_ENTRY VacbLruListEntry
Definition: cc.h:220

Referenced by CcRosFlushVacb(), CcRosReleaseVacb(), and CcSetDirtyPinnedData().

◆ CcRosReferenceCache()

VOID CcRosReferenceCache ( PFILE_OBJECT  FileObject)

◆ CcRosReleaseFileCache()

NTSTATUS CcRosReleaseFileCache ( PFILE_OBJECT  FileObject)

Definition at line 1204 of file view.c.

1210{
1211 KIRQL OldIrql;
1212 PPRIVATE_CACHE_MAP PrivateMap;
1213 PROS_SHARED_CACHE_MAP SharedCacheMap;
1214
1216
1217 if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
1218 {
1219 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
1220
1221 /* Closing the handle, so kill the private cache map
1222 * Before you event try to remove it from FO, always
1223 * lock the master lock, to be sure not to race
1224 * with a potential read ahead ongoing!
1225 */
1226 PrivateMap = FileObject->PrivateCacheMap;
1227 FileObject->PrivateCacheMap = NULL;
1228
1229 if (PrivateMap != NULL)
1230 {
1231 /* Remove it from the file */
1232 KeAcquireSpinLockAtDpcLevel(&SharedCacheMap->CacheMapLock);
1233 RemoveEntryList(&PrivateMap->PrivateLinks);
1235
1236 /* And free it. */
1237 if (PrivateMap != &SharedCacheMap->PrivateCacheMap)
1238 {
1240 }
1241 else
1242 {
1243 PrivateMap->NodeTypeCode = 0;
1244 }
1245
1246 ASSERT(SharedCacheMap->OpenCount > 0);
1247
1248 SharedCacheMap->OpenCount--;
1249 if (SharedCacheMap->OpenCount == 0)
1250 {
1251 CcRosDeleteFileCache(FileObject, SharedCacheMap, &OldIrql);
1252 }
1253 }
1254 }
1256 return STATUS_SUCCESS;
1257}

Referenced by CcRosInitializeFileCache(), and CcUninitializeCacheMap().

◆ CcRosReleaseVacb()

NTSTATUS CcRosReleaseVacb ( PROS_SHARED_CACHE_MAP  SharedCacheMap,
PROS_VACB  Vacb,
BOOLEAN  Dirty,
BOOLEAN  Mapped 
)

Definition at line 574 of file view.c.

579{
580 ULONG Refs;
581 ASSERT(SharedCacheMap);
582
583 DPRINT("CcRosReleaseVacb(SharedCacheMap 0x%p, Vacb 0x%p)\n", SharedCacheMap, Vacb);
584
585 if (Dirty && !Vacb->Dirty)
586 {
587 CcRosMarkDirtyVacb(Vacb);
588 }
589
590 if (Mapped)
591 {
592 if (InterlockedIncrement((PLONG)&Vacb->MappedCount) == 1)
593 {
595 }
596 }
597
598 Refs = CcRosVacbDecRefCount(Vacb);
599 ASSERT(Refs > 0);
600
601 return STATUS_SUCCESS;
602}
#define InterlockedIncrement
Definition: armddk.h:53
ULONG MappedCount
Definition: cc.h:214
int32_t * PLONG
Definition: typedefs.h:58

Referenced by CcCopyRead(), CcCopyWrite(), CcFlushCache(), CcMapData(), CcpDereferenceBcb(), CcPerformReadAhead(), CcpGetAppropriateBcb(), CcpPinData(), CcUnpinRepinnedBcb(), and CcZeroData().

◆ CcRosRequestVacb()

NTSTATUS CcRosRequestVacb ( PROS_SHARED_CACHE_MAP  SharedCacheMap,
LONGLONG  FileOffset,
PROS_VACB Vacb 
)

Definition at line 1008 of file view.c.

1015{
1016
1017 ASSERT(SharedCacheMap);
1018
1020 {
1021 DPRINT1("Bad fileoffset %I64x should be multiple of %x",
1023 KeBugCheck(CACHE_MANAGER);
1024 }
1025
1026 return CcRosGetVacb(SharedCacheMap,
1027 FileOffset,
1028 Vacb);
1029}
NTSTATUS CcRosGetVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:957

Referenced by CcPerformReadAhead().

◆ CcRosUnmarkDirtyVacb()

VOID CcRosUnmarkDirtyVacb ( PROS_VACB  Vacb,
BOOLEAN  LockViews 
)

Definition at line 685 of file view.c.

688{
689 KIRQL oldIrql;
690 PROS_SHARED_CACHE_MAP SharedCacheMap;
691
692 SharedCacheMap = Vacb->SharedCacheMap;
693
694 if (LockViews)
695 {
698 }
699
700 ASSERT(Vacb->Dirty);
701
702 Vacb->Dirty = FALSE;
703
706
709
711
712 if (LockViews)
713 {
716 }
717}

Referenced by CcPurgeCacheSection(), CcRosDeleteFileCache(), and CcRosFlushVacb().

◆ CcRosVacbDecRefCount()

FORCEINLINE ULONG CcRosVacbDecRefCount ( PROS_VACB  vacb)

Definition at line 498 of file cc.h.

500{
501 ULONG Refs;
502
504 if (Refs == 0)
505 {
507 }
508 return Refs;
509}
#define InterlockedDecrement
Definition: armddk.h:52
NTSTATUS CcRosInternalFreeVacb(IN PROS_VACB Vacb)
volatile ULONG ReferenceCount
Definition: cc.h:224

Referenced by CcPurgeCacheSection(), CcRosCreateVacb(), CcRosDeleteFileCache(), CcRosFlushDirtyPages(), CcRosFreeOneUnusedVacb(), CcRosReleaseVacb(), CcRosTrimCache(), and CcRosUnmarkDirtyVacb().

◆ CcScanDpc()

VOID NTAPI CcScanDpc ( PKDPC  Dpc,
PVOID  DeferredContext,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)

◆ CcScheduleLazyWriteScan()

VOID CcScheduleLazyWriteScan ( BOOLEAN  NoDelay)

◆ CcShutdownLazyWriter()

VOID NTAPI CcShutdownLazyWriter ( VOID  )

◆ CcShutdownSystem()

VOID NTAPI CcShutdownSystem ( VOID  )

Definition at line 299 of file cachesub.c.

300{
301 ULONG i, Result;
303
304 DPRINT1("CC: Shutdown\n");
305
306 for (i = 0; i < CACHE_NUM_SECTIONS; i++)
307 {
309 if (Bcb->SectionObject)
310 {
311 DPRINT1("Evicting #%02x %08x%08x %wZ\n",
312 i,
313 Bcb->FileOffset.u.HighPart,
314 Bcb->FileOffset.u.LowPart,
315 &MmGetFileObjectForSection((PROS_SECTION_OBJECT)Bcb->SectionObject)->FileName);
316
317 CcpFlushCache(Bcb->Map, NULL, 0, NULL, TRUE);
318 Bcb->Dirty = FALSE;
319 }
320 }
321
322 /* Evict all section pages */
323 Status = MiRosTrimCache(~0, 0, &Result);
324
325 DPRINT1("Done (Evicted %d, Status %x)\n", Result, Status);
326}
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:414
#define CcpFlushCache(M, F, L, I, D)
Definition: newcc.h:91
NTSTATUS MiRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: swapout.c:633
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1737
Definition: newcc.h:4
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by PopGracefulShutdown().

◆ CcWorkerThread()

VOID NTAPI CcWorkerThread ( PVOID  Parameter)

◆ DoRangesIntersect()

FORCEINLINE BOOLEAN DoRangesIntersect ( _In_ LONGLONG  Offset1,
_In_ LONGLONG  Length1,
_In_ LONGLONG  Offset2,
_In_ LONGLONG  Length2 
)

Definition at line 446 of file cc.h.

451{
452 if (Offset1 + Length1 <= Offset2)
453 return FALSE;
454 if (Offset2 + Length2 <= Offset1)
455 return FALSE;
456 return TRUE;
457}
INT Offset2
Definition: FsRtlDissect.c:14
INT Offset1
Definition: FsRtlDissect.c:13
INT Length2
Definition: FsRtlDissect.c:16
INT Length1
Definition: FsRtlDissect.c:15

Referenced by IsPointInRange().

◆ IsPointInRange()

FORCEINLINE BOOLEAN IsPointInRange ( _In_ LONGLONG  Offset1,
_In_ LONGLONG  Length1,
_In_ LONGLONG  Point 
)

Definition at line 461 of file cc.h.

465{
467}
FORCEINLINE BOOLEAN DoRangesIntersect(_In_ LONGLONG Offset1, _In_ LONGLONG Length1, _In_ LONGLONG Offset2, _In_ LONGLONG Length2)
Definition: cc.h:446

Referenced by CcRosCreateVacb(), and CcRosLookupVacb().

Variable Documentation

◆ CcDataFlushes

ULONG CcDataFlushes
extern

Definition at line 44 of file copy.c.

Referenced by IoSynchronousPageWrite(), and QSI_DEF().

◆ CcDataPages

ULONG CcDataPages
extern

Definition at line 43 of file copy.c.

Referenced by IoSynchronousPageWrite(), and QSI_DEF().

◆ CcDeferredWrites

LIST_ENTRY CcDeferredWrites
extern

◆ CcDeferredWriteSpinLock

KSPIN_LOCK CcDeferredWriteSpinLock
extern

Definition at line 58 of file view.c.

Referenced by CcCanIWrite(), CcDeferWrite(), CcInitView(), and CcPostDeferredWrites().

◆ CcDirtyPageThreshold

ULONG CcDirtyPageThreshold
extern

Definition at line 55 of file view.c.

Referenced by CcCanIWrite(), and CcInitializeCacheManager().

◆ CcExpressWorkQueue

LIST_ENTRY CcExpressWorkQueue
extern

Definition at line 39 of file lazywrite.c.

Referenced by CcInitializeCacheManager(), CcScheduleReadAhead(), and CcWorkerThread().

◆ CcIdleDelay

LARGE_INTEGER CcIdleDelay
extern

Definition at line 46 of file lazywrite.c.

Referenced by CcCanIWrite(), and CcScheduleLazyWriteScan().

◆ CcIdleWorkerThreadList

LIST_ENTRY CcIdleWorkerThreadList
extern

Definition at line 41 of file lazywrite.c.

Referenced by CcInitializeCacheManager(), CcPostWorkQueue(), and CcWorkerThread().

◆ CcLazyWriteIos

ULONG CcLazyWriteIos
extern

Definition at line 21 of file lazywrite.c.

Referenced by CcWriteBehind(), and QSI_DEF().

◆ CcLazyWritePages

ULONG CcLazyWritePages
extern

Definition at line 20 of file lazywrite.c.

Referenced by CcWriteBehind(), and QSI_DEF().

◆ CcMapDataNoWait

ULONG CcMapDataNoWait
extern

Definition at line 29 of file pin.c.

Referenced by CcMapData(), and QSI_DEF().

◆ CcMapDataWait

ULONG CcMapDataWait
extern

Definition at line 28 of file pin.c.

Referenced by CcMapData(), and QSI_DEF().

◆ CcNumberWorkerThreads

ULONG CcNumberWorkerThreads
extern

Definition at line 48 of file lazywrite.c.

Referenced by CcInitializeCacheManager().

◆ CcPinMappedDataCount

ULONG CcPinMappedDataCount
extern

Definition at line 32 of file pin.c.

Referenced by CcPinMappedData(), and QSI_DEF().

◆ CcPinReadNoWait

ULONG CcPinReadNoWait
extern

Definition at line 31 of file pin.c.

Referenced by CcPinRead(), and QSI_DEF().

◆ CcPinReadWait

ULONG CcPinReadWait
extern

Definition at line 30 of file pin.c.

Referenced by CcPinRead(), and QSI_DEF().

◆ CcPostTickWorkQueue

LIST_ENTRY CcPostTickWorkQueue
extern

◆ CcRegularWorkQueue

LIST_ENTRY CcRegularWorkQueue
extern

Definition at line 40 of file lazywrite.c.

Referenced by CcInitializeCacheManager(), CcLazyWriteScan(), CcScanDpc(), and CcWorkerThread().

◆ CcRosTraceLevel

ULONG CcRosTraceLevel
extern

Definition at line 31 of file copy.c.

◆ CcTotalDirtyPages

ULONG CcTotalDirtyPages
extern

◆ CcTwilightLookasideList

◆ DirtyVacbListHead

LIST_ENTRY DirtyVacbListHead
extern

Definition at line 41 of file view.c.

Referenced by CcInitView(), CcIsThereDirtyData(), CcRosFlushDirtyPages(), and CcRosMarkDirtyVacb().

◆ LazyWriter