[NTOS:CC]
[reactos.git] / reactos / ntoskrnl / cc / view.c
index df7060f..825dffe 100644 (file)
@@ -199,11 +199,8 @@ CcRosFlushDirtyPages (
             continue;
         }
 
-        Status = KeWaitForSingleObject(&current->Mutex,
-                                       Executive,
-                                       KernelMode,
-                                       FALSE,
-                                       Wait ? NULL : &ZeroTimeout);
+        Status = CcRosAcquireVacbLock(current,
+                                      Wait ? NULL : &ZeroTimeout);
         if (Status != STATUS_SUCCESS)
         {
             current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
@@ -217,7 +214,7 @@ CcRosFlushDirtyPages (
         /* One reference is added above */
         if (current->ReferenceCount > 2)
         {
-            KeReleaseMutex(&current->Mutex, FALSE);
+            CcRosReleaseVacbLock(current);
             current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
                 current->SharedCacheMap->LazyWriteContext);
             CcRosVacbDecRefCount(current);
@@ -228,7 +225,7 @@ CcRosFlushDirtyPages (
 
         Status = CcRosFlushVacb(current);
 
-        KeReleaseMutex(&current->Mutex, FALSE);
+        CcRosReleaseVacbLock(current);
         current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
             current->SharedCacheMap->LazyWriteContext);
 
@@ -427,7 +424,7 @@ CcRosReleaseVacb (
     KeReleaseGuardedMutex(&ViewLock);
     if (InterlockedCompareExchange(&Vacb->PinCount, 0, 0) == 0)
     {
-        KeReleaseMutex(&Vacb->Mutex, FALSE);
+        CcRosReleaseVacbLock(Vacb);
     }
 
     return STATUS_SUCCESS;
@@ -467,11 +464,7 @@ CcRosLookupVacb (
             KeReleaseGuardedMutex(&ViewLock);
             if (InterlockedCompareExchange(&current->PinCount, 0, 0) == 0)
             {
-                KeWaitForSingleObject(&current->Mutex,
-                                      Executive,
-                                      KernelMode,
-                                      FALSE,
-                                      NULL);
+                CcRosAcquireVacbLock(current, NULL);
             }
             return current;
         }
@@ -527,7 +520,7 @@ CcRosMarkDirtyVacb (
 
     KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
     KeReleaseGuardedMutex(&ViewLock);
-    KeReleaseMutex(&Vacb->Mutex, FALSE);
+    CcRosReleaseVacbLock(Vacb);
 
     return STATUS_SUCCESS;
 }
@@ -580,7 +573,7 @@ CcRosUnmapVacb (
 
     KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
     KeReleaseGuardedMutex(&ViewLock);
-    KeReleaseMutex(&Vacb->Mutex, FALSE);
+    CcRosReleaseVacbLock(Vacb);
 
     return STATUS_SUCCESS;
 }
@@ -683,11 +676,7 @@ CcRosCreateVacb (
     current->ReferenceCount = 1;
     current->PinCount = 0;
     KeInitializeMutex(&current->Mutex, 0);
-    KeWaitForSingleObject(&current->Mutex,
-                          Executive,
-                          KernelMode,
-                          FALSE,
-                          NULL);
+    CcRosAcquireVacbLock(current, NULL);
     KeAcquireGuardedMutex(&ViewLock);
 
     *Vacb = current;
@@ -719,17 +708,13 @@ CcRosCreateVacb (
                         current);
             }
 #endif
-            KeReleaseMutex(&(*Vacb)->Mutex, FALSE);
+            CcRosReleaseVacbLock(*Vacb);
             KeReleaseGuardedMutex(&ViewLock);
             ExFreeToNPagedLookasideList(&VacbLookasideList, *Vacb);
             *Vacb = current;
             if (InterlockedCompareExchange(&current->PinCount, 0, 0) == 0)
             {
-                KeWaitForSingleObject(&current->Mutex,
-                                      Executive,
-                                      KernelMode,
-                                      FALSE,
-                                      NULL);
+                CcRosAcquireVacbLock(current, NULL);
             }
             return STATUS_SUCCESS;
         }
@@ -962,7 +947,7 @@ CcFlushCache (
 
                 if (InterlockedCompareExchange(&current->PinCount, 0, 0) == 0)
                 {
-                    KeReleaseMutex(&current->Mutex, FALSE);
+                    CcRosReleaseVacbLock(current);
                 }
 
                 KeAcquireGuardedMutex(&ViewLock);