mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:05:50 +00:00
[NTOSKRNL]
- Fix bad indentation svn path=/trunk/; revision=54671
This commit is contained in:
parent
9dc72d09dc
commit
7f9124d391
1 changed files with 115 additions and 115 deletions
|
@ -993,76 +993,76 @@ CcRosFreeCacheSegment(PBCB Bcb, PCACHE_SEGMENT CacheSeg)
|
||||||
*/
|
*/
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
|
CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
|
||||||
IN PLARGE_INTEGER FileOffset OPTIONAL,
|
IN PLARGE_INTEGER FileOffset OPTIONAL,
|
||||||
IN ULONG Length,
|
IN ULONG Length,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus)
|
OUT PIO_STATUS_BLOCK IoStatus)
|
||||||
{
|
{
|
||||||
PBCB Bcb;
|
PBCB Bcb;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
PCACHE_SEGMENT current;
|
PCACHE_SEGMENT current;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
DPRINT("CcFlushCache(SectionObjectPointers 0x%p, FileOffset 0x%p, Length %d, IoStatus 0x%p)\n",
|
DPRINT("CcFlushCache(SectionObjectPointers 0x%p, FileOffset 0x%p, Length %d, IoStatus 0x%p)\n",
|
||||||
SectionObjectPointers, FileOffset, Length, IoStatus);
|
SectionObjectPointers, FileOffset, Length, IoStatus);
|
||||||
|
|
||||||
if (SectionObjectPointers && SectionObjectPointers->SharedCacheMap)
|
if (SectionObjectPointers && SectionObjectPointers->SharedCacheMap)
|
||||||
{
|
{
|
||||||
Bcb = (PBCB)SectionObjectPointers->SharedCacheMap;
|
Bcb = (PBCB)SectionObjectPointers->SharedCacheMap;
|
||||||
ASSERT(Bcb);
|
ASSERT(Bcb);
|
||||||
if (FileOffset)
|
if (FileOffset)
|
||||||
{
|
{
|
||||||
Offset = *FileOffset;
|
Offset = *FileOffset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Offset.QuadPart = (LONGLONG)0;
|
Offset.QuadPart = (LONGLONG)0;
|
||||||
Length = Bcb->FileSize.u.LowPart;
|
Length = Bcb->FileSize.u.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoStatus)
|
if (IoStatus)
|
||||||
{
|
{
|
||||||
IoStatus->Status = STATUS_SUCCESS;
|
IoStatus->Status = STATUS_SUCCESS;
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Length > 0)
|
while (Length > 0)
|
||||||
{
|
{
|
||||||
current = CcRosLookupCacheSegment (Bcb, Offset.u.LowPart);
|
current = CcRosLookupCacheSegment (Bcb, Offset.u.LowPart);
|
||||||
if (current != NULL)
|
if (current != NULL)
|
||||||
{
|
{
|
||||||
if (current->Dirty)
|
if (current->Dirty)
|
||||||
{
|
{
|
||||||
Status = CcRosFlushCacheSegment(current);
|
Status = CcRosFlushCacheSegment(current);
|
||||||
if (!NT_SUCCESS(Status) && IoStatus != NULL)
|
if (!NT_SUCCESS(Status) && IoStatus != NULL)
|
||||||
{
|
{
|
||||||
IoStatus->Status = Status;
|
IoStatus->Status = Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
|
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
|
||||||
ExReleasePushLock(¤t->Lock);
|
ExReleasePushLock(¤t->Lock);
|
||||||
CcRosCacheSegmentDecRefCount(current);
|
CcRosCacheSegmentDecRefCount(current);
|
||||||
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset.QuadPart += Bcb->CacheSegmentSize;
|
Offset.QuadPart += Bcb->CacheSegmentSize;
|
||||||
if (Length > Bcb->CacheSegmentSize)
|
if (Length > Bcb->CacheSegmentSize)
|
||||||
{
|
{
|
||||||
Length -= Bcb->CacheSegmentSize;
|
Length -= Bcb->CacheSegmentSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Length = 0;
|
Length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IoStatus)
|
if (IoStatus)
|
||||||
{
|
{
|
||||||
IoStatus->Status = STATUS_INVALID_PARAMETER;
|
IoStatus->Status = STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -1072,68 +1072,68 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
|
||||||
* FUNCTION: Releases the BCB associated with a file object
|
* FUNCTION: Releases the BCB associated with a file object
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PCACHE_SEGMENT current;
|
PCACHE_SEGMENT current;
|
||||||
LIST_ENTRY FreeList;
|
LIST_ENTRY FreeList;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
ASSERT(Bcb);
|
ASSERT(Bcb);
|
||||||
|
|
||||||
Bcb->RefCount++;
|
Bcb->RefCount++;
|
||||||
KeReleaseGuardedMutex(&ViewLock);
|
KeReleaseGuardedMutex(&ViewLock);
|
||||||
|
|
||||||
CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, NULL);
|
CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, NULL);
|
||||||
|
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
Bcb->RefCount--;
|
Bcb->RefCount--;
|
||||||
if (Bcb->RefCount == 0)
|
if (Bcb->RefCount == 0)
|
||||||
{
|
{
|
||||||
if (Bcb->BcbRemoveListEntry.Flink != NULL)
|
if (Bcb->BcbRemoveListEntry.Flink != NULL)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&Bcb->BcbRemoveListEntry);
|
RemoveEntryList(&Bcb->BcbRemoveListEntry);
|
||||||
Bcb->BcbRemoveListEntry.Flink = NULL;
|
Bcb->BcbRemoveListEntry.Flink = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
|
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release all cache segments.
|
* Release all cache segments.
|
||||||
*/
|
*/
|
||||||
InitializeListHead(&FreeList);
|
InitializeListHead(&FreeList);
|
||||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
|
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
|
||||||
current_entry = Bcb->BcbSegmentListHead.Flink;
|
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||||
while (!IsListEmpty(&Bcb->BcbSegmentListHead))
|
while (!IsListEmpty(&Bcb->BcbSegmentListHead))
|
||||||
{
|
{
|
||||||
current_entry = RemoveTailList(&Bcb->BcbSegmentListHead);
|
current_entry = RemoveTailList(&Bcb->BcbSegmentListHead);
|
||||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
||||||
RemoveEntryList(¤t->CacheSegmentListEntry);
|
RemoveEntryList(¤t->CacheSegmentListEntry);
|
||||||
RemoveEntryList(¤t->CacheSegmentLRUListEntry);
|
RemoveEntryList(¤t->CacheSegmentLRUListEntry);
|
||||||
if (current->Dirty)
|
if (current->Dirty)
|
||||||
{
|
{
|
||||||
RemoveEntryList(¤t->DirtySegmentListEntry);
|
RemoveEntryList(¤t->DirtySegmentListEntry);
|
||||||
DirtyPageCount -= Bcb->CacheSegmentSize / PAGE_SIZE;
|
DirtyPageCount -= Bcb->CacheSegmentSize / PAGE_SIZE;
|
||||||
DPRINT1("Freeing dirty segment\n");
|
DPRINT1("Freeing dirty segment\n");
|
||||||
}
|
}
|
||||||
InsertHeadList(&FreeList, ¤t->BcbSegmentListEntry);
|
InsertHeadList(&FreeList, ¤t->BcbSegmentListEntry);
|
||||||
}
|
}
|
||||||
#if DBG
|
#if DBG
|
||||||
Bcb->Trace = FALSE;
|
Bcb->Trace = FALSE;
|
||||||
#endif
|
#endif
|
||||||
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
||||||
|
|
||||||
KeReleaseGuardedMutex(&ViewLock);
|
KeReleaseGuardedMutex(&ViewLock);
|
||||||
ObDereferenceObject (Bcb->FileObject);
|
ObDereferenceObject (Bcb->FileObject);
|
||||||
|
|
||||||
while (!IsListEmpty(&FreeList))
|
while (!IsListEmpty(&FreeList))
|
||||||
{
|
{
|
||||||
current_entry = RemoveTailList(&FreeList);
|
current_entry = RemoveTailList(&FreeList);
|
||||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
||||||
CcRosInternalFreeCacheSegment(current);
|
CcRosInternalFreeCacheSegment(current);
|
||||||
}
|
}
|
||||||
ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
|
ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
}
|
}
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue