mirror of
https://github.com/reactos/reactos.git
synced 2025-06-11 04:47:22 +00:00
[NTOSKRNL] Link all the shared cache map together.
This commit is contained in:
parent
804472fab8
commit
9d1e16663a
2 changed files with 20 additions and 0 deletions
|
@ -63,18 +63,22 @@ ULONG CcLazyWriteIos = 0;
|
||||||
* - Amount of dirty pages
|
* - Amount of dirty pages
|
||||||
* - List for deferred writes
|
* - List for deferred writes
|
||||||
* - Spinlock when dealing with the deferred list
|
* - Spinlock when dealing with the deferred list
|
||||||
|
* - List for "clean" shared cache maps
|
||||||
*/
|
*/
|
||||||
ULONG CcDirtyPageThreshold = 0;
|
ULONG CcDirtyPageThreshold = 0;
|
||||||
ULONG CcTotalDirtyPages = 0;
|
ULONG CcTotalDirtyPages = 0;
|
||||||
LIST_ENTRY CcDeferredWrites;
|
LIST_ENTRY CcDeferredWrites;
|
||||||
KSPIN_LOCK CcDeferredWriteSpinLock;
|
KSPIN_LOCK CcDeferredWriteSpinLock;
|
||||||
|
LIST_ENTRY CcCleanSharedCacheMapList;
|
||||||
|
|
||||||
/* Internal vars (ROS):
|
/* Internal vars (ROS):
|
||||||
* - Event to notify lazy writer to shutdown
|
* - Event to notify lazy writer to shutdown
|
||||||
* - Event to inform watchers lazy writer is done for this loop
|
* - Event to inform watchers lazy writer is done for this loop
|
||||||
|
* - Lock for the CcCleanSharedCacheMapList list
|
||||||
*/
|
*/
|
||||||
KEVENT iLazyWriterShutdown;
|
KEVENT iLazyWriterShutdown;
|
||||||
KEVENT iLazyWriterNotify;
|
KEVENT iLazyWriterNotify;
|
||||||
|
KSPIN_LOCK iSharedCacheMapLock;
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line)
|
static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line)
|
||||||
|
@ -1139,6 +1143,8 @@ CcRosDeleteFileCache (
|
||||||
SharedCacheMap->OpenCount--;
|
SharedCacheMap->OpenCount--;
|
||||||
if (SharedCacheMap->OpenCount == 0)
|
if (SharedCacheMap->OpenCount == 0)
|
||||||
{
|
{
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
|
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1173,6 +1179,11 @@ CcRosDeleteFileCache (
|
||||||
current = CONTAINING_RECORD(current_entry, ROS_VACB, CacheMapVacbListEntry);
|
current = CONTAINING_RECORD(current_entry, ROS_VACB, CacheMapVacbListEntry);
|
||||||
CcRosInternalFreeVacb(current);
|
CcRosInternalFreeVacb(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&iSharedCacheMapLock, &OldIrql);
|
||||||
|
RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks);
|
||||||
|
KeReleaseSpinLock(&iSharedCacheMapLock, OldIrql);
|
||||||
|
|
||||||
ExFreeToNPagedLookasideList(&SharedCacheMapLookasideList, SharedCacheMap);
|
ExFreeToNPagedLookasideList(&SharedCacheMapLookasideList, SharedCacheMap);
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
}
|
}
|
||||||
|
@ -1317,6 +1328,8 @@ CcRosInitializeFileCache (
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
if (SharedCacheMap == NULL)
|
if (SharedCacheMap == NULL)
|
||||||
{
|
{
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
SharedCacheMap = ExAllocateFromNPagedLookasideList(&SharedCacheMapLookasideList);
|
SharedCacheMap = ExAllocateFromNPagedLookasideList(&SharedCacheMapLookasideList);
|
||||||
if (SharedCacheMap == NULL)
|
if (SharedCacheMap == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1338,6 +1351,10 @@ CcRosInitializeFileCache (
|
||||||
KeInitializeSpinLock(&SharedCacheMap->CacheMapLock);
|
KeInitializeSpinLock(&SharedCacheMap->CacheMapLock);
|
||||||
InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
|
InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
|
||||||
FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;
|
FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&iSharedCacheMapLock, &OldIrql);
|
||||||
|
InsertTailList(&CcCleanSharedCacheMapList, &SharedCacheMap->SharedCacheMapLinks);
|
||||||
|
KeReleaseSpinLock(&iSharedCacheMapLock, OldIrql);
|
||||||
}
|
}
|
||||||
if (FileObject->PrivateCacheMap == NULL)
|
if (FileObject->PrivateCacheMap == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1395,7 +1412,9 @@ CcInitView (
|
||||||
InitializeListHead(&DirtyVacbListHead);
|
InitializeListHead(&DirtyVacbListHead);
|
||||||
InitializeListHead(&VacbLruListHead);
|
InitializeListHead(&VacbLruListHead);
|
||||||
InitializeListHead(&CcDeferredWrites);
|
InitializeListHead(&CcDeferredWrites);
|
||||||
|
InitializeListHead(&CcCleanSharedCacheMapList);
|
||||||
KeInitializeSpinLock(&CcDeferredWriteSpinLock);
|
KeInitializeSpinLock(&CcDeferredWriteSpinLock);
|
||||||
|
KeInitializeSpinLock(&iSharedCacheMapLock);
|
||||||
KeInitializeGuardedMutex(&ViewLock);
|
KeInitializeGuardedMutex(&ViewLock);
|
||||||
ExInitializeNPagedLookasideList(&iBcbLookasideList,
|
ExInitializeNPagedLookasideList(&iBcbLookasideList,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -160,6 +160,7 @@ typedef struct _ROS_SHARED_CACHE_MAP
|
||||||
KSPIN_LOCK CacheMapLock;
|
KSPIN_LOCK CacheMapLock;
|
||||||
ULONG OpenCount;
|
ULONG OpenCount;
|
||||||
ULONG DirtyPageThreshold;
|
ULONG DirtyPageThreshold;
|
||||||
|
LIST_ENTRY SharedCacheMapLinks;
|
||||||
#if DBG
|
#if DBG
|
||||||
BOOLEAN Trace; /* enable extra trace output for this cache map and it's VACBs */
|
BOOLEAN Trace; /* enable extra trace output for this cache map and it's VACBs */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue