ReactOS  0.4.14-dev-583-g2a1ba2c
cachesub.c File Reference
#include <ntoskrnl.h>
#include "newcc.h"
#include "section/newmm.h"
#include <debug.h>
Include dependency graph for cachesub.c:

Go to the source code of this file.

Classes

struct  _WORK_QUEUE_WITH_READ_AHEAD
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _WORK_QUEUE_WITH_READ_AHEAD WORK_QUEUE_WITH_READ_AHEAD
 
typedef struct _WORK_QUEUE_WITH_READ_AHEADPWORK_QUEUE_WITH_READ_AHEAD
 

Functions

PDEVICE_OBJECT NTAPI MmGetDeviceObjectForFile (IN PFILE_OBJECT FileObject)
 
VOID NTAPI CcSetReadAheadGranularity (IN PFILE_OBJECT FileObject, IN ULONG Granularity)
 
VOID NTAPI CcpReadAhead (PVOID Context)
 
VOID NTAPI CcScheduleReadAhead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length)
 
VOID NTAPI CcSetDirtyPinnedData (IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
 
LARGE_INTEGER NTAPI CcGetFlushedValidData (IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN BOOLEAN CcInternalCaller)
 
VOID NTAPI _CcpFlushCache (IN PNOCC_CACHE_MAP Map, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus, BOOLEAN Delete, const char *File, int Line)
 
VOID NTAPI CcFlushCache (IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
 
BOOLEAN NTAPI CcFlushImageSection (PSECTION_OBJECT_POINTERS SectionObjectPointer, MMFLUSH_TYPE FlushType)
 
PVOID NTAPI CcRemapBcb (IN PVOID Bcb)
 
VOID NTAPI CcShutdownSystem (VOID)
 
VOID NTAPI CcRepinBcb (IN PVOID Bcb)
 
VOID NTAPI CcUnpinRepinnedBcb (IN PVOID Bcb, IN BOOLEAN WriteThrough, OUT PIO_STATUS_BLOCK IoStatus)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 15 of file cachesub.c.

Typedef Documentation

◆ PWORK_QUEUE_WITH_READ_AHEAD

◆ WORK_QUEUE_WITH_READ_AHEAD

Function Documentation

◆ _CcpFlushCache()

VOID NTAPI _CcpFlushCache ( IN PNOCC_CACHE_MAP  Map,
IN OPTIONAL PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
OUT OPTIONAL PIO_STATUS_BLOCK  IoStatus,
BOOLEAN  Delete,
const char File,
int  Line 
)

Definition at line 142 of file cachesub.c.

149 {
150  PNOCC_BCB Bcb = NULL;
151  LARGE_INTEGER LowerBound, UpperBound;
152  PLIST_ENTRY ListEntry;
153  IO_STATUS_BLOCK IOSB;
154 
155  RtlZeroMemory(&IOSB, sizeof(IO_STATUS_BLOCK));
156 
157  DPRINT("CcFlushCache (while file) (%s:%d)\n", File, Line);
158 
159  if (FileOffset && Length)
160  {
161  LowerBound.QuadPart = FileOffset->QuadPart;
162  UpperBound.QuadPart = LowerBound.QuadPart + Length;
163  }
164  else
165  {
166  LowerBound.QuadPart = 0;
167  UpperBound.QuadPart = 0x7fffffffffffffffull;
168  }
169 
170  CcpLock();
171  ListEntry = Map->AssociatedBcb.Flink;
172 
173  while (ListEntry != &Map->AssociatedBcb)
174  {
175  Bcb = CONTAINING_RECORD(ListEntry, NOCC_BCB, ThisFileList);
177 
178  if (Bcb->FileOffset.QuadPart + Bcb->Length >= LowerBound.QuadPart &&
179  Bcb->FileOffset.QuadPart < UpperBound.QuadPart)
180  {
181  DPRINT("Bcb #%x (@%08x%08x)\n",
183  Bcb->FileOffset.u.HighPart, Bcb->FileOffset.u.LowPart);
184 
185  Bcb->RefCount++;
186  CcpUnlock();
187  MiFlushMappedSection(Bcb->BaseAddress,
188  &Bcb->FileOffset,
189  &Map->FileSizes.FileSize,
190  Bcb->Dirty);
191  CcpLock();
192  Bcb->RefCount--;
193 
194  Bcb->Dirty = FALSE;
195 
196  ListEntry = ListEntry->Flink;
197  if (Delete && Bcb->RefCount < 2)
198  {
199  Bcb->RefCount = 1;
201  }
202  else
203  {
205  }
206  }
207  else
208  {
209  ListEntry = ListEntry->Flink;
211  }
212 
213  DPRINT("End loop\n");
214  }
215  CcpUnlock();
216 
217  if (IoStatus) *IoStatus = IOSB;
218 }
BOOLEAN NTAPI CcpUnpinData(PNOCC_BCB Bcb, BOOLEAN ActuallyRelease)
#define TRUE
Definition: types.h:120
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define CcpLock()
Definition: newcc.h:143
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
VOID CcpReferenceCache(ULONG Sector)
Definition: pinsup.c:368
Definition: newcc.h:3
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define MiFlushMappedSection(A, O, S, D)
Definition: newmm.h:402
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Definition: ncftp.h:79
Definition: typedefs.h:117
VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate)
Definition: pinsup.c:213
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define CcpUnlock()
Definition: newcc.h:144
Definition: File.h:15
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
LONGLONG QuadPart
Definition: typedefs.h:112

◆ CcFlushCache()

VOID NTAPI CcFlushCache ( IN PSECTION_OBJECT_POINTERS  SectionObjectPointer,
IN OPTIONAL PLARGE_INTEGER FileOffset  ,
IN ULONG  Length,
OUT OPTIONAL PIO_STATUS_BLOCK  IoStatus 
)

Definition at line 222 of file cachesub.c.

226 {
228 
229  /* Not cached */
230  if (!Map)
231  {
232  if (IoStatus)
233  {
234  IoStatus->Status = STATUS_SUCCESS;
235  IoStatus->Information = 0;
236  }
237  return;
238  }
239 
241 }
#define TRUE
Definition: types.h:120
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define CcpFlushCache(M, F, L, I, D)
Definition: newcc.h:96
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1368
if(!(yy_init))
Definition: macro.lex.yy.c:714
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP

Referenced by _Dispatch_type_(), _Requires_lock_held_(), CcFlushImageSection(), ExeFmtpReadFile(), Ext2Cleanup(), Ext2CreateFile(), Ext2FloppyFlush(), Ext2FlushFile(), Ext2FlushRange(), Ext2FlushVcb(), Ext2PurgeFile(), Ext2PurgeVolume(), Ext2ReadFile(), Ext2TearDownStream(), Ext2WriteFile(), Ext2WriteVolume(), FatCloseEaFile(), FatCommonSetEa(), FatDeferredFlush(), FatFlushDirentForFile(), FatFlushFatEntries(), FFSCleanup(), FFSCreateFile(), FFSFloppyFlush(), FFSFlushFile(), FFSFlushVolume(), FFSFreeVcb(), FFSPurgeFile(), FFSPurgeVolume(), FFSv1WriteInode(), FFSWriteFile(), FFSWriteVolume(), flush_fcb_caches(), flush_subvol_fcbs(), RfsdCleanup(), RfsdCreateFile(), RfsdFloppyFlush(), RfsdFlushFile(), RfsdFlushVolume(), RfsdFreeVcb(), RfsdPurgeFile(), RfsdPurgeVolume(), RfsdWriteFile(), RfsdWriteVolume(), RxCommonRead(), RxCommonWrite(), RxFlushFcbInSystemCache(), set_rename_information(), set_zero_data(), TestIrpHandler(), UDFCloseAllXXXDelayedInDir(), UDFCommonCleanup(), UDFCommonCreate(), UDFCommonRead(), UDFCommonWrite(), UDFFlushAFile(), UDFPurgeCacheEx_(), VfatFlushFile(), VfatMoveEntry(), vfatRenameEntry(), vfatUpdateFCB(), and write_file2().

◆ CcFlushImageSection()

BOOLEAN NTAPI CcFlushImageSection ( PSECTION_OBJECT_POINTERS  SectionObjectPointer,
MMFLUSH_TYPE  FlushType 
)

Definition at line 245 of file cachesub.c.

247 {
249  PNOCC_BCB Bcb;
251  IO_STATUS_BLOCK IOSB;
252  BOOLEAN Result = TRUE;
253 
254  if (!Map) return TRUE;
255 
256  for (Entry = Map->AssociatedBcb.Flink;
257  Entry != &Map->AssociatedBcb;
258  Entry = Entry->Flink)
259  {
260  Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList);
261 
262  if (!Bcb->Dirty) continue;
263 
264  switch (FlushType)
265  {
266  case MmFlushForDelete:
268  &Bcb->FileOffset,
269  Bcb->Length,
270  FALSE);
271  break;
272  case MmFlushForWrite:
274  &Bcb->FileOffset,
275  Bcb->Length,
276  &IOSB);
277  break;
278  }
279  }
280 
281  return Result;
282 }
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define TRUE
Definition: types.h:120
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
Definition: newcc.h:3
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1368
unsigned char BOOLEAN
_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:426
LIST_ENTRY AssociatedBcb
Definition: newcc.h:29
IN PFCB IN FAT_FLUSH_TYPE FlushType
Definition: fatprocs.h:1071
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP

