mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
- Check if a file object is on the close list and remove it from the list in CcRosRefernceCache.
- Sort the cache segments for the bcb by offsets. svn path=/trunk/; revision=4759
This commit is contained in:
parent
939d5316af
commit
10acad2b71
1 changed files with 41 additions and 2 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: view.c,v 1.59 2003/05/17 15:27:34 ekohl Exp $
|
||||
/* $Id: view.c,v 1.60 2003/05/25 21:49:04 hbirr Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/cc/view.c
|
||||
|
@ -454,6 +454,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
{
|
||||
ULONG i;
|
||||
PCACHE_SEGMENT current;
|
||||
PCACHE_SEGMENT previous;
|
||||
PLIST_ENTRY current_entry;
|
||||
NTSTATUS Status;
|
||||
KIRQL oldIrql;
|
||||
|
@ -486,6 +487,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
*/
|
||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
|
||||
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||
previous = NULL;
|
||||
while (current_entry != &Bcb->BcbSegmentListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
|
||||
|
@ -505,11 +507,32 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
if (current->FileOffset < FileOffset)
|
||||
{
|
||||
if (previous == NULL)
|
||||
{
|
||||
previous = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previous->FileOffset < current->FileOffset)
|
||||
{
|
||||
previous = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
/* There was no existing segment. */
|
||||
current = *CacheSeg;
|
||||
InsertTailList(&Bcb->BcbSegmentListHead, ¤t->BcbSegmentListEntry);
|
||||
if (previous)
|
||||
{
|
||||
InsertHeadList(&previous->BcbSegmentListEntry, ¤t->BcbSegmentListEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertHeadList(&Bcb->BcbSegmentListHead, ¤t->BcbSegmentListEntry);
|
||||
}
|
||||
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
||||
InsertTailList(&CacheSegmentListHead, ¤t->CacheSegmentListEntry);
|
||||
InsertTailList(&CacheSegmentLRUListHead, ¤t->CacheSegmentLRUListEntry);
|
||||
|
@ -665,6 +688,10 @@ CcRosGetCacheSegment(PBCB Bcb,
|
|||
* Otherwise create a new segment.
|
||||
*/
|
||||
Status = CcRosCreateCacheSegment(Bcb, FileOffset, ¤t, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Return information about the segment to the caller.
|
||||
|
@ -946,6 +973,17 @@ VOID CcRosReferenceCache(PFILE_OBJECT FileObject)
|
|||
ExAcquireFastMutex(&ViewLock);
|
||||
Bcb = (PBCB)FileObject->SectionObjectPointers->SharedCacheMap;
|
||||
assert(Bcb);
|
||||
if (Bcb->RefCount == 0)
|
||||
{
|
||||
assert(Bcb->BcbRemoveListEntry.Flink != NULL);
|
||||
RemoveEntryList(&Bcb->BcbRemoveListEntry);
|
||||
Bcb->BcbRemoveListEntry.Flink = NULL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(Bcb->BcbRemoveListEntry.Flink == NULL);
|
||||
}
|
||||
Bcb->RefCount++;
|
||||
ExReleaseFastMutex(&ViewLock);
|
||||
}
|
||||
|
@ -1179,6 +1217,7 @@ CcInitView(VOID)
|
|||
CI_CACHESEG_MAPPING_REGION_SIZE,
|
||||
0,
|
||||
&marea,
|
||||
FALSE,
|
||||
FALSE);
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
Loading…
Reference in a new issue