Author: tfaber
Date: Sun Sep 29 21:08:15 2013
New Revision: 60457
URL:
http://svn.reactos.org/svn/reactos?rev=60457&view=rev
Log:
[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
Modified:
trunk/reactos/ntoskrnl/cc/copy.c
trunk/reactos/ntoskrnl/cc/fs.c
trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/ntoskrnl/cc/copy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/copy.c?rev=604…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] Sun Sep 29 21:08:15 2013
@@ -371,6 +371,8 @@
IoStatus->Information = 0;
return FALSE;
}
+ if (current->FileOffset >= ReadOffset + Length)
+ break;
current_entry = current_entry->Flink;
}
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@@ -484,6 +486,8 @@
/* datas not available */
return FALSE;
}
+ if (CacheSeg->FileOffset >= WriteOffset + Length)
+ break;
current_entry = current_entry->Flink;
}
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@@ -683,7 +687,7 @@
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 @@
/* datas not available */
return FALSE;
}
+ if (CacheSeg->FileOffset >= WriteOffset.u.LowPart + Length)
+ break;
current_entry = current_entry->Flink;
}
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
Modified: trunk/reactos/ntoskrnl/cc/fs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/fs.c?rev=60457…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/fs.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/fs.c [iso-8859-1] Sun Sep 29 21:08:15 2013
@@ -163,8 +163,7 @@
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))
{
Modified: trunk/reactos/ntoskrnl/cc/view.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?rev=604…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] Sun Sep 29 21:08:15 2013
@@ -487,6 +487,8 @@
NULL);
return current;
}
+ if (current->FileOffset > FileOffset)
+ break;
current_entry = current_entry->Flink;
}
@@ -686,18 +688,12 @@
}
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. */