NTSTATUS NTAPI MmMpwThreadMain(PVOID Ignored) { NTSTATUS Status; ULONG PagesWritten; LARGE_INTEGER Timeout; Timeout.QuadPart = -50000000; for(;;) { Status = KeWaitForSingleObject(&MpwThreadEvent, 0, KernelMode, FALSE, &Timeout); if (!NT_SUCCESS(Status)) { DbgPrint("MpwThread: Wait failed\n"); KeBugCheck(MEMORY_MANAGEMENT); return(STATUS_UNSUCCESSFUL); } PagesWritten = 0; #ifndef NEWCC // XXX arty -- we flush when evicting pages or destorying cache // sections. CcRosFlushDirtyPages(128, &PagesWritten); #endif } }
VOID CcWriteBehind(VOID) { ULONG Target, Count; Target = CcTotalDirtyPages / 8; if (Target != 0) { /* Flush! */ DPRINT("Lazy writer starting (%d)\n", Target); CcRosFlushDirtyPages(Target, &Count, FALSE, TRUE); /* And update stats */ CcLazyWritePages += Count; ++CcLazyWriteIos; DPRINT("Lazy writer done (%d)\n", Count); } }
VOID NTAPI MmMpwThreadMain(PVOID Parameter) { NTSTATUS Status; #ifndef NEWCC ULONG PagesWritten; #endif LARGE_INTEGER Timeout; UNREFERENCED_PARAMETER(Parameter); Timeout.QuadPart = -50000000; for(;;) { Status = KeWaitForSingleObject(&MpwThreadEvent, 0, KernelMode, FALSE, &Timeout); if (!NT_SUCCESS(Status)) { DbgPrint("MpwThread: Wait failed\n"); KeBugCheck(MEMORY_MANAGEMENT); return; } #ifndef NEWCC PagesWritten = 0; // XXX arty -- we flush when evicting pages or destorying cache // sections. CcRosFlushDirtyPages(128, &PagesWritten, FALSE); #endif } }