Author: fireball
Date: Mon May 12 10:50:57 2008
New Revision: 33474
URL:
http://svn.reactos.org/svn/reactos?rev=33474&view=rev
Log:
- Completely remove ReactOS cache manager.
- NoCc: perform direct read and writes when requested, without any intermediate caching.
- Stub out Cc API (reorganized and renamed), remove CcRos exports.
- Some fixes to fastfat (paged reads on directories, silence debug warning).
- NoCc patch by Alex.
Added:
branches/nocc/ntoskrnl/cache/
branches/nocc/ntoskrnl/cache/cachesub.c (with props)
branches/nocc/ntoskrnl/cache/copysup.c (with props)
branches/nocc/ntoskrnl/cache/fssup.c (with props)
branches/nocc/ntoskrnl/cache/lazyrite.c (with props)
branches/nocc/ntoskrnl/cache/logsup.c (with props)
branches/nocc/ntoskrnl/cache/mdlsup.c (with props)
branches/nocc/ntoskrnl/cache/pinsup.c (with props)
branches/nocc/ntoskrnl/cache/vacbsup.c (with props)
Removed:
branches/nocc/ntoskrnl/cc/
Modified:
branches/nocc/drivers/filesystems/fastfat/misc.c
branches/nocc/drivers/filesystems/fastfat/rw.c
branches/nocc/ntoskrnl/fsrtl/fastio.c
branches/nocc/ntoskrnl/include/internal/cc.h
branches/nocc/ntoskrnl/mm/mpw.c
branches/nocc/ntoskrnl/mm/section.c
branches/nocc/ntoskrnl/ntoskrnl-generic.rbuild
branches/nocc/ntoskrnl/ntoskrnl_i386.def
Modified: branches/nocc/drivers/filesystems/fastfat/misc.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/drivers/filesystems/fastfa…
==============================================================================
--- branches/nocc/drivers/filesystems/fastfat/misc.c [iso-8859-1] (original)
+++ branches/nocc/drivers/filesystems/fastfat/misc.c [iso-8859-1] Mon May 12 10:50:57
2008
@@ -158,7 +158,7 @@
{
if (KeGetCurrentIrql() > PASSIVE_LEVEL)
{
- DPRINT1("Vfat is entered at irql = %d\n", KeGetCurrentIrql());
+ DPRINT("Vfat is entered at irql = %d\n", KeGetCurrentIrql());
}
FsRtlEnterFileSystem();
@@ -278,3 +278,4 @@
}
+
Modified: branches/nocc/drivers/filesystems/fastfat/rw.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/drivers/filesystems/fastfa…
==============================================================================
--- branches/nocc/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original)
+++ branches/nocc/drivers/filesystems/fastfat/rw.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -581,14 +581,6 @@
Length = IrpContext->Stack->Parameters.Read.Length;
BytesPerSector = IrpContext->DeviceExt->FatInfo.BytesPerSector;
- /* fail if file is a directory and no paged read */
- if (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY &&
!(IrpContext->Irp->Flags & IRP_PAGING_IO))
- {
- Status = STATUS_INVALID_PARAMETER;
- goto ByeBye;
- }
-
-
DPRINT("'%wZ', Offset: %d, Length %d\n", &Fcb->PathNameU,
ByteOffset.u.LowPart, Length);
if (ByteOffset.u.HighPart && !(Fcb->Flags & FCB_IS_VOLUME))
@@ -810,13 +802,6 @@
Status = IoCallDriver(IrpContext->DeviceExt->StorageDevice,
IrpContext->Irp);
VfatFreeIrpContext(IrpContext);
return Status;
- }
-
- /* fail if file is a directory and no paged read */
- if (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY &&
!(IrpContext->Irp->Flags & IRP_PAGING_IO))
- {
- Status = STATUS_INVALID_PARAMETER;
- goto ByeBye;
}
ByteOffset = IrpContext->Stack->Parameters.Write.ByteOffset;
@@ -1078,3 +1063,4 @@
}
+
Added: branches/nocc/ntoskrnl/cache/cachesub.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/cachesub.c?…
==============================================================================
--- branches/nocc/ntoskrnl/cache/cachesub.c (added)
+++ branches/nocc/ntoskrnl/cache/cachesub.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,111 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/cachesup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
+
+VOID
+NTAPI
+CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject,
+ IN ULONG Granularity)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcScheduleReadAhead(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcSetDirtyPinnedData(IN PVOID BcbVoid,
+ IN OPTIONAL PLARGE_INTEGER Lsn)
+{
+ BOOLEAN Result;
+ PNOCC_BCB InternalBcb = CONTAINING_RECORD(BcbVoid, NOCC_BCB, Bcb);
+
+ /* Write out the data immediately */
+ /* FIXME: This break transactional semantics, such as NTFS Logging */
+ Result = CcCopyWrite(InternalBcb->FileObject,
+ &InternalBcb->Bcb.MappedFileOffset,
+ InternalBcb->Bcb.MappedLength,
+ TRUE,
+ InternalBcb->CacheBuffer);
+ ASSERT(Result == TRUE);
+}
+
+LARGE_INTEGER
+NTAPI
+CcGetFlushedValidData(IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN BOOLEAN CcInternalCaller)
+{
+ LARGE_INTEGER Result = {{0}};
+ UNIMPLEMENTED;
+ while (TRUE);
+ return Result;
+}
+
+VOID
+NTAPI
+CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN OPTIONAL PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
+{
+ /* Nothing to flush */
+ if (IoStatus)
+ {
+ /* Lie to the caller that we did some work */
+ IoStatus->Information = Length;
+ IoStatus->Status = STATUS_SUCCESS;
+ }
+}
+
+PVOID
+NTAPI
+CcRemapBcb(IN PVOID Bcb)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return NULL;
+}
+
+
+VOID
+NTAPI
+CcRepinBcb(IN PVOID Bcb)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcUnpinRepinnedBcb(IN PVOID Bcb,
+ IN BOOLEAN WriteThrough,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/cachesub.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/copysup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/copysup.c?r…
==============================================================================
--- branches/nocc/ntoskrnl/cache/copysup.c (added)
+++ branches/nocc/ntoskrnl/cache/copysup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,370 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/copysup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+ULONG CcFastMdlReadWait;
+ULONG CcFastMdlReadNotPossible;
+ULONG CcFastReadNotPossible;
+ULONG CcFastReadWait;
+ULONG CcFastReadNoWait;
+ULONG CcFastReadResourceMiss;
+
+#define TAG_COPY_READ TAG('C', 'o', 'p', 'y')
+#define TAG_COPY_WRITE TAG('R', 'i', 't', 'e')
+
+/* FUNCTIONS ******************************************************************/
+
+BOOLEAN
+NTAPI
+CcCopyRead(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+ NTSTATUS Status;
+ ULONG AlignBase, AlignSize, DeltaBase;
+ LARGE_INTEGER SectorBase;
+ IO_STATUS_BLOCK IoStatusBlock = {{0}};
+ KEVENT Event;
+ PCHAR SystemBuffer;
+ PMDL Mdl;
+ BOOLEAN DirectRead = FALSE;
+ DPRINT("CcCopyRead(FileObject 0x%p, FileOffset %I64x, "
+ "Length %lx, Wait %d, Buffer 0x%p, IoStatus 0x%p)\n",
+ FileObject, FileOffset->QuadPart, Length, Wait,
+ Buffer, IoStatus);
+
+ /* Is this a page-aligned read? */
+ if (((Length % PAGE_SIZE) == 0) && ((FileOffset->QuadPart % PAGE_SIZE) ==
0))
+ {
+ /* Don't double-buffer */
+ DirectRead = TRUE;
+ }
+
+ /* Do we need to double-buffer? */
+ if (!DirectRead)
+ {
+ /* Align the buffer to page size */
+ AlignBase = ROUND_DOWN(FileOffset->QuadPart, PAGE_SIZE);
+ AlignSize = ROUND_UP(Length, PAGE_SIZE);
+ SectorBase.QuadPart = AlignBase;
+
+ /* Get the offset from page-aligned to request */
+ DeltaBase = FileOffset->QuadPart - AlignBase;
+
+ /* Our read may cross a page boundary, so account for that */
+ if ((DeltaBase + Length) > AlignSize) AlignSize += PAGE_SIZE;
+
+ /* Allocate a buffer */
+ SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, AlignSize, TAG_COPY_READ);
+ }
+ else
+ {
+ /* We'll reuse the caller's buffer */
+ SystemBuffer = Buffer;
+ AlignSize = Length;
+ SectorBase = *FileOffset;
+ DeltaBase = 0;
+ }
+
+ /* Create an MDL for the transfer */
+ Mdl = IoAllocateMdl(SystemBuffer, AlignSize, TRUE, FALSE, NULL);
+ MmBuildMdlForNonPagedPool(Mdl),
+ Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
+
+ /* Setup the event */
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+
+ /* Read the page */
+ Status = IoPageRead(FileObject, Mdl, &SectorBase, &Event,
&IoStatusBlock);
+ if (Status == STATUS_PENDING)
+ {
+ /* Do the wait */
+ KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+ Status = IoStatusBlock.Status;
+ }
+ if (!NT_SUCCESS(Status)) DPRINT1("Status: %lx\n", Status);
+ ASSERT(NT_SUCCESS(Status));
+
+ /* Did we double buffer? */
+ if (!DirectRead)
+ {
+ /* Now copy the actual data the caller expected */
+ RtlCopyMemory(Buffer, SystemBuffer + DeltaBase, Length);
+
+ /* Free our copy */
+ ExFreePool(SystemBuffer);
+ }
+
+ /* Free the MDL */
+ IoFreeMdl(Mdl);
+
+ /* Check if we read less than the caller wanted */
+ if (IoStatusBlock.Information < Length)
+ {
+ /* Only then do we write the real size */
+ IoStatus->Information = IoStatusBlock.Information;
+ }
+ else
+ {
+ /* Otherwise, we'll fake that we read as much as the caller wanted */
+ IoStatus->Information = Length;
+ }
+
+ /* Write status block */
+ IoStatus->Status = Status;
+ return TRUE;
+}
+
+VOID
+NTAPI
+CcFastCopyRead(IN PFILE_OBJECT FileObject,
+ IN ULONG FileOffset,
+ IN ULONG Length,
+ IN ULONG PageCount,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+BOOLEAN
+NTAPI
+CcCopyWrite(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN PVOID Buffer)
+{
+ NTSTATUS Status;
+ ULONG AlignBase, AlignSize, DeltaBase, WriteEnd, AlignEnd, DeltaEnd;
+ LARGE_INTEGER SectorBase, ReadSector;
+ IO_STATUS_BLOCK IoStatusBlock;
+ KEVENT Event;
+ PCHAR SystemBuffer;
+ PMDL Mdl, ReadMdl;
+ BOOLEAN DirectWrite = FALSE;
+ DPRINT("CcCopyWrite(FileObject 0x%p, FileOffset %I64x, "
+ "Length %lx, Wait %d, Buffer 0x%p)\n",
+ FileObject, FileOffset->QuadPart, Length, Wait,
+ Buffer);
+ DPRINT("File name: %wZ\n", &FileObject->FileName);
+
+ /* It this a page-aligned write? If so, we don't need to double-buffer */
+ if (((Length % PAGE_SIZE) == 0) && ((FileOffset->QuadPart % PAGE_SIZE) ==
0))
+ {
+ /* Don't double-buffer */
+ DirectWrite = TRUE;
+ }
+
+ /* Do we need to double-buffer? */
+ if (!DirectWrite)
+ {
+ /* Align the buffer to page size */
+ AlignBase = ROUND_DOWN(FileOffset->QuadPart, PAGE_SIZE);
+ AlignSize = ROUND_UP(Length, PAGE_SIZE);
+ WriteEnd = FileOffset->QuadPart + Length;
+ AlignEnd = ROUND_UP(WriteEnd, PAGE_SIZE);
+ SectorBase.QuadPart = AlignBase;
+
+ /* Get the offset from page-aligned to request */
+ DeltaBase = FileOffset->QuadPart - AlignBase;
+ DeltaEnd = AlignEnd - WriteEnd;
+
+ /* Our write may cross a page boundary, so account for that */
+ if ((DeltaBase + Length) > AlignSize) AlignSize += PAGE_SIZE;
+
+ /* Allocate a buffer */
+ SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, AlignSize, TAG_COPY_WRITE);
+ }
+ else
+ {
+ /* We'll reuse the caller's buffer */
+ SystemBuffer = Buffer;
+ AlignSize = Length;
+ SectorBase = *FileOffset;
+ DeltaBase = 0;
+ }
+
+ /* Setup the event */
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+
+ /* Create an MDL for the write transfer */
+ Mdl = IoAllocateMdl(SystemBuffer, AlignSize, TRUE, FALSE, NULL);
+ MmBuildMdlForNonPagedPool(Mdl),
+ Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
+
+ /* If this is double-buffered, we'll need the aligned original data */
+ if (!DirectWrite)
+ {
+ //
+ // We only want to make two reads at most. Suppose:
+ //
+ // [ ]
+ // --------------------------------------------------------------
+ // | | | | | | |
+ // | | | | | | |
+ // | | | | | | |
+ // --------------------------------------------------------------
+ // [ ]
+ //
+ // Is the region being written to. Our approach will be to:
+ //
+ // 1) Allocate a buffer large enough for the entire page-bounded region
+ // 2) Read the original data at the left of the [
+ // 3) Read the original data at the right of the ]
+ // 4) Copy the caller's buffer on top of ours, at the right offset
+ //
+ // We can optimize a read away if either the [ region is page-aligned or
+ // if the ] region is page-aligned.
+ //
+ // If both are page-aligned, we've already optimized this and we
wouldn't
+ // be in this path.
+ //
+ // It is also possible for the request to be less than a single page!
+ // In this case, we'll only do the first I/O and skip ths second, and
+ // we'll slightly modify our buffer copy to only cover 1 page.
+ //
+ if (DeltaBase)
+ {
+ /* Create an MDL for the read transfer */
+ ReadMdl = IoAllocateMdl(SystemBuffer, PAGE_SIZE, TRUE, FALSE, NULL);
+ MmBuildMdlForNonPagedPool(ReadMdl),
+ ReadMdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
+
+ /* We have an offset from a page boundary, so we need to do a read */
+ ReadSector = SectorBase;
+ Status = IoPageRead(FileObject,
+ ReadMdl,
+ &ReadSector,
+ &Event,
+ &IoStatusBlock);
+ if (Status == STATUS_PENDING)
+ {
+ /* Do the wait */
+ KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+ Status = IoStatusBlock.Status;
+ }
+
+ /* This shouldn't fail */
+ ASSERT(NT_SUCCESS(Status));
+
+ /* Free the MDL */
+ IoFreeMdl(ReadMdl);
+ }
+
+ /* Now check if we read up to a page boundary, or have an offset */
+ if ((DeltaEnd))// && (Length > PAGE_SIZE))
+ {
+ /* Create an MDL for the read transfer */
+ ReadMdl = IoAllocateMdl(SystemBuffer + ROUND_DOWN(Length, PAGE_SIZE),
+ PAGE_SIZE,
+ TRUE,
+ FALSE,
+ NULL);
+ MmBuildMdlForNonPagedPool(ReadMdl),
+ ReadMdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
+
+ /* We have an offset from a page boundary, so we need to do a read */
+ ReadSector.QuadPart += ROUND_DOWN(Length, PAGE_SIZE);
+ Status = IoPageRead(FileObject,
+ ReadMdl,
+ &SectorBase,
+ &Event,
+ &IoStatusBlock);
+ if (Status == STATUS_PENDING)
+ {
+ /* Do the wait */
+ KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+ Status = IoStatusBlock.Status;
+ }
+
+ /* This shouldn't fail */
+ ASSERT(NT_SUCCESS(Status));
+
+ /* Free the MDL */
+ IoFreeMdl(ReadMdl);
+ }
+
+ /* Okay, now we have the original data, write our modified data on top */
+ ASSERT((SystemBuffer + DeltaBase + Length) <= (SystemBuffer + AlignSize));
+ RtlCopyMemory(SystemBuffer + DeltaBase, Buffer, Length);
+ }
+
+ /* And write the modified contents back */
+ Status = IoSynchronousPageWrite(FileObject,
+ Mdl,
+ &SectorBase,
+ &Event,
+ &IoStatusBlock);
+ if (Status == STATUS_PENDING)
+ {
+ /* Do the wait */
+ KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+ Status = IoStatusBlock.Status;
+ }
+ if (!NT_SUCCESS(Status)) DPRINT1("Status: %lx\n", Status);
+ ASSERT(NT_SUCCESS(Status));
+
+ /* Free our buffer */
+ if (!DirectWrite) ExFreePool(SystemBuffer);
+
+ /* Free the MDL */
+ IoFreeMdl(Mdl);
+
+ /* FIXME:? Check if we wrote less than the caller wanted */
+ return TRUE;
+}
+
+VOID
+NTAPI
+CcFastCopyWrite(IN PFILE_OBJECT FileObject,
+ IN ULONG FileOffset,
+ IN ULONG Length,
+ IN PVOID Buffer)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+BOOLEAN
+NTAPI
+CcCanIWrite(IN PFILE_OBJECT FileObject,
+ IN ULONG BytesToWrite,
+ IN BOOLEAN Wait,
+ IN UCHAR Retrying)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+VOID
+NTAPI
+CcDeferWrite(IN PFILE_OBJECT FileObject,
+ IN PCC_POST_DEFERRED_WRITE PostRoutine,
+ IN PVOID Context1,
+ IN PVOID Context2,
+ IN ULONG BytesToWrite,
+ IN BOOLEAN Retrying)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/copysup.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/fssup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/fssup.c?rev…
==============================================================================
--- branches/nocc/ntoskrnl/cache/fssup.c (added)
+++ branches/nocc/ntoskrnl/cache/fssup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,131 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/fssup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+PFSN_PREFETCHER_GLOBALS CcPfGlobals;
+
+/* FUNCTIONS ******************************************************************/
+
+BOOLEAN
+NTAPI
+CcInitializeCacheManager(VOID)
+{
+ /* Nothing to do */
+ return TRUE;
+}
+
+VOID
+NTAPI
+CcPfInitializePrefetcher(VOID)
+{
+ /* Notify debugger */
+ DbgPrintEx(DPFLTR_PREFETCHER_ID,
+ DPFLTR_TRACE_LEVEL,
+ "CCPF: InitializePrefetecher()\n");
+
+ /* Setup the Prefetcher Data */
+ InitializeListHead(&CcPfGlobals.ActiveTraces);
+ InitializeListHead(&CcPfGlobals.CompletedTraces);
+ ExInitializeFastMutex(&CcPfGlobals.CompletedTracesLock);
+
+ /* FIXME: Setup the rest of the prefetecher */
+}
+
+VOID
+NTAPI
+CcInitializeCacheMap(IN PFILE_OBJECT FileObject,
+ IN PCC_FILE_SIZES FileSizes,
+ IN BOOLEAN PinAccess,
+ IN PCACHE_MANAGER_CALLBACKS Callbacks,
+ IN PVOID LazyWriteContext)
+{
+ /* Setup a fake cache map pointer */
+ FileObject->SectionObjectPointer->SharedCacheMap = (PVOID)0xBAADF00D;
+ return;
+}
+
+BOOLEAN
+NTAPI
+CcUninitializeCacheMap(IN PFILE_OBJECT FileObject,
+ IN OPTIONAL PLARGE_INTEGER TruncateSize,
+ IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
+{
+ ASSERT(UninitializeEvent == NULL);
+
+ /* Clear the cache map */
+ FileObject->SectionObjectPointer->SharedCacheMap = NULL;
+ return TRUE;
+}
+
+VOID
+NTAPI
+CcSetFileSizes(IN PFILE_OBJECT FileObject,
+ IN PCC_FILE_SIZES FileSizes)
+{
+ /* Nothing to do */
+}
+
+BOOLEAN
+NTAPI
+CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN OPTIONAL PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN UninitializeCacheMaps)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+VOID
+NTAPI
+CcSetDirtyPageThreshold(IN PFILE_OBJECT FileObject,
+ IN ULONG DirtyPageThreshold)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+BOOLEAN
+NTAPI
+CcZeroData(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER StartOffset,
+ IN PLARGE_INTEGER EndOffset,
+ IN BOOLEAN Wait)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+PFILE_OBJECT
+NTAPI
+CcGetFileObjectFromSectionPtrs(IN PSECTION_OBJECT_POINTERS SectionObjectPointer)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return NULL;
+}
+
+PFILE_OBJECT
+NTAPI
+CcGetFileObjectFromBcb(IN PVOID Bcb)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return NULL;
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/fssup.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/lazyrite.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/lazyrite.c?…
==============================================================================
--- branches/nocc/ntoskrnl/cache/lazyrite.c (added)
+++ branches/nocc/ntoskrnl/cache/lazyrite.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,28 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/lazyrite.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
+
+NTSTATUS
+NTAPI
+CcWaitForCurrentLazyWriterActivity(VOID)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return STATUS_SUCCESS;
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/lazyrite.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/logsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/logsup.c?re…
==============================================================================
--- branches/nocc/ntoskrnl/cache/logsup.c (added)
+++ branches/nocc/ntoskrnl/cache/logsup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,72 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/logsup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
+
+VOID
+NTAPI
+CcSetAdditionalCacheAttributes(IN PFILE_OBJECT FileObject,
+ IN BOOLEAN DisableReadAhead,
+ IN BOOLEAN DisableWriteBehind)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcSetLogHandleForFile(IN PFILE_OBJECT FileObject,
+ IN PVOID LogHandle,
+ IN PFLUSH_TO_LSN FlushToLsnRoutine)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+LARGE_INTEGER
+NTAPI
+CcGetDirtyPages(IN PVOID LogHandle,
+ IN PDIRTY_PAGE_ROUTINE DirtyPageRoutine,
+ IN PVOID Context1,
+ IN PVOID Context2)
+{
+ LARGE_INTEGER Result = {{0}};
+ UNIMPLEMENTED;
+ while (TRUE);
+ return Result;
+}
+
+BOOLEAN
+NTAPI
+CcIsThereDirtyData(IN PVPB Vpb)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+LARGE_INTEGER
+NTAPI
+CcGetLsnForFileObject(IN PFILE_OBJECT FileObject,
+ OUT OPTIONAL PLARGE_INTEGER OldestLsn)
+{
+ LARGE_INTEGER Result = {{0}};
+ UNIMPLEMENTED;
+ while (TRUE);
+ return Result;
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/logsup.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/mdlsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/mdlsup.c?re…
==============================================================================
--- branches/nocc/ntoskrnl/cache/mdlsup.c (added)
+++ branches/nocc/ntoskrnl/cache/mdlsup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,90 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/logsup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
+
+VOID
+NTAPI
+CcMdlRead(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcMdlReadComplete(IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcMdlReadComplete2(IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcMdlWriteAbort(IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/mdlsup.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/pinsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/pinsup.c?re…
==============================================================================
--- branches/nocc/ntoskrnl/cache/pinsup.c (added)
+++ branches/nocc/ntoskrnl/cache/pinsup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,138 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/pinsup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+#define TAG_MAP_READ TAG('M', 'c', 'p', 'y')
+#define TAG_MAP_BCB TAG('B', 'c', 'b', ' ')
+
+/* FUNCTIONS ******************************************************************/
+
+BOOLEAN
+NTAPI
+CcMapData(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG Flags,
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer)
+{
+ PVOID CacheBuffer;
+ IO_STATUS_BLOCK IoStatusBlock;
+ PNOCC_BCB InternalBcb;
+ BOOLEAN Result;
+ DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lx, Flags
%d,"
+ " Bcb 0x%p, Buffer 0x%p)\n", FileObject, FileOffset->QuadPart,
+ Length, Flags, Bcb, Buffer);
+
+ /* Allocate a buffer for the caller */
+ CacheBuffer = ExAllocatePoolWithTag(NonPagedPool, Length, TAG_MAP_READ);
+
+ /* Copy the data the caller requested */
+ /* FIXME: Ignore flags */
+ Result = CcCopyRead(FileObject,
+ FileOffset,
+ Length,
+ TRUE,
+ CacheBuffer,
+ &IoStatusBlock);
+ ASSERT(Result == 1);
+
+ /* Build a BCB so we'll know about this block later */
+ InternalBcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NOCC_BCB), TAG_MAP_BCB);
+ InternalBcb->Bcb.NodeTypeCode = 0xDE45;
+ InternalBcb->Bcb.NodeByteSize = sizeof(PUBLIC_BCB);
+ InternalBcb->Bcb.MappedLength = Length;
+ InternalBcb->Bcb.MappedFileOffset = *FileOffset;
+ InternalBcb->CacheBuffer = CacheBuffer;
+ InternalBcb->RealLength = IoStatusBlock.Information;
+ InternalBcb->FileObject = FileObject;
+
+ /* Return buffer and BCB */
+ *Bcb = InternalBcb;
+ *Buffer = CacheBuffer;
+ return TRUE;
+}
+
+BOOLEAN
+NTAPI
+CcPinMappedData(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG Flags,
+ IN OUT PVOID *Bcb)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+BOOLEAN
+NTAPI
+CcPinRead(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG Flags,
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer)
+{
+ /* Just treat this as a map */
+ return CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer);
+}
+
+BOOLEAN
+NTAPI
+CcPreparePinWrite(IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Zero,
+ IN ULONG Flags,
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+ return FALSE;
+}
+
+VOID
+NTAPI
+CcUnpinData(IN PVOID Bcb)
+{
+ PNOCC_BCB InternalBcb = CONTAINING_RECORD(Bcb, NOCC_BCB, Bcb);
+
+ /* Our data is never dirty -- we don't lazy write, so just free the buffer */
+ ExFreePool(InternalBcb->CacheBuffer);
+ ExFreePool(InternalBcb);
+}
+
+VOID
+NTAPI
+CcSetBcbOwnerPointer(IN PVOID Bcb,
+ IN PVOID OwnerPointer)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+VOID
+NTAPI
+CcUnpinDataForThread(IN PVOID Bcb,
+ IN ERESOURCE_THREAD ResourceThreadId)
+{
+ UNIMPLEMENTED;
+ while (TRUE);
+}
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/pinsup.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/nocc/ntoskrnl/cache/vacbsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/cache/vacbsup.c?r…
==============================================================================
--- branches/nocc/ntoskrnl/cache/vacbsup.c (added)
+++ branches/nocc/ntoskrnl/cache/vacbsup.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -1,0 +1,19 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * FILE: ntoskrnl/cache/vacbsup.c
+ * PURPOSE: Logging and configuration routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* FUNCTIONS ******************************************************************/
+
+/* EOF */
Propchange: branches/nocc/ntoskrnl/cache/vacbsup.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/nocc/ntoskrnl/fsrtl/fastio.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/fsrtl/fastio.c?re…
==============================================================================
--- branches/nocc/ntoskrnl/fsrtl/fastio.c [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/fsrtl/fastio.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -897,7 +897,7 @@
IN PDEVICE_OBJECT DeviceObject)
{
/* Call the Cache Manager */
- CcMdlReadComplete2(MemoryDescriptorList, FileObject);
+ CcMdlReadComplete2(FileObject, MemoryDescriptorList);
return TRUE;
}
@@ -1438,3 +1438,4 @@
return STATUS_NOT_IMPLEMENTED;
}
+
Modified: branches/nocc/ntoskrnl/include/internal/cc.h
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/include/internal/…
==============================================================================
--- branches/nocc/ntoskrnl/include/internal/cc.h [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/include/internal/cc.h [iso-8859-1] Mon May 12 10:50:57 2008
@@ -102,67 +102,20 @@
LONG ActivePrefetches;
} PFSN_PREFETCHER_GLOBALS, *PPFSN_PREFETCHER_GLOBALS;
-typedef struct _BCB
+typedef struct _NOCC_BCB
{
- LIST_ENTRY BcbSegmentListHead;
- LIST_ENTRY BcbRemoveListEntry;
- BOOLEAN RemoveOnClose;
- ULONG TimeStamp;
+ /* Public part */
+ PUBLIC_BCB Bcb;
+
+ /* So we know where the buffer is */
+ PVOID CacheBuffer;
+
+ /* So we know the initial request that was made */
PFILE_OBJECT FileObject;
- ULONG CacheSegmentSize;
- LARGE_INTEGER AllocationSize;
- LARGE_INTEGER FileSize;
- PCACHE_MANAGER_CALLBACKS Callbacks;
- PVOID LazyWriteContext;
- KSPIN_LOCK BcbLock;
- ULONG RefCount;
-#if defined(DBG) || defined(KDBG)
- BOOLEAN Trace; /* enable extra trace output for this BCB and it's cache segments */
-#endif
-} BCB, *PBCB;
-typedef struct _CACHE_SEGMENT
-{
- /* Base address of the region where the cache segment data is mapped. */
- PVOID BaseAddress;
- /*
- * Memory area representing the region where the cache segment data is
- * mapped.
- */
- struct _MEMORY_AREA* MemoryArea;
- /* Are the contents of the cache segment data valid. */
- BOOLEAN Valid;
- /* Are the contents of the cache segment data newer than those on disk. */
- BOOLEAN Dirty;
- /* Page out in progress */
- BOOLEAN PageOut;
- ULONG MappedCount;
- /* Entry in the list of segments for this BCB. */
- LIST_ENTRY BcbSegmentListEntry;
- /* Entry in the list of segments which are dirty. */
- LIST_ENTRY DirtySegmentListEntry;
- /* Entry in the list of segments. */
- LIST_ENTRY CacheSegmentListEntry;
- LIST_ENTRY CacheSegmentLRUListEntry;
- /* Offset in the file which this cache segment maps. */
- ULONG FileOffset;
- /* Lock. */
- EX_PUSH_LOCK Lock;
- /* Number of references. */
- ULONG ReferenceCount;
- /* Pointer to the BCB for the file which this cache segment maps data for. */
- PBCB Bcb;
- /* Pointer to the next cache segment in a chain. */
- struct _CACHE_SEGMENT* NextInChain;
-} CACHE_SEGMENT, *PCACHE_SEGMENT;
-
-typedef struct _INTERNAL_BCB
-{
- PUBLIC_BCB PFCB;
- PCACHE_SEGMENT CacheSegment;
- BOOLEAN Dirty;
- CSHORT RefCount; /* (At offset 0x34 on WinNT4) */
-} INTERNAL_BCB, *PINTERNAL_BCB;
+ /* Actual data we ended up reading */
+ ULONG RealLength;
+} NOCC_BCB, *PNOCC_BCB;
VOID
NTAPI
@@ -173,8 +126,8 @@
VOID
NTAPI
CcMdlReadComplete2(
- IN PMDL MemoryDescriptorList,
- IN PFILE_OBJECT FileObject
+ IN PFILE_OBJECT FileObject,
+ IN PMDL MemoryDescriptorList
);
VOID
@@ -185,129 +138,10 @@
IN PMDL MdlChain
);
-NTSTATUS
+BOOLEAN
NTAPI
-CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment);
-
-NTSTATUS
-NTAPI
-CcRosGetCacheSegment(
- PBCB Bcb,
- ULONG FileOffset,
- PULONG BaseOffset,
- PVOID *BaseAddress,
- PBOOLEAN UptoDate,
- PCACHE_SEGMENT *CacheSeg
+CcInitializeCacheManager(
+ VOID
);
-VOID
-NTAPI
-CcInitView(VOID);
-
-NTSTATUS
-NTAPI
-CcRosFreeCacheSegment(
- PBCB,
- PCACHE_SEGMENT
-);
-
-NTSTATUS
-NTAPI
-ReadCacheSegment(PCACHE_SEGMENT CacheSeg);
-
-NTSTATUS
-NTAPI
-WriteCacheSegment(PCACHE_SEGMENT CacheSeg);
-
-BOOLEAN
-NTAPI
-CcInitializeCacheManager(VOID);
-
-NTSTATUS
-NTAPI
-CcRosUnmapCacheSegment(
- PBCB Bcb,
- ULONG FileOffset,
- BOOLEAN NowDirty
-);
-
-PCACHE_SEGMENT
-NTAPI
-CcRosLookupCacheSegment(
- PBCB Bcb,
- ULONG FileOffset
-);
-
-NTSTATUS
-NTAPI
-CcRosGetCacheSegmentChain(
- PBCB Bcb,
- ULONG FileOffset,
- ULONG Length,
- PCACHE_SEGMENT* CacheSeg
-);
-
-VOID
-NTAPI
-CcInitCacheZeroPage(VOID);
-
-NTSTATUS
-NTAPI
-CcRosMarkDirtyCacheSegment(
- PBCB Bcb,
- ULONG FileOffset
-);
-
-NTSTATUS
-NTAPI
-CcRosFlushDirtyPages(
- ULONG Target,
- PULONG Count
-);
-
-VOID
-NTAPI
-CcRosDereferenceCache(PFILE_OBJECT FileObject);
-
-VOID
-NTAPI
-CcRosReferenceCache(PFILE_OBJECT FileObject);
-
-VOID
-NTAPI
-CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer);
-
-NTSTATUS
-NTAPI
-CcRosReleaseCacheSegment(
- BCB* Bcb,
- CACHE_SEGMENT *CacheSeg,
- BOOLEAN Valid,
- BOOLEAN Dirty,
- BOOLEAN Mapped
-);
-
-NTSTATUS
-NTAPI
-CcRosRequestCacheSegment(
- BCB *Bcb,
- ULONG FileOffset,
- PVOID* BaseAddress,
- PBOOLEAN UptoDate,
- CACHE_SEGMENT **CacheSeg
-);
-
-NTSTATUS
-NTAPI
-CcTryToInitializeFileCache(PFILE_OBJECT FileObject);
-
-/*
- * Macro for generic cache manage bugchecking. Note that this macro assumes
- * that the file name including extension is always longer than 4 characters.
- */
-#define KEBUGCHECKCC \
- KEBUGCHECKEX(CACHE_MANAGER, \
- (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
- (__LINE__ & 0xFFFF), 0, 0, 0)
-
#endif
Modified: branches/nocc/ntoskrnl/mm/mpw.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/mm/mpw.c?rev=3347…
==============================================================================
--- branches/nocc/ntoskrnl/mm/mpw.c [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/mm/mpw.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -88,7 +88,7 @@
MmWriteDirtyPages(128, &PagesWritten);
#endif
- CcRosFlushDirtyPages(128, &PagesWritten);
+ //CcRosFlushDirtyPages(128, &PagesWritten);
}
}
Modified: branches/nocc/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- branches/nocc/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/mm/section.c [iso-8859-1] Mon May 12 10:50:57 2008
@@ -54,7 +54,6 @@
#pragma alloc_text(INIT, MmInitSectionImplementation)
#endif
-
/* TYPES *********************************************************************/
typedef struct
@@ -418,7 +417,6 @@
if (SHARE_COUNT_FROM_SSE(Entry) == 0)
{
PFILE_OBJECT FileObject;
- PBCB Bcb;
SWAPENTRY SavedSwapEntry;
PFN_TYPE Page;
BOOLEAN IsImageSection;
@@ -430,24 +428,6 @@
Page = PFN_FROM_SSE(Entry);
FileObject = Section->FileObject;
- if (FileObject != NULL &&
- !(Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
- {
-
- if ((FileOffset % PAGE_SIZE) == 0 &&
- (Offset + PAGE_SIZE <= Segment->RawLength || !IsImageSection))
- {
- NTSTATUS Status;
- Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
- IsDirectMapped = TRUE;
- Status = CcRosUnmapCacheSegment(Bcb, FileOffset, Dirty);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n",
Status);
- KEBUGCHECK(0);
- }
- }
- }
SavedSwapEntry = MmGetSavedSwapEntryPage(Page);
if (SavedSwapEntry == 0)
@@ -518,19 +498,8 @@
BOOLEAN MiIsPageFromCache(PMEMORY_AREA MemoryArea,
ULONG SegOffset)
{
- if (!(MemoryArea->Data.SectionData.Segment->Characteristics &
IMAGE_SCN_MEM_SHARED))
- {
- PBCB Bcb;
- PCACHE_SEGMENT CacheSeg;
- Bcb =
MemoryArea->Data.SectionData.Section->FileObject->SectionObjectPointer->SharedCacheMap;
- CacheSeg = CcRosLookupCacheSegment(Bcb, SegOffset +
MemoryArea->Data.SectionData.Segment->FileOffset);
- if (CacheSeg)
- {
- CcRosReleaseCacheSegment(Bcb, CacheSeg, CacheSeg->Valid, FALSE, TRUE);
- return TRUE;
- }
- }
- return FALSE;
+ /* Mm expects true */
+ return TRUE;
}
NTSTATUS
@@ -545,164 +514,37 @@
* Offset - Offset of the page to read.
* Page - Variable that receives a page contains the read data.
*/
-{
- ULONG BaseOffset;
- ULONG FileOffset;
- PVOID BaseAddress;
- BOOLEAN UptoDate;
- PCACHE_SEGMENT CacheSeg;
- PFILE_OBJECT FileObject;
- NTSTATUS Status;
- ULONG RawLength;
- PBCB Bcb;
- BOOLEAN IsImageSection;
- ULONG Length;
-
- FileObject = MemoryArea->Data.SectionData.Section->FileObject;
- Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
- RawLength = MemoryArea->Data.SectionData.Segment->RawLength;
- FileOffset = SegOffset + MemoryArea->Data.SectionData.Segment->FileOffset;
- IsImageSection = MemoryArea->Data.SectionData.Section->AllocationAttributes
& SEC_IMAGE ? TRUE : FALSE;
-
- ASSERT(Bcb);
-
- DPRINT("%S %x\n", FileObject->FileName.Buffer, FileOffset);
-
- /*
- * If the file system is letting us go directly to the cache and the
- * memory area was mapped at an offset in the file which is page aligned
- * then get the related cache segment.
- */
- if ((FileOffset % PAGE_SIZE) == 0 &&
- (SegOffset + PAGE_SIZE <= RawLength || !IsImageSection) &&
- !(MemoryArea->Data.SectionData.Segment->Characteristics &
IMAGE_SCN_MEM_SHARED))
- {
-
- /*
- * Get the related cache segment; we use a lower level interface than
- * filesystems do because it is safe for us to use an offset with a
- * alignment less than the file system block size.
- */
- Status = CcRosGetCacheSegment(Bcb,
- FileOffset,
- &BaseOffset,
- &BaseAddress,
- &UptoDate,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- if (!UptoDate)
- {
- /*
- * If the cache segment isn't up to date then call the file
- * system to read in the data.
- */
- Status = ReadCacheSegment(CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
- return Status;
- }
- }
- /*
- * Retrieve the page from the cache segment that we actually want.
- */
- (*Page) = MmGetPhysicalAddress((char*)BaseAddress +
- FileOffset - BaseOffset).LowPart >>
PAGE_SHIFT;
-
- CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, TRUE);
- }
- else
- {
- PVOID PageAddr;
- ULONG CacheSegOffset;
- /*
- * Allocate a page, this is rather complicated by the possibility
- * we might have to move other things out of memory
- */
- Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- Status = CcRosGetCacheSegment(Bcb,
- FileOffset,
- &BaseOffset,
- &BaseAddress,
- &UptoDate,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- if (!UptoDate)
- {
- /*
- * If the cache segment isn't up to date then call the file
- * system to read in the data.
- */
- Status = ReadCacheSegment(CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
- return Status;
- }
- }
- PageAddr = MmCreateHyperspaceMapping(*Page);
- CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
- Length = RawLength - SegOffset;
- if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
- {
- memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, Length);
- }
- else if (CacheSegOffset >= PAGE_SIZE)
- {
- memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, PAGE_SIZE);
- }
- else
- {
- memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, CacheSegOffset);
- CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
- Status = CcRosGetCacheSegment(Bcb,
- FileOffset + CacheSegOffset,
- &BaseOffset,
- &BaseAddress,
- &UptoDate,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- MmDeleteHyperspaceMapping(PageAddr);
- return(Status);
- }
- if (!UptoDate)
- {
- /*
- * If the cache segment isn't up to date then call the file
- * system to read in the data.
- */
- Status = ReadCacheSegment(CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
- MmDeleteHyperspaceMapping(PageAddr);
- return Status;
- }
- }
- if (Length < PAGE_SIZE)
- {
- memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length -
CacheSegOffset);
- }
- else
- {
- memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE -
CacheSegOffset);
- }
- }
- CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
- MmDeleteHyperspaceMapping(PageAddr);
- }
- return(STATUS_SUCCESS);
+{
+ LARGE_INTEGER FileOffset;
+ PVOID Buffer;
+ PVOID Bcb;
+ BOOLEAN Result;
+ PFILE_OBJECT FileObject;
+ NTSTATUS Status;
+ PVOID MappedAddress;
+
+ /* Get the file object and file offset */
+ FileObject = MemoryArea->Data.SectionData.Section->FileObject;
+ FileOffset.QuadPart = SegOffset +
MemoryArea->Data.SectionData.Segment->FileOffset;
+
+ /* Allocate a page */
+ Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Read the data */
+ Result = CcPinRead(FileObject, &FileOffset, PAGE_SIZE, TRUE, &Bcb,
&Buffer);
+ if (!Result) return STATUS_UNSUCCESSFUL;
+
+ /* Create hyperspace mapping */
+ MappedAddress = MmCreateHyperspaceMapping(*Page);
+
+ /* Copy the page through */
+ RtlCopyMemory(MappedAddress, Buffer, PAGE_SIZE);
+
+ /* Release the mapping */
+ CcUnpinData(Bcb);
+ MmDeleteHyperspaceMapping(MappedAddress);
+ return STATUS_SUCCESS;
}
NTSTATUS
@@ -1459,7 +1301,6 @@
ULONG FileOffset;
NTSTATUS Status;
PFILE_OBJECT FileObject;
- PBCB Bcb = NULL;
BOOLEAN DirectMapped;
BOOLEAN IsImageSection;
@@ -1482,8 +1323,6 @@
if (FileObject != NULL &&
!(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
{
- Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
-
/*
* If the file system is letting us go directly to the cache and the
* memory area was mapped at an offset in the file which is page aligned
@@ -1621,12 +1460,6 @@
{
DPRINT1("Found a swapentry for a non private and direct mapped page
(address %x)\n",
Address);
- KEBUGCHECK(0);
- }
- Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
KEBUGCHECK(0);
}
PageOp->Status = STATUS_SUCCESS;
@@ -1814,7 +1647,6 @@
BOOLEAN Private;
NTSTATUS Status;
PFILE_OBJECT FileObject;
- PBCB Bcb = NULL;
BOOLEAN DirectMapped;
BOOLEAN IsImageSection;
@@ -1835,8 +1667,6 @@
if (FileObject != NULL &&
!(Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
{
- Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
-
/*
* If the file system is letting us go directly to the cache and the
* memory area was mapped at an offset in the file which is page aligned
@@ -1900,7 +1730,9 @@
if (DirectMapped && !Private)
{
ASSERT(SwapEntry == 0);
- CcRosMarkDirtyCacheSegment(Bcb, Offset + Segment->FileOffset);
+ DPRINT1("Need to mark dirty\n");
+ while (TRUE);
+ //CcRosMarkDirtyCacheSegment(Bcb, Offset + Segment->FileOffset);
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
return(STATUS_SUCCESS);
@@ -2188,7 +2020,6 @@
}
if (Section->FileObject != NULL)
{
- CcRosDereferenceCache(Section->FileObject);
ObDereferenceObject(Section->FileObject);
Section->FileObject = NULL;
}
@@ -2374,8 +2205,6 @@
PMM_SECTION_SEGMENT Segment;
ULONG FileAccess;
IO_STATUS_BLOCK Iosb;
- LARGE_INTEGER Offset;
- CHAR Buffer;
FILE_STANDARD_INFORMATION FileInfo;
/*
@@ -2481,6 +2310,7 @@
}
}
+#if 0
if (FileObject->SectionObjectPointer == NULL ||
FileObject->SectionObjectPointer->SharedCacheMap == NULL)
{
@@ -2514,6 +2344,7 @@
return STATUS_INVALID_PARAMETER;
}
}
+#endif
/*
* Lock the file
@@ -2590,7 +2421,6 @@
MmUnlockSectionSegment(Segment);
Section->FileObject = FileObject;
Section->MaximumSize = MaximumSize;
- CcRosReferenceCache(FileObject);
//KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
*SectionObject = Section;
return(STATUS_SUCCESS);
@@ -3330,7 +3160,7 @@
* Initialized caching for this file object if previously caching
* was initialized for the same on disk file
*/
- Status = CcTryToInitializeFileCache(FileObject);
+ Status = STATUS_SUCCESS;//CcTryToInitializeFileCache(FileObject);
if (!NT_SUCCESS(Status) || FileObject->SectionObjectPointer->ImageSectionObject
== NULL)
{
@@ -3423,7 +3253,6 @@
Status = STATUS_SUCCESS;
}
Section->FileObject = FileObject;
- CcRosReferenceCache(FileObject);
//KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
*SectionObject = Section;
return(Status);
@@ -3828,7 +3657,9 @@
{
ULONG Entry;
PFILE_OBJECT FileObject;
- PBCB Bcb;
+ LARGE_INTEGER FileOffset;
+ BOOLEAN Result;
+ PVOID MappedAddress;
ULONG Offset;
SWAPENTRY SavedSwapEntry;
PMM_PAGEOP PageOp;
@@ -3877,10 +3708,23 @@
{
if (Page == PFN_FROM_SSE(Entry) && Dirty)
{
- FileObject = MemoryArea->Data.SectionData.Section->FileObject;
- Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
- CcRosMarkDirtyCacheSegment(Bcb, Offset + Segment->FileOffset);
- ASSERT(SwapEntry == 0);
+ FileObject = MemoryArea->Data.SectionData.Section->FileObject;
+
+ /* Create hyperspace mapping */
+ MappedAddress = MmCreateHyperspaceMapping(Page);
+
+ /* Flush out the data immediately */
+ FileOffset.QuadPart = Offset + Segment->FileOffset;
+ Result = CcCopyWrite(FileObject,
+ &FileOffset,
+ PAGE_SIZE,
+ TRUE,
+ MappedAddress);
+ ASSERT(Result == TRUE);
+ ASSERT(SwapEntry == 0);
+
+ /* Release the mapping */
+ MmDeleteHyperspaceMapping(MappedAddress);
}
}
@@ -4706,7 +4550,7 @@
{
return FALSE;
}
- CcRosSetRemoveOnClose(SectionObjectPointer);
+
return TRUE;
case MmFlushForWrite:
break;
Modified: branches/nocc/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/ntoskrnl-generic.…
==============================================================================
--- branches/nocc/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Mon May 12 10:50:57 2008
@@ -110,13 +110,14 @@
<file>timerobj.c</file>
<file>wait.c</file>
</directory>
- <directory name="cc">
- <file>cacheman.c</file>
- <file>copy.c</file>
- <file>fs.c</file>
- <file>mdl.c</file>
- <file>pin.c</file>
- <file>view.c</file>
+ <directory name="cache">
+ <file>cachesub.c</file>
+ <file>copysup.c</file>
+ <file>fssup.c</file>
+ <file>lazyrite.c</file>
+ <file>logsup.c</file>
+ <file>mdlsup.c</file>
+ <file>pinsup.c</file>
</directory>
<directory name="config">
<if property="ARCH" value="i386">
Modified: branches/nocc/ntoskrnl/ntoskrnl_i386.def
URL:
http://svn.reactos.org/svn/reactos/branches/nocc/ntoskrnl/ntoskrnl_i386.def…
==============================================================================
--- branches/nocc/ntoskrnl/ntoskrnl_i386.def [iso-8859-1] (original)
+++ branches/nocc/ntoskrnl/ntoskrnl_i386.def [iso-8859-1] Mon May 12 10:50:57 2008
@@ -3,9 +3,6 @@
; ReactOS Operating System
;
EXPORTS
-CcRosInitializeFileCache@16
-CcRosReleaseFileCache@4
-CcRosTraceCacheMap@8
CcCanIWrite@16
CcCopyRead@24
CcCopyWrite@20