https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f2c44aa4838de066069a5…
commit f2c44aa4838de066069a532758965522f482de10
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Apr 29 20:34:28 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Apr 29 20:42:53 2018 +0200
[NTOSKRNL] Fix lazy writer for in-use VACB.
Adjusting refcount and enabling lazy-write for pinned
VACB makes it actually more efficient, often purging
data to disk, reducing memory stress for the system.
This is required for defering writes.
This commit unfortunately (?) reverts a previous revert.
CORE-12081
CORE-14582
CORE-14313
---
ntoskrnl/cc/pin.c | 4 ++++
ntoskrnl/cc/view.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index d81f09d470..2d48a27a0a 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -275,6 +275,10 @@ CcSetDirtyPinnedData (
Bcb, Lsn);
iBcb->Dirty = TRUE;
+ if (!iBcb->Vacb->Dirty)
+ {
+ CcRosMarkDirtyVacb(iBcb->Vacb);
+ }
}
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index c2b8913132..e1d064312f 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -205,6 +205,8 @@ CcRosFlushDirtyPages (
while ((current_entry != &DirtyVacbListHead) && (Target > 0))
{
+ ULONG Refs;
+
current = CONTAINING_RECORD(current_entry,
ROS_VACB,
DirtyVacbListEntry);
@@ -231,7 +233,9 @@ CcRosFlushDirtyPages (
ASSERT(current->Dirty);
/* One reference is added above */
- if (CcRosVacbGetRefCount(current) > 2)
+ Refs = CcRosVacbGetRefCount(current);
+ if ((Refs > 3 && current->PinCount == 0) ||
+ (Refs > 4 && current->PinCount > 1))
{
current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
current->SharedCacheMap->LazyWriteContext);