◆ CcGetFlushedValidData()

LARGE_INTEGER NTAPI CcGetFlushedValidData ( IN PSECTION_OBJECT_POINTERS  SectionObjectPointer,
IN BOOLEAN  CcInternalCaller 
)

Definition at line 130 of file cachesub.c.

132 {
133  LARGE_INTEGER Result = {{0}};
135  return Result;
136 }
_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:426
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by PerformTest().

◆ CcpReadAhead()

VOID NTAPI CcpReadAhead ( PVOID  Context)

Definition at line 48 of file cachesub.c.

49 {
52  PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)WorkItem->FileObject->SectionObjectPointer->SharedCacheMap;
53 
54  DPRINT1("Reading ahead %08x%08x:%x %wZ\n",
55  WorkItem->FileOffset.HighPart,
56  WorkItem->FileOffset.LowPart,
57  WorkItem->Length,
58  &WorkItem->FileObject->FileName);
59 
60  Offset.HighPart = WorkItem->FileOffset.HighPart;
61  Offset.LowPart = PAGE_ROUND_DOWN(WorkItem->FileOffset.LowPart);
62  if (Map)
63  {
64  PLIST_ENTRY ListEntry;
65  volatile char *chptr;
66  PNOCC_BCB Bcb;
67  for (ListEntry = Map->AssociatedBcb.Flink;
68  ListEntry != &Map->AssociatedBcb;
69  ListEntry = ListEntry->Flink)
70  {
71  Bcb = CONTAINING_RECORD(ListEntry, NOCC_BCB, ThisFileList);
72  if ((Offset.QuadPart + WorkItem->Length < Bcb->FileOffset.QuadPart) ||
73  (Bcb->FileOffset.QuadPart + Bcb->Length < Offset.QuadPart))
74  continue;
75  for (chptr = Bcb->BaseAddress, Offset = Bcb->FileOffset;
76  chptr < ((PCHAR)Bcb->BaseAddress) + Bcb->Length &&
77  Offset.QuadPart <
78  WorkItem->FileOffset.QuadPart + WorkItem->Length;
79  chptr += PAGE_SIZE, Offset.QuadPart += PAGE_SIZE)
80  {
81  *chptr ^= 0;
82  }
83  }
84  }
86  ExFreePool(WorkItem);
87  DPRINT("Done\n");
88 }
signed char * PCHAR
Definition: retypes.h:7
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define PAGE_ROUND_DOWN(x)
Definition: mmtypes.h:36
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
Definition: newcc.h:3
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PFILE_OBJECT FileObject
Definition: cachesub.c:23
LARGE_INTEGER FileOffset
Definition: cachesub.c:24
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY AssociatedBcb
Definition: newcc.h:29
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ULONG LowPart
Definition: typedefs.h:104
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Definition: typedefs.h:117
struct _WORK_QUEUE_WITH_READ_AHEAD * PWORK_QUEUE_WITH_READ_AHEAD
#define DPRINT1
Definition: precomp.h:8
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
LONGLONG QuadPart
Definition: typedefs.h:112
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP

