[NTOSKRNL] Store the total dirty pages per shared cache map in it.
authorPierre Schweitzer <pierre@reactos.org>
Fri, 26 Jan 2018 09:40:05 +0000 (10:40 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 26 Jan 2018 09:42:09 +0000 (10:42 +0100)
ntoskrnl/cc/fs.c
ntoskrnl/cc/view.c
ntoskrnl/include/internal/cc.h

index d068f96..9e9ff1a 100644 (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);
index e8da9a5..b08210c 100644 (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;
index 913517a..a85df9d 100644 (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