Skip to content

Commit

Permalink
[NTOS:CC] Remove dirty VACB list and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
TAN-Gaming committed Nov 13, 2024
1 parent 2ad5790 commit 40ab546
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
23 changes: 8 additions & 15 deletions ntoskrnl/cc/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

/* GLOBALS *******************************************************************/

LIST_ENTRY DirtyVacbListHead;
static LIST_ENTRY VacbLruListHead;

NPAGED_LOOKASIDE_LIST iBcbLookasideList;
Expand Down Expand Up @@ -68,25 +67,23 @@ 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;
}
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)
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(&current->CacheMapVacbListEntry);
InitializeListHead(&current->DirtyVacbListEntry);
InitializeListHead(&current->VacbLruListEntry);

CcRosVacbIncRefCount(current);
Expand Down Expand Up @@ -1025,7 +1020,6 @@ CcRosInternalFreeVacb (

ASSERT(Vacb->ReferenceCount == 0);
ASSERT(IsListEmpty(&Vacb->CacheMapVacbListEntry));
ASSERT(IsListEmpty(&Vacb->DirtyVacbListEntry));
ASSERT(IsListEmpty(&Vacb->VacbLruListEntry));

/* Delete the mapping */
Expand Down Expand Up @@ -1503,7 +1497,6 @@ CcInitView (
{
DPRINT("CcInitView()\n");

InitializeListHead(&DirtyVacbListHead);
InitializeListHead(&VacbLruListHead);
InitializeListHead(&CcDeferredWrites);
InitializeListHead(&CcCleanSharedCacheMapList);
Expand Down
6 changes: 0 additions & 6 deletions ntoskrnl/include/internal/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand All @@ -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
Expand Down

0 comments on commit 40ab546

Please sign in to comment.