Referenced by CcScheduleReadAhead().

◆ CcRemapBcb()

PVOID NTAPI CcRemapBcb ( IN PVOID  Bcb)

Definition at line 287 of file cachesub.c.

288 {
290  CcpLock();
293  CcpUnlock();
294  return Bcb;
295 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define CcpLock()
Definition: newcc.h:143
VOID CcpReferenceCache(ULONG Sector)
Definition: pinsup.c:368
Definition: newcc.h:3
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
_Must_inspect_result_ NTSYSAPI BOOLEAN NTAPI RtlTestBit(_In_ PRTL_BITMAP BitMapHeader, _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber)
Definition: bitmap.c:434
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
unsigned int ULONG
Definition: retypes.h:1
#define CcpUnlock()
Definition: newcc.h:144

◆ CcRepinBcb()

VOID NTAPI CcRepinBcb ( IN PVOID  Bcb)

Definition at line 331 of file cachesub.c.

332 {
334  CcpLock();
336  DPRINT("CcRepinBcb(#%x)\n", Number);
338  CcpUnlock();
339 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define CcpLock()
Definition: newcc.h:143
VOID CcpReferenceCache(ULONG Sector)
Definition: pinsup.c:368
Definition: newcc.h:3
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ NTSYSAPI BOOLEAN NTAPI RtlTestBit(_In_ PRTL_BITMAP BitMapHeader, _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber)
Definition: bitmap.c:434
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
unsigned int ULONG
Definition: retypes.h:1
#define CcpUnlock()
Definition: newcc.h:144

Referenced by FatFlushFat(), FatRepinBcb(), FFSRepinBcb(), and RfsdRepinBcb().

◆ CcScheduleReadAhead()

VOID NTAPI CcScheduleReadAhead ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length 
)

Definition at line 92 of file cachesub.c.

95 {
97 
98  DPRINT("Schedule read ahead %08x%08x:%x %wZ\n",
99  FileOffset->HighPart,
100  FileOffset->LowPart,
101  Length,
102  &FileObject->FileName);
103 
104  WorkItem = ExAllocatePool(NonPagedPool, sizeof(*WorkItem));
105  if (!WorkItem) KeBugCheck(0);
107  WorkItem->FileObject = FileObject;
108  WorkItem->FileOffset = *FileOffset;
109  WorkItem->Length = Length;
110 
111  ExInitializeWorkItem(&WorkItem->WorkItem,
113  WorkItem);
114 
116  DPRINT("Done\n");
117 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
VOID NTAPI CcpReadAhead(PVOID Context)
Definition: cachesub.c:48
WORK_QUEUE_ITEM WorkItem
Definition: cachesub.c:22
PFILE_OBJECT FileObject
Definition: cachesub.c:23
LARGE_INTEGER FileOffset
Definition: cachesub.c:24
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1507
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
#define ObReferenceObject
Definition: obfuncs.h:204
WORKER_THREAD_ROUTINE * PWORKER_THREAD_ROUTINE
Definition: extypes.h:200

Referenced by CcCopyData().

◆ CcSetDirtyPinnedData()

◆ CcSetReadAheadGranularity()

VOID NTAPI CcSetReadAheadGranularity ( IN PFILE_OBJECT  FileObject,
IN ULONG  Granularity 
)

Definition at line 36 of file cachesub.c.

38 {
39  PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap;
40  if (Map)
41  {
42  Map->ReadAheadGranularity = Granularity;
43  }
44 }
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
if(!(yy_init))
Definition: macro.lex.yy.c:714
ULONG ReadAheadGranularity
Definition: newcc.h:38
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP

Referenced by _Requires_lock_held_(), Ext2ReadFile(), Ext2WriteFile(), FFSWriteFile(), init_file_cache(), RfsdWriteFile(), RxCommonRead(), RxCommonWrite(), UDFCommonRead(), and UDFCommonWrite().

◆ 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 }
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1681
#define TRUE
Definition: types.h:120
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define CACHE_NUM_SECTIONS
Definition: newcc.h:130
LONG NTSTATUS
Definition: precomp.h:26
#define CcpFlushCache(M, F, L, I, D)
Definition: newcc.h:96
NTSTATUS MiRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: swapout.c:633
Definition: newcc.h:3
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
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
smooth NULL
Definition: ftsmooth.c:416
_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:426
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by PopGracefulShutdown().

◆ CcUnpinRepinnedBcb()

VOID NTAPI CcUnpinRepinnedBcb ( IN PVOID  Bcb,
IN BOOLEAN  WriteThrough,
OUT PIO_STATUS_BLOCK  IoStatus 
)

Definition at line 343 of file cachesub.c.

346 {
347  PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb;
348 
349  if (WriteThrough)
350  {
351  DPRINT("BCB #%x\n", RealBcb - CcCacheSections);
352 
353  CcpFlushCache(RealBcb->Map,
354  &RealBcb->FileOffset,
355  RealBcb->Length,
356  IoStatus,
357  RealBcb->Dirty);
358  }
359 
360  CcUnpinData(Bcb);
361 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
ULONG Length
Definition: newcc.h:11
#define CcpFlushCache(M, F, L, I, D)
Definition: newcc.h:96
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pinsup.c:955
Definition: newcc.h:3
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
BOOLEAN Dirty
Definition: newcc.h:13
void DPRINT(...)
Definition: polytest.cpp:61
LARGE_INTEGER FileOffset
Definition: newcc.h:10
struct _NOCC_CACHE_MAP * Map
Definition: newcc.h:8
struct _NOCC_BCB * PNOCC_BCB

Referenced by FatFlushFat(), FatUnpinRepinnedBcbs(), FFSUnpinRepinnedBcbs(), and RfsdUnpinRepinnedBcbs().

◆ MmGetDeviceObjectForFile()

PDEVICE_OBJECT NTAPI MmGetDeviceObjectForFile ( IN PFILE_OBJECT  FileObject)

Definition at line 62 of file io.c.

63 {
65 }
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593