mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[NTOS:CC]
- A BCB's cache segment list is sorted -- so actually make use of that property during list traversal - Fix inverted wait condition in CcZeroData - Correct offset check in CcSetFileSizes CORE-7491 svn path=/trunk/; revision=60457
This commit is contained in:
parent
0df89bb1e8
commit
896b860e33
3 changed files with 15 additions and 14 deletions
|
@ -371,6 +371,8 @@ CcCopyRead (
|
|||
IoStatus->Information = 0;
|
||||
return FALSE;
|
||||
}
|
||||
if (current->FileOffset >= ReadOffset + Length)
|
||||
break;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
||||
|
@ -484,6 +486,8 @@ CcCopyWrite (
|
|||
/* datas not available */
|
||||
return FALSE;
|
||||
}
|
||||
if (CacheSeg->FileOffset >= WriteOffset + Length)
|
||||
break;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
||||
|
@ -683,7 +687,7 @@ CcZeroData (
|
|||
ULONG TempLength;
|
||||
|
||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||
if (Wait)
|
||||
if (!Wait)
|
||||
{
|
||||
/* testing, if the requested datas are available */
|
||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
|
||||
|
@ -702,6 +706,8 @@ CcZeroData (
|
|||
/* datas not available */
|
||||
return FALSE;
|
||||
}
|
||||
if (CacheSeg->FileOffset >= WriteOffset.u.LowPart + Length)
|
||||
break;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
||||
|
|
|
@ -163,8 +163,7 @@ CcSetFileSizes (
|
|||
CACHE_SEGMENT,
|
||||
BcbSegmentListEntry);
|
||||
current_entry = current_entry->Flink;
|
||||
if (current->FileOffset > FileSizes->AllocationSize.QuadPart ||
|
||||
(current->FileOffset == 0 && FileSizes->AllocationSize.QuadPart == 0))
|
||||
if (current->FileOffset >= FileSizes->AllocationSize.QuadPart)
|
||||
{
|
||||
if ((current->ReferenceCount == 0) || ((current->ReferenceCount == 1) && current->Dirty))
|
||||
{
|
||||
|
|
|
@ -487,6 +487,8 @@ CcRosLookupCacheSegment (
|
|||
NULL);
|
||||
return current;
|
||||
}
|
||||
if (current->FileOffset > FileOffset)
|
||||
break;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
|
@ -686,18 +688,12 @@ CcRosCreateCacheSegment (
|
|||
}
|
||||
if (current->FileOffset < FileOffset)
|
||||
{
|
||||
if (previous == NULL)
|
||||
{
|
||||
previous = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previous->FileOffset < current->FileOffset)
|
||||
{
|
||||
previous = current;
|
||||
}
|
||||
}
|
||||
ASSERT(previous == NULL ||
|
||||
previous->FileOffset < current->FileOffset);
|
||||
previous = current;
|
||||
}
|
||||
if (current->FileOffset > FileOffset)
|
||||
break;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
/* There was no existing segment. */
|
||||
|
|
Loading…
Reference in a new issue