static LIST_ENTRY ClosedListHead;
ULONG DirtyPageCount=0;
-FAST_MUTEX ViewLock;
+KGUARDED_MUTEX ViewLock;
#ifdef CACHE_BITMAP
#define CI_CACHESEG_MAPPING_REGION_SIZE (128*1024*1024)
NTSTATUS
CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg);
-BOOLEAN
-FASTCALL
-CcTryToAcquireBrokenMutex(PFAST_MUTEX FastMutex)
-{
- KeEnterCriticalRegion();
- if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
- {
- FastMutex->Owner = KeGetCurrentThread();
- return(TRUE);
- }
- else
- {
- KeLeaveCriticalRegion();
- return(FALSE);
- }
-}
/* FUNCTIONS *****************************************************************/
{
DPRINT1("Enabling Tracing for CacheMap 0x%p:\n", Bcb );
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
current_entry = Bcb->BcbSegmentListHead.Flink;
current, current->ReferenceCount, current->Dirty, current->PageOut );
}
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
else
{
NTAPI
CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment)
{
- NTSTATUS Status;
- KIRQL oldIrql;
- Status = WriteCacheSegment(CacheSegment);
- if (NT_SUCCESS(Status))
+ NTSTATUS Status;
+ KIRQL oldIrql;
+
+ Status = WriteCacheSegment(CacheSegment);
+ if (NT_SUCCESS(Status))
{
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
- KeAcquireSpinLock(&CacheSegment->Bcb->BcbLock, &oldIrql);
- CacheSegment->Dirty = FALSE;
- RemoveEntryList(&CacheSegment->DirtySegmentListEntry);
- DirtyPageCount -= CacheSegment->Bcb->CacheSegmentSize / PAGE_SIZE;
- CcRosCacheSegmentDecRefCount ( CacheSegment );
- KeReleaseSpinLock(&CacheSegment->Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
+ KeAcquireSpinLock(&CacheSegment->Bcb->BcbLock, &oldIrql);
+
+ CacheSegment->Dirty = FALSE;
+ RemoveEntryList(&CacheSegment->DirtySegmentListEntry);
+ DirtyPageCount -= CacheSegment->Bcb->CacheSegmentSize / PAGE_SIZE;
+ CcRosCacheSegmentDecRefCount ( CacheSegment );
+
+ KeReleaseSpinLock(&CacheSegment->Bcb->BcbLock, oldIrql);
+ KeReleaseGuardedMutex(&ViewLock);
}
- return(Status);
+
+ return(Status);
}
NTSTATUS
NTAPI
CcRosFlushDirtyPages(ULONG Target, PULONG Count)
{
- PLIST_ENTRY current_entry;
- PCACHE_SEGMENT current;
- ULONG PagesPerSegment;
- BOOLEAN Locked;
- NTSTATUS Status;
- static ULONG WriteCount[4] = {0, 0, 0, 0};
- ULONG NewTarget;
-
- DPRINT("CcRosFlushDirtyPages(Target %d)\n", Target);
-
- (*Count) = 0;
-
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
-
- WriteCount[0] = WriteCount[1];
- WriteCount[1] = WriteCount[2];
- WriteCount[2] = WriteCount[3];
- WriteCount[3] = 0;
-
- NewTarget = WriteCount[0] + WriteCount[1] + WriteCount[2];
-
- if (NewTarget < DirtyPageCount)
- {
- NewTarget = (DirtyPageCount - NewTarget + 3) / 4;
- WriteCount[0] += NewTarget;
- WriteCount[1] += NewTarget;
- WriteCount[2] += NewTarget;
- WriteCount[3] += NewTarget;
- }
-
- NewTarget = WriteCount[0];
+ PLIST_ENTRY current_entry;
+ PCACHE_SEGMENT current;
+ ULONG PagesPerSegment;
+ BOOLEAN Locked;
+ NTSTATUS Status;
+ static ULONG WriteCount[4] = {0, 0, 0, 0};
+ ULONG NewTarget;
+
+ DPRINT("CcRosFlushDirtyPages(Target %d)\n", Target);
+
+ (*Count) = 0;
+
+ KeAcquireGuardedMutex(&ViewLock);
+
+ WriteCount[0] = WriteCount[1];
+ WriteCount[1] = WriteCount[2];
+ WriteCount[2] = WriteCount[3];
+ WriteCount[3] = 0;
+
+ NewTarget = WriteCount[0] + WriteCount[1] + WriteCount[2];
+
+ if (NewTarget < DirtyPageCount)
+ {
+ NewTarget = (DirtyPageCount - NewTarget + 3) / 4;
+ WriteCount[0] += NewTarget;
+ WriteCount[1] += NewTarget;
+ WriteCount[2] += NewTarget;
+ WriteCount[3] += NewTarget;
+ }
+
+ NewTarget = WriteCount[0];
+
+ Target = max(NewTarget, Target);
+
+ current_entry = DirtySegmentListHead.Flink;
+ if (current_entry == &DirtySegmentListHead)
+ {
+ DPRINT("No Dirty pages\n");
+ }
+
+ while (current_entry != &DirtySegmentListHead && Target > 0)
+ {
+ current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
+ DirtySegmentListEntry);
+ current_entry = current_entry->Flink;
+
+ Locked = ExTryToAcquireResourceExclusiveLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
+ if (!Locked)
+ {
+ continue;
+ }
+
+ Locked = ExTryToAcquirePushLockExclusive(¤t->Lock);
+ if (!Locked)
+ {
+ ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
+ continue;
+ }
+
+ ASSERT(current->Dirty);
+ if (current->ReferenceCount > 1)
+ {
+ ExReleasePushLock(¤t->Lock);
+ ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
+ continue;
+ }
+
+ PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
- Target = max(NewTarget, Target);
+ KeReleaseGuardedMutex(&ViewLock);
+
+ Status = CcRosFlushCacheSegment(current);
- current_entry = DirtySegmentListHead.Flink;
- if (current_entry == &DirtySegmentListHead)
- {
- DPRINT("No Dirty pages\n");
- }
- while (current_entry != &DirtySegmentListHead && Target > 0)
- {
- current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
- DirtySegmentListEntry);
- current_entry = current_entry->Flink;
+ ExReleasePushLock(¤t->Lock);
+ ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
-// Locked = current->Bcb->Callbacks.AcquireForLazyWrite(current->Bcb->Context, FALSE);
- Locked = ExTryToAcquireResourceExclusiveLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
- if (!Locked)
+ if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
{
- continue;
+ DPRINT1("CC: Failed to flush cache segment.\n");
}
- Locked = CcTryToAcquireBrokenMutex(¤t->Lock);
- if (!Locked)
- {
-// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
- ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
- continue;
- }
- ASSERT(current->Dirty);
- if (current->ReferenceCount > 1)
- {
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
-// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
- ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
- continue;
- }
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
- PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
- Status = CcRosFlushCacheSegment(current);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
-// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
- ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
- if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
- {
- DPRINT1("CC: Failed to flush cache segment.\n");
- }
- else
- {
- (*Count) += PagesPerSegment;
- Target -= PagesPerSegment;
- }
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
- current_entry = DirtySegmentListHead.Flink;
+ else
+ {
+ (*Count) += PagesPerSegment;
+ Target -= PagesPerSegment;
+ }
+
+ KeAcquireGuardedMutex(&ViewLock);
+ current_entry = DirtySegmentListHead.Flink;
}
- if (*Count < NewTarget)
- {
- WriteCount[1] += (NewTarget - *Count);
- }
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
- DPRINT("CcRosFlushDirtyPages() finished\n");
-
- return(STATUS_SUCCESS);
+
+ if (*Count < NewTarget)
+ {
+ WriteCount[1] += (NewTarget - *Count);
+ }
+
+ KeReleaseGuardedMutex(&ViewLock);
+
+ DPRINT("CcRosFlushDirtyPages() finished\n");
+ return(STATUS_SUCCESS);
}
NTSTATUS
InitializeListHead(&FreeList);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
current_entry = CacheSegmentLRUListHead.Flink;
while (current_entry != &CacheSegmentLRUListHead && Target > 0)
{
last = current;
current->PageOut = TRUE;
KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++)
{
PFN_TYPE Page;
break;
}
}
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql);
CcRosCacheSegmentDecRefCount(current);
current->PageOut = FALSE;
KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql);
}
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
while (!IsListEmpty(&FreeList))
{
CacheSeg->Valid = Valid;
CacheSeg->Dirty = CacheSeg->Dirty || Dirty;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
if (!WasDirty && CacheSeg->Dirty)
{
InsertTailList(&DirtySegmentListHead, &CacheSeg->DirtySegmentListEntry);
CcRosCacheSegmentIncRefCount(CacheSeg);
}
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&CacheSeg->Lock);
+ KeReleaseGuardedMutex(&ViewLock);
+ ExReleasePushLock(&CacheSeg->Lock);
return(STATUS_SUCCESS);
}
+/* Returns with Cache Segment Lock Held! */
PCACHE_SEGMENT
NTAPI
CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
{
- PLIST_ENTRY current_entry;
- PCACHE_SEGMENT current;
- KIRQL oldIrql;
-
- ASSERT(Bcb);
-
- DPRINT("CcRosLookupCacheSegment(Bcb -x%p, FileOffset %d)\n", Bcb, FileOffset);
-
- KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
- current_entry = Bcb->BcbSegmentListHead.Flink;
- while (current_entry != &Bcb->BcbSegmentListHead)
+ PLIST_ENTRY current_entry;
+ PCACHE_SEGMENT current;
+ KIRQL oldIrql;
+
+ ASSERT(Bcb);
+
+ DPRINT("CcRosLookupCacheSegment(Bcb -x%p, FileOffset %d)\n", Bcb, FileOffset);
+
+ KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
+ current_entry = Bcb->BcbSegmentListHead.Flink;
+ while (current_entry != &Bcb->BcbSegmentListHead)
{
- current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
- BcbSegmentListEntry);
- if (current->FileOffset <= FileOffset &&
- (current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
- {
- CcRosCacheSegmentIncRefCount(current);
- KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(¤t->Lock);
- return(current);
- }
- current_entry = current_entry->Flink;
+ current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
+ BcbSegmentListEntry);
+ if (current->FileOffset <= FileOffset &&
+ (current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
+ {
+ CcRosCacheSegmentIncRefCount(current);
+ KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
+ ExAcquirePushLockExclusive(¤t->Lock);
+ return(current);
+ }
+ current_entry = current_entry->Flink;
}
- KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- return(NULL);
+ KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
+ return(NULL);
}
NTSTATUS
}
if (!CacheSeg->Dirty)
{
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
InsertTailList(&DirtySegmentListHead, &CacheSeg->DirtySegmentListEntry);
DirtyPageCount += Bcb->CacheSegmentSize / PAGE_SIZE;
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
else
{
CacheSeg->Dirty = TRUE;
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&CacheSeg->Lock);
+ ExReleasePushLock(&CacheSeg->Lock);
return(STATUS_SUCCESS);
}
if (!WasDirty && NowDirty)
{
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
InsertTailList(&DirtySegmentListHead, &CacheSeg->DirtySegmentListEntry);
DirtyPageCount += Bcb->CacheSegmentSize / PAGE_SIZE;
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
}
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&CacheSeg->Lock);
+ ExReleasePushLock(&CacheSeg->Lock);
return(STATUS_SUCCESS);
}
current->DirtySegmentListEntry.Flink = NULL;
current->DirtySegmentListEntry.Blink = NULL;
current->ReferenceCount = 1;
- ExInitializeFastMutex(¤t->Lock);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(¤t->Lock);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ ExInitializePushLock((PULONG_PTR)¤t->Lock);
+ ExAcquirePushLockExclusive(¤t->Lock);
+ KeAcquireGuardedMutex(&ViewLock);
*CacheSeg = current;
/* There is window between the call to CcRosLookupCacheSegment
current );
}
#endif
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&(*CacheSeg)->Lock);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ ExReleasePushLock(&(*CacheSeg)->Lock);
+ KeReleaseGuardedMutex(&ViewLock);
ExFreeToNPagedLookasideList(&CacheSegLookasideList, *CacheSeg);
*CacheSeg = current;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(¤t->Lock);
+ ExAcquirePushLockExclusive(¤t->Lock);
return STATUS_SUCCESS;
}
if (current->FileOffset < FileOffset)
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
InsertTailList(&CacheSegmentListHead, ¤t->CacheSegmentListEntry);
InsertTailList(&CacheSegmentLRUListHead, ¤t->CacheSegmentLRUListEntry);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
#ifdef CACHE_BITMAP
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
DPRINT("CcRosFreeCacheSegment(Bcb 0x%p, CacheSeg 0x%p)\n",
Bcb, CacheSeg);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
RemoveEntryList(&CacheSeg->BcbSegmentListEntry);
RemoveEntryList(&CacheSeg->CacheSegmentListEntry);
}
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
Status = CcRosInternalFreeCacheSegment(CacheSeg);
return(Status);
}
}
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
+ ExReleasePushLock(¤t->Lock);
CcRosCacheSegmentDecRefCount(current);
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
}
ASSERT(Bcb);
Bcb->RefCount++;
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, NULL);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
Bcb->RefCount--;
if (Bcb->RefCount == 0)
{
#endif
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
ObDereferenceObject (Bcb->FileObject);
while (!IsListEmpty(&FreeList))
Status = CcRosInternalFreeCacheSegment(current);
}
ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
}
return(STATUS_SUCCESS);
}
CcRosReferenceCache(PFILE_OBJECT FileObject)
{
PBCB Bcb;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
Bcb = (PBCB)FileObject->SectionObjectPointer->SharedCacheMap;
ASSERT(Bcb);
if (Bcb->RefCount == 0)
ASSERT(Bcb->BcbRemoveListEntry.Flink == NULL);
}
Bcb->RefCount++;
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
VOID
{
PBCB Bcb;
DPRINT("CcRosSetRemoveOnClose()\n");
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
Bcb = (PBCB)SectionObjectPointer->SharedCacheMap;
if (Bcb)
{
CcRosDeleteFileCache(Bcb->FileObject, Bcb);
}
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
CcRosDereferenceCache(PFILE_OBJECT FileObject)
{
PBCB Bcb;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
Bcb = (PBCB)FileObject->SectionObjectPointer->SharedCacheMap;
ASSERT(Bcb);
if (Bcb->RefCount > 0)
}
}
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
NTSTATUS STDCALL
{
PBCB Bcb;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
{
}
}
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
return(STATUS_SUCCESS);
}
PBCB Bcb;
NTSTATUS Status;
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
if (Bcb == NULL)
}
Status = STATUS_SUCCESS;
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
return Status;
}
DPRINT("CcRosInitializeFileCache(FileObject 0x%p, Bcb 0x%p, CacheSegmentSize %d)\n",
FileObject, Bcb, CacheSegmentSize);
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
if (Bcb == NULL)
{
Bcb = ExAllocateFromNPagedLookasideList(&BcbLookasideList);
if (Bcb == NULL)
{
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
return(STATUS_UNSUCCESSFUL);
}
memset(Bcb, 0, sizeof(BCB));
RemoveEntryList(&Bcb->BcbRemoveListEntry);
Bcb->BcbRemoveListEntry.Flink = NULL;
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
return(STATUS_SUCCESS);
}
break;
}
- ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
+ KeAcquireGuardedMutex(&ViewLock);
CcTimeStamp++;
if (CcTimeStamp >= 30)
{
CcRosDeleteFileCache(current->FileObject, current);
}
}
- ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
+ KeReleaseGuardedMutex(&ViewLock);
}
}
InitializeListHead(&DirtySegmentListHead);
InitializeListHead(&CacheSegmentLRUListHead);
InitializeListHead(&ClosedListHead);
- ExInitializeFastMutex(&ViewLock);
+ KeInitializeGuardedMutex(&ViewLock);
ExInitializeNPagedLookasideList (&iBcbLookasideList,
NULL,
NULL,
+