From 0d99c97ab47022d2da0fccaa29b66d12828e4b30 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 13 Mar 2008 20:14:30 +0000 Subject: [PATCH] - Switch to using the cache bitmap (the cache manager uses one large memory region within the kernel address space and allocate/deallocate space from this block over a bitmap). - This removes (hides?) the so-called "ResourceNeverExclusive" problem at the end of the 1st stage setup or during file copy operation. Also it makes file copying process (not only in the 1st stage) more stable. - Cacheseg mapping region size enlarged to 256Mb. See issue #2872 for more details. svn path=/trunk/; revision=32675 --- reactos/ntoskrnl/cc/view.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index efe8b5955b4..2cfb6878e89 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -47,7 +47,7 @@ * over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region * must be reduced (ntoskrnl\mm\mdl.c, MI_MDLMAPPING_REGION_SIZE). */ -//#define CACHE_BITMAP +#define CACHE_BITMAP static LIST_ENTRY DirtySegmentListHead; static LIST_ENTRY CacheSegmentListHead; @@ -58,7 +58,7 @@ ULONG DirtyPageCount=0; KGUARDED_MUTEX ViewLock; #ifdef CACHE_BITMAP -#define CI_CACHESEG_MAPPING_REGION_SIZE (128*1024*1024) +#define CI_CACHESEG_MAPPING_REGION_SIZE (256*1024*1024) static PVOID CiCacheSegMappingRegionBase = NULL; static RTL_BITMAP CiCacheSegMappingRegionAllocMap; @@ -564,10 +564,12 @@ CcRosCreateCacheSegment(PBCB Bcb, PCACHE_SEGMENT current; PCACHE_SEGMENT previous; PLIST_ENTRY current_entry; - NTSTATUS Status; KIRQL oldIrql; #ifdef CACHE_BITMAP ULONG StartingOffset; +#else + ULONG_PTR GuardArea; + NTSTATUS Status; #endif PHYSICAL_ADDRESS BoundaryAddressMultiple; @@ -677,7 +679,8 @@ CcRosCreateCacheSegment(PBCB Bcb, KEBUGCHECKCC; } - current->BaseAddress = CiCacheSegMappingRegionBase + StartingOffset * PAGE_SIZE; + current->BaseAddress = (PVOID)((ULONG_PTR)CiCacheSegMappingRegionBase + + StartingOffset * PAGE_SIZE); if (CiCacheSegMappingRegionHint == StartingOffset) { @@ -886,7 +889,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg) for (i = 0; i < RegionSize; i++) { MmDeleteVirtualMapping(NULL, - CacheSeg->BaseAddress + (i * PAGE_SIZE), + (PVOID)((ULONG_PTR)CacheSeg->BaseAddress + (i * PAGE_SIZE)), FALSE, NULL, &Page); @@ -895,7 +898,8 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg) KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql); /* Deallocate all the pages used. */ - Base = (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / PAGE_SIZE; + Base = ((ULONG_PTR)CacheSeg->BaseAddress - + (ULONG_PTR)CiCacheSegMappingRegionBase) / PAGE_SIZE; RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);