projects
/
reactos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do the required flush when the last reference to a cache stripe is released.
[reactos.git]
/
reactos
/
ntoskrnl
/
cache
/
pinsup.c
diff --git
a/reactos/ntoskrnl/cache/pinsup.c
b/reactos/ntoskrnl/cache/pinsup.c
index
5531bbb
..
c2a4639
100644
(file)
--- a/
reactos/ntoskrnl/cache/pinsup.c
+++ b/
reactos/ntoskrnl/cache/pinsup.c
@@
-707,9
+707,9
@@
CcPreparePinWrite(IN PFILE_OBJECT FileObject,
return Result;
}
return Result;
}
-VOID
+BOOLEAN
NTAPI
NTAPI
-CcpUnpinData(IN PNOCC_BCB RealBcb)
+CcpUnpinData(IN PNOCC_BCB RealBcb
, BOOLEAN ReleaseBit
)
{
if (RealBcb->RefCount <= 2)
{
{
if (RealBcb->RefCount <= 2)
{
@@
-718,9
+718,11
@@
CcpUnpinData(IN PNOCC_BCB RealBcb)
{
DPRINT("Triggering exclusive waiter\n");
KeSetEvent(&RealBcb->ExclusiveWait, IO_NO_INCREMENT, FALSE);
{
DPRINT("Triggering exclusive waiter\n");
KeSetEvent(&RealBcb->ExclusiveWait, IO_NO_INCREMENT, FALSE);
- return;
+ return
TRUE
;
}
}
}
}
+ if (RealBcb->RefCount == 2 && !ReleaseBit)
+ return FALSE;
if (RealBcb->RefCount > 1)
{
DPRINT("Removing one reference #%x\n", RealBcb - CcCacheSections);
if (RealBcb->RefCount > 1)
{
DPRINT("Removing one reference #%x\n", RealBcb - CcCacheSections);
@@
-730,6
+732,7
@@
CcpUnpinData(IN PNOCC_BCB RealBcb)
if (RealBcb->RefCount == 1)
{
DPRINT("Clearing allocation bit #%x\n", RealBcb - CcCacheSections);
if (RealBcb->RefCount == 1)
{
DPRINT("Clearing allocation bit #%x\n", RealBcb - CcCacheSections);
+
RtlClearBit(CcCacheBitmap, RealBcb - CcCacheSections);
#ifdef PIN_WRITE_ONLY
RtlClearBit(CcCacheBitmap, RealBcb - CcCacheSections);
#ifdef PIN_WRITE_ONLY
@@
-745,6
+748,8
@@
CcpUnpinData(IN PNOCC_BCB RealBcb)
&OldProtect);
#endif
}
&OldProtect);
#endif
}
+
+ return TRUE;
}
\f
VOID
}
\f
VOID
@@
-753,13
+758,21
@@
CcUnpinData(IN PVOID Bcb)
{
PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb;
ULONG Selected = RealBcb - CcCacheSections;
{
PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb;
ULONG Selected = RealBcb - CcCacheSections;
+ BOOLEAN Released;
ASSERT(RealBcb >= CcCacheSections && RealBcb - CcCacheSections < CACHE_NUM_SECTIONS);
DPRINT("CcUnpinData Bcb #%x (RefCount %d)\n", Selected, RealBcb->RefCount);
CcpLock();
ASSERT(RealBcb >= CcCacheSections && RealBcb - CcCacheSections < CACHE_NUM_SECTIONS);
DPRINT("CcUnpinData Bcb #%x (RefCount %d)\n", Selected, RealBcb->RefCount);
CcpLock();
-
CcpUnpinData(RealBcb
);
+
Released = CcpUnpinData(RealBcb, FALSE
);
CcpUnlock();
CcpUnlock();
+
+ if (!Released) {
+ MiFlushMappedSection(RealBcb->BaseAddress, &RealBcb->FileOffset, &RealBcb->Map->FileSizes.FileSize, RealBcb->Dirty);
+ CcpLock();
+ CcpUnpinData(RealBcb, TRUE);
+ CcpUnlock();
+ }
}
VOID
}
VOID