https://git.reactos.org/?p=reactos.git;a=commitdiff;h=470ad188258a3561ef595fc281f1643eda24e880

commit 470ad188258a3561ef595fc281f1643eda24e880
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Fri Sep 23 23:00:18 2022 +0200
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Sat Jul 29 14:00:44 2023 +0300

    Revert "[NTOS:CC] Wake up lazy scan after inserting elements in the list."
    
    This reverts commit 6e4f83da700fbfac5450dc9ef667585ddc870bc9.
---
 ntoskrnl/cc/copy.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index 7b43ab51e60..e01f2b46865 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -400,6 +400,16 @@ CcCanIWrite (
         return FALSE;
     }
 
+    /* Otherwise, if there are no deferred writes yet, start the lazy writer */
+    if (IsListEmpty(&CcDeferredWrites))
+    {
+        KIRQL OldIrql;
+
+        OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
+        CcScheduleLazyWriteScan(TRUE);
+        KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
+    }
+
     /* Initialize our wait event */
     KeInitializeEvent(&WaitEvent, NotificationEvent, FALSE);
 
@@ -427,12 +437,6 @@ CcCanIWrite (
                                     &CcDeferredWriteSpinLock);
     }
 
-    /* Now make sure that the lazy scan writer will be active */
-    OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
-    if (!LazyWriter.ScanActive)
-        CcScheduleLazyWriteScan(TRUE);
-    KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
-
 #if DBG
     DPRINT1("Actively deferring write for: %p\n", FileObject);
     DPRINT1("Because:\n");

Reply via email to