mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 12:39:35 +00:00
[NTOSKRNL] Add an helper for marking a VACB clean (ie, not dirty).
CORE-14263
This commit is contained in:
parent
a13c998183
commit
3f8788d6e5
3 changed files with 44 additions and 18 deletions
|
@ -233,9 +233,7 @@ CcPurgeCacheSection (
|
|||
RemoveEntryList(&Vacb->VacbLruListEntry);
|
||||
if (Vacb->Dirty)
|
||||
{
|
||||
RemoveEntryList(&Vacb->DirtyVacbListEntry);
|
||||
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
Vacb->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
CcRosUnmarkDirtyVacb(Vacb, FALSE);
|
||||
}
|
||||
RemoveEntryList(&Vacb->CacheMapVacbListEntry);
|
||||
InsertHeadList(&FreeList, &Vacb->CacheMapVacbListEntry);
|
||||
|
|
|
@ -167,22 +167,11 @@ CcRosFlushVacb (
|
|||
PROS_VACB Vacb)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
KIRQL oldIrql;
|
||||
|
||||
Status = CcWriteVirtualAddress(Vacb);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
KeAcquireGuardedMutex(&ViewLock);
|
||||
KeAcquireSpinLock(&Vacb->SharedCacheMap->CacheMapLock, &oldIrql);
|
||||
|
||||
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);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
CcRosUnmarkDirtyVacb(Vacb, TRUE);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -619,6 +608,39 @@ CcRosMarkDirtyVacb (
|
|||
KeReleaseGuardedMutex(&ViewLock);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CcRosUnmarkDirtyVacb (
|
||||
PROS_VACB Vacb,
|
||||
BOOLEAN LockViews)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PROS_SHARED_CACHE_MAP SharedCacheMap;
|
||||
|
||||
SharedCacheMap = Vacb->SharedCacheMap;
|
||||
|
||||
if (LockViews)
|
||||
{
|
||||
KeAcquireGuardedMutex(&ViewLock);
|
||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &oldIrql);
|
||||
}
|
||||
|
||||
ASSERT(Vacb->Dirty);
|
||||
|
||||
Vacb->Dirty = FALSE;
|
||||
|
||||
RemoveEntryList(&Vacb->DirtyVacbListEntry);
|
||||
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
Vacb->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
CcRosVacbDecRefCount(Vacb);
|
||||
|
||||
if (LockViews)
|
||||
{
|
||||
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CcRosMarkDirtyFile (
|
||||
|
@ -1132,9 +1154,9 @@ CcRosDeleteFileCache (
|
|||
RemoveEntryList(¤t->VacbLruListEntry);
|
||||
if (current->Dirty)
|
||||
{
|
||||
RemoveEntryList(¤t->DirtyVacbListEntry);
|
||||
CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
current->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &oldIrql);
|
||||
CcRosUnmarkDirtyVacb(current, FALSE);
|
||||
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
|
||||
DPRINT1("Freeing dirty VACB\n");
|
||||
}
|
||||
InsertHeadList(&FreeList, ¤t->CacheMapVacbListEntry);
|
||||
|
|
|
@ -300,6 +300,12 @@ NTAPI
|
|||
CcRosMarkDirtyVacb(
|
||||
PROS_VACB Vacb);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CcRosUnmarkDirtyVacb(
|
||||
PROS_VACB Vacb,
|
||||
BOOLEAN LockViews);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CcRosFlushDirtyPages(
|
||||
|
|
Loading…
Reference in a new issue