[NTOSKRNL] Store the total dirty pages per shared cache map in it.

This commit is contained in:
Pierre Schweitzer 2018-01-26 10:40:05 +01:00
parent 2362e0faae
commit 5cc0668b21
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 9 additions and 1 deletions

View file

@ -235,6 +235,7 @@ CcPurgeCacheSection (
{
RemoveEntryList(&Vacb->DirtyVacbListEntry);
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
Vacb->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
}
RemoveEntryList(&Vacb->CacheMapVacbListEntry);
InsertHeadList(&FreeList, &Vacb->CacheMapVacbListEntry);

View file

@ -175,6 +175,7 @@ CcRosFlushVacb (
Vacb->Dirty = FALSE;
RemoveEntryList(&Vacb->DirtyVacbListEntry);
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
Vacb->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
CcRosVacbDecRefCount(Vacb);
KeReleaseSpinLock(&Vacb->SharedCacheMap->CacheMapLock, oldIrql);
@ -535,6 +536,7 @@ CcRosReleaseVacb (
{
InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry);
CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
}
if (Mapped)
@ -621,6 +623,7 @@ CcRosMarkDirtyVacb (
{
InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry);
CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
}
else
{
@ -698,6 +701,7 @@ CcRosUnmapVacb (
{
InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry);
CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
}
CcRosVacbDecRefCount(Vacb);
@ -1162,6 +1166,7 @@ CcRosDeleteFileCache (
{
RemoveEntryList(&current->DirtyVacbListEntry);
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
current->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
DPRINT1("Freeing dirty VACB\n");
}
InsertHeadList(&FreeList, &current->CacheMapVacbListEntry);
@ -1349,6 +1354,7 @@ CcRosInitializeFileCache (
SharedCacheMap->FileSize = FileSizes->FileSize;
SharedCacheMap->PinAccess = PinAccess;
SharedCacheMap->DirtyPageThreshold = 0;
SharedCacheMap->DirtyPages = 0;
KeInitializeSpinLock(&SharedCacheMap->CacheMapLock);
InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;

View file

@ -159,8 +159,9 @@ typedef struct _ROS_SHARED_CACHE_MAP
PVOID LazyWriteContext;
KSPIN_LOCK CacheMapLock;
ULONG OpenCount;
ULONG DirtyPageThreshold;
ULONG DirtyPages;
LIST_ENTRY SharedCacheMapLinks;
ULONG DirtyPageThreshold;
#if DBG
BOOLEAN Trace; /* enable extra trace output for this cache map and it's VACBs */
#endif