From 40ab546697c42fd1e93215647d6a3b7505b1fbf1 Mon Sep 17 00:00:00 2001 From: Thamatip Chitpong Date: Tue, 22 Oct 2024 13:00:20 +0700 Subject: [PATCH] [NTOS:CC] Remove dirty VACB list and related code --- ntoskrnl/cc/view.c | 23 ++++++++--------------- ntoskrnl/include/internal/cc.h | 6 ------ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 7260dd8f420e0..0d19ccdcb5447 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -38,7 +38,6 @@ /* GLOBALS *******************************************************************/ -LIST_ENTRY DirtyVacbListHead; static LIST_ENTRY VacbLruListHead; NPAGED_LOOKASIDE_LIST iBcbLookasideList; @@ -68,8 +67,8 @@ ULONG CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line) Refs = InterlockedIncrement((PLONG)&vacb->ReferenceCount); if (vacb->SharedCacheMap->Trace) { - DbgPrint("(%s:%i) VACB %p ++RefCount=%lu, Dirty %u, PageOut %lu\n", - file, line, vacb, Refs, vacb->Dirty, vacb->PageOut); + DbgPrint("(%s:%i) VACB %p ++RefCount=%lu, PageOut %lu\n", + file, line, vacb, Refs, vacb->PageOut); } return Refs; @@ -77,16 +76,14 @@ ULONG CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line) ULONG CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line) { ULONG Refs; - BOOLEAN VacbDirty = vacb->Dirty; BOOLEAN VacbTrace = vacb->SharedCacheMap->Trace; BOOLEAN VacbPageOut = vacb->PageOut; Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount); - ASSERT(!(Refs == 0 && VacbDirty)); if (VacbTrace) { - DbgPrint("(%s:%i) VACB %p --RefCount=%lu, Dirty %u, PageOut %lu\n", - file, line, vacb, Refs, VacbDirty, VacbPageOut); + DbgPrint("(%s:%i) VACB %p --RefCount=%lu, PageOut %lu\n", + file, line, vacb, Refs, VacbPageOut); } if (Refs == 0) @@ -103,8 +100,8 @@ ULONG CcRosVacbGetRefCount_(PROS_VACB vacb, PCSTR file, INT line) Refs = InterlockedCompareExchange((PLONG)&vacb->ReferenceCount, 0, 0); if (vacb->SharedCacheMap->Trace) { - DbgPrint("(%s:%i) VACB %p ==RefCount=%lu, Dirty %u, PageOut %lu\n", - file, line, vacb, Refs, vacb->Dirty, vacb->PageOut); + DbgPrint("(%s:%i) VACB %p ==RefCount=%lu, PageOut %lu\n", + file, line, vacb, Refs, vacb->PageOut); } return Refs; @@ -142,8 +139,8 @@ CcRosTraceCacheMap ( current = CONTAINING_RECORD(current_entry, ROS_VACB, CacheMapVacbListEntry); current_entry = current_entry->Flink; - DPRINT1(" VACB 0x%p enabled, RefCount %lu, Dirty %u, PageOut %lu, BaseAddress %p, FileOffset %I64d\n", - current, current->ReferenceCount, current->Dirty, current->PageOut, current->BaseAddress, current->FileOffset.QuadPart); + DPRINT1(" VACB 0x%p enabled, RefCount %lu, PageOut %lu, BaseAddress %p, FileOffset %I64d\n", + current, current->ReferenceCount, current->PageOut, current->BaseAddress, current->FileOffset.QuadPart); } KeReleaseSpinLockFromDpcLevel(&SharedCacheMap->CacheMapLock); @@ -765,14 +762,12 @@ CcRosCreateVacb ( return STATUS_INSUFFICIENT_RESOURCES; } current->BaseAddress = NULL; - current->Dirty = FALSE; current->PageOut = FALSE; current->FileOffset.QuadPart = ROUND_DOWN(FileOffset, VACB_MAPPING_GRANULARITY); current->SharedCacheMap = SharedCacheMap; current->MappedCount = 0; current->ReferenceCount = 0; InitializeListHead(¤t->CacheMapVacbListEntry); - InitializeListHead(¤t->DirtyVacbListEntry); InitializeListHead(¤t->VacbLruListEntry); CcRosVacbIncRefCount(current); @@ -1025,7 +1020,6 @@ CcRosInternalFreeVacb ( ASSERT(Vacb->ReferenceCount == 0); ASSERT(IsListEmpty(&Vacb->CacheMapVacbListEntry)); - ASSERT(IsListEmpty(&Vacb->DirtyVacbListEntry)); ASSERT(IsListEmpty(&Vacb->VacbLruListEntry)); /* Delete the mapping */ @@ -1503,7 +1497,6 @@ CcInitView ( { DPRINT("CcInitView()\n"); - InitializeListHead(&DirtyVacbListHead); InitializeListHead(&VacbLruListHead); InitializeListHead(&CcDeferredWrites); InitializeListHead(&CcCleanSharedCacheMapList); diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index c8f2db366127a..f42f815101f8e 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -40,7 +40,6 @@ // Global Cc Data // extern ULONG CcRosTraceLevel; -extern LIST_ENTRY DirtyVacbListHead; extern LIST_ENTRY CcCleanSharedCacheMapList; extern LIST_ENTRY CcDirtySharedCacheMapList; extern ULONG CcDirtyPageThreshold; @@ -210,15 +209,11 @@ typedef struct _ROS_VACB { /* Base address of the region where the view's data is mapped. */ PVOID BaseAddress; - /* Are the contents of the view newer than those on disk. */ - BOOLEAN Dirty; /* Page out in progress */ BOOLEAN PageOut; ULONG MappedCount; /* Entry in the list of VACBs for this shared cache map. */ LIST_ENTRY CacheMapVacbListEntry; - /* Entry in the list of VACBs which are dirty. */ - LIST_ENTRY DirtyVacbListEntry; /* Entry in the list of VACBs. */ LIST_ENTRY VacbLruListEntry; /* Offset in the file which this view maps. */ @@ -227,7 +222,6 @@ typedef struct _ROS_VACB volatile ULONG ReferenceCount; /* Pointer to the shared cache map for the file which this view maps data for. */ PROS_SHARED_CACHE_MAP SharedCacheMap; - /* Pointer to the next VACB in a chain. */ } ROS_VACB, *PROS_VACB; typedef struct _INTERNAL_BCB