- Marked a cache segment as page out in progress to prevent from
authorHartmut Birr <osexpert@googlemail.com>
Thu, 26 Feb 2004 19:29:55 +0000 (19:29 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Thu, 26 Feb 2004 19:29:55 +0000 (19:29 +0000)
  recursive calls to MmPageOutPhysicalAddress.
- This fixes bug #220.

svn path=/trunk/; revision=8403

reactos/ntoskrnl/cc/view.c
reactos/ntoskrnl/include/internal/cc.h

index c9ba56f..b4fa049 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: view.c,v 1.71 2003/12/31 05:33:03 jfilby Exp $
+/* $Id: view.c,v 1.72 2004/02/26 19:29:55 hbirr Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/cc/view.c
@@ -270,13 +270,14 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
       }
       else
       {
-         if (last != current && current->MappedCount > 0 && !current->Dirty)
+         if (last != current && current->MappedCount > 0 && !current->Dirty && !current->PageOut)
           {
             ULONG i;
             NTSTATUS Status;
                
              current->ReferenceCount++;
             last = current;
+            current->PageOut = TRUE;
              KeReleaseSpinLock(&current->Bcb->BcbLock, oldIrql);
             ExReleaseFastMutex(&ViewLock);
             for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++)
@@ -292,6 +293,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
              ExAcquireFastMutex(&ViewLock);
              KeAcquireSpinLock(&current->Bcb->BcbLock, &oldIrql);
             current->ReferenceCount--;
+            current->PageOut = FALSE;
              KeReleaseSpinLock(&current->Bcb->BcbLock, oldIrql);
              current_entry = &current->CacheSegmentLRUListEntry;
             continue;
@@ -505,6 +507,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
   current = ExAllocateFromNPagedLookasideList(&CacheSegLookasideList);
   current->Valid = FALSE;
   current->Dirty = FALSE;
+  current->PageOut = FALSE;
   current->FileOffset = ROUND_DOWN(FileOffset, Bcb->CacheSegmentSize);
   current->Bcb = Bcb;
   current->MappedCount = 0;
index 86c1b52..5dc6c3e 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef __INCLUDE_INTERNAL_CC_H
 #define __INCLUDE_INTERNAL_CC_H
-/* $Id: cc.h,v 1.18 2003/06/27 21:28:30 hbirr Exp $ */
+/* $Id: cc.h,v 1.19 2004/02/26 19:29:55 hbirr Exp $ */
 #include <ddk/ntifs.h>
 
 
@@ -31,6 +31,8 @@ typedef struct _CACHE_SEGMENT
   BOOLEAN Valid;
   /* Are the contents of the cache segment data newer than those on disk. */
   BOOLEAN Dirty;
+  /* Page out in progress */ 
+  BOOLEAN PageOut;
   ULONG MappedCount;
   /* Entry in the list of segments for this BCB. */
   LIST_ENTRY BcbSegmentListEntry;