[NTOS:CC] Get rid of ROS_VACB:Valid

This commit is contained in:
Jérôme Gardou 2021-01-05 10:41:41 +01:00
parent e46f1a9af3
commit 9b6240ee03
4 changed files with 17 additions and 33 deletions

View file

@ -227,12 +227,12 @@ CcPerformReadAhead(
CurrentOffset % VACB_MAPPING_GRANULARITY, PartialLength);
if (!NT_SUCCESS(Status))
{
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
DPRINT1("Failed to read data: %lx!\n", Status);
goto Clear;
}
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
Length -= PartialLength;
CurrentOffset += PartialLength;
@ -254,12 +254,12 @@ CcPerformReadAhead(
Status = CcRosEnsureVacbResident(Vacb, TRUE, FALSE, 0, PartialLength);
if (!NT_SUCCESS(Status))
{
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
DPRINT1("Failed to read data: %lx!\n", Status);
goto Clear;
}
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
Length -= PartialLength;
CurrentOffset += PartialLength;
@ -548,7 +548,7 @@ CcCopyRead (
}
_SEH2_FINALLY
{
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
}
_SEH2_END;
}
@ -653,7 +653,7 @@ CcCopyWrite (
_SEH2_FINALLY
{
/* Do not mark the VACB as dirty if an exception was raised */
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(), FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, !_SEH2_AbnormalTermination(), FALSE);
}
_SEH2_END;
}
@ -905,7 +905,7 @@ CcZeroData (
_SEH2_FINALLY
{
/* Do not mark the VACB as dirty if an exception was raised */
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(), FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, !_SEH2_AbnormalTermination(), FALSE);
}
_SEH2_END;
}

View file

@ -91,7 +91,6 @@ CcpDereferenceBcb(
*/
CcRosReleaseVacb(SharedCacheMap,
Bcb->Vacb,
TRUE,
FALSE,
FALSE);
@ -121,7 +120,7 @@ CcpGetAppropriateBcb(
iBcb = ExAllocateFromNPagedLookasideList(&iBcbLookasideList);
if (iBcb == NULL)
{
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
return NULL;
}
@ -172,7 +171,7 @@ CcpGetAppropriateBcb(
if (DupBcb != NULL)
{
/* Delete the loser */
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
ExDeleteResourceLite(&iBcb->Lock);
ExFreeToNPagedLookasideList(&iBcbLookasideList, iBcb);
}
@ -282,7 +281,7 @@ CcpPinData(
NewBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, Flags, TRUE);
if (NewBcb == NULL)
{
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
return FALSE;
}
}
@ -383,7 +382,7 @@ CcMapData (
iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE);
if (iBcb == NULL)
{
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
SharedCacheMap->FileObject, FileOffset, Length, Flags);
return FALSE;
@ -660,7 +659,6 @@ CcUnpinRepinnedBcb (
*/
CcRosReleaseVacb(iBcb->Vacb->SharedCacheMap,
iBcb->Vacb,
TRUE,
FALSE,
FALSE);

View file

@ -342,17 +342,13 @@ NTAPI
CcRosReleaseVacb (
PROS_SHARED_CACHE_MAP SharedCacheMap,
PROS_VACB Vacb,
BOOLEAN Valid,
BOOLEAN Dirty,
BOOLEAN Mapped)
{
ULONG Refs;
ASSERT(SharedCacheMap);
DPRINT("CcRosReleaseVacb(SharedCacheMap 0x%p, Vacb 0x%p, Valid %u)\n",
SharedCacheMap, Vacb, Valid);
Vacb->Valid = Valid;
DPRINT("CcRosReleaseVacb(SharedCacheMap 0x%p, Vacb 0x%p)\n", SharedCacheMap, Vacb);
if (Dirty && !Vacb->Dirty)
{
@ -595,7 +591,6 @@ CcRosCreateVacb (
current = ExAllocateFromNPagedLookasideList(&VacbLookasideList);
current->BaseAddress = NULL;
current->Valid = FALSE;
current->Dirty = FALSE;
current->PageOut = FALSE;
current->FileOffset.QuadPart = ROUND_DOWN(FileOffset, VACB_MAPPING_GRANULARITY);
@ -947,7 +942,7 @@ CcFlushCache (
}
}
CcRosReleaseVacb(SharedCacheMap, current, current->Valid, FALSE, FALSE);
CcRosReleaseVacb(SharedCacheMap, current, FALSE, FALSE);
}
Offset.QuadPart += VACB_MAPPING_GRANULARITY;
@ -1371,14 +1366,14 @@ ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
UNICODE_STRING NoName = RTL_CONSTANT_STRING(L"No name for File");
KdbpPrint(" Usage Summary (in kb)\n");
KdbpPrint("Shared\t\tValid\tDirty\tName\n");
KdbpPrint("Shared\t\tMapped\tDirty\tName\n");
/* No need to lock the spin lock here, we're in DBG */
for (ListEntry = CcCleanSharedCacheMapList.Flink;
ListEntry != &CcCleanSharedCacheMapList;
ListEntry = ListEntry->Flink)
{
PLIST_ENTRY Vacbs;
ULONG Valid = 0, Dirty = 0;
ULONG Mapped = 0, Dirty = 0;
PROS_SHARED_CACHE_MAP SharedCacheMap;
PUNICODE_STRING FileName;
PWSTR Extra = L"";
@ -1393,13 +1388,7 @@ ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
Vacbs != &SharedCacheMap->CacheMapVacbListHead;
Vacbs = Vacbs->Flink)
{
PROS_VACB Vacb;
Vacb = CONTAINING_RECORD(Vacbs, ROS_VACB, CacheMapVacbListEntry);
if (Vacb->Valid)
{
Valid += VACB_MAPPING_GRANULARITY / 1024;
}
Mapped += VACB_MAPPING_GRANULARITY / 1024;
}
/* Setup name */
@ -1423,7 +1412,7 @@ ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
}
/* And print */
KdbpPrint("%p\t%d\t%d\t%wZ%S\n", SharedCacheMap, Valid, Dirty, FileName, Extra);
KdbpPrint("%p\t%d\t%d\t%wZ%S\n", SharedCacheMap, Mapped, Dirty, FileName, Extra);
}
return TRUE;

View file

@ -206,8 +206,6 @@ typedef struct _ROS_VACB
{
/* Base address of the region where the view's data is mapped. */
PVOID BaseAddress;
/* Are the contents of the view valid. */
BOOLEAN Valid;
/* Are the contents of the view newer than those on disk. */
BOOLEAN Dirty;
/* Page out in progress */
@ -387,7 +385,6 @@ NTAPI
CcRosReleaseVacb(
PROS_SHARED_CACHE_MAP SharedCacheMap,
PROS_VACB Vacb,
BOOLEAN Valid,
BOOLEAN Dirty,
BOOLEAN Mapped
);