Author: ion
Date: Sat Jul 29 23:26:13 2006
New Revision: 23354
URL:
http://svn.reactos.org/svn/reactos?rev=23354&view=rev
Log:
- Added profiling for possible Nt I/O function optimizations. Booting and running Firefox
gave an amazing "0 missed optimizations", so defintely, this has been moved down
on the priority list. Also merged all tracing TODOs in one entry and added device.c
tracing TODO.
- Fix IRP Cancellation and enable all calls to IopQueueIrpToThread and
IopUnqueueIrpFromThread. This seems to work properly now and the kernel fun entry for it
has been removed. All remaining Io TODOs are now low priority.
Modified:
trunk/reactos/ntoskrnl/KrnlFun.c
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/io/iomgr/file.c
trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
Modified: trunk/reactos/ntoskrnl/KrnlFun.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=233…
==============================================================================
--- trunk/reactos/ntoskrnl/KrnlFun.c (original)
+++ trunk/reactos/ntoskrnl/KrnlFun.c Sat Jul 29 23:26:13 2006
@@ -9,14 +9,12 @@
// Failure to respect this will *ACHIEVE NOTHING*.
//
// Io:
-// - See why queueing IRPs and cancelling them causes crashes.
+// - Add tracing to iofunc.c, file.c and device.c
// - Add Access Checks in IopParseDevice.
// - Add validation checks in IoCreateFile.
// - Add probe/alignment checks for Query/Set routines.
-// - Add tracing to iofunc.c
-// - Add tracing to file.c
+// - Verify ShareAccess APIs, XP added some new semantics.
// - Add support for some fast-paths when querying/setting data.
-// - Verify ShareAccess APIs, XP added some new semantics.
// - Add support for Fast Dispatch I/O.
//
// Ob:
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Sat Jul 29 23:26:13 2006
@@ -16,6 +16,8 @@
// These define the Debug Masks Supported
//
#define IO_IRP_DEBUG 0x01
+#define IO_FO_DEBUG 0x02
+#define IO_DEVICE_DEBUG 0x04
//
// Debug/Tracing support
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c Sat Jul 29 23:26:13 2006
@@ -373,7 +373,7 @@
OpenPacket->FileObject = FileObject;
/* Queue the IRP and call the driver */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
@@ -404,7 +404,7 @@
FileObject->Event.Header.SignalState = 1;
/* Now that we've signaled the events, de-associate the IRP */
- //IopUnQueueIrpFromThread(Irp);
+ IopUnQueueIrpFromThread(Irp);
/* Check if the IRP had an input buffer */
if ((Irp->Flags & IRP_BUFFERED_IO) &&
@@ -611,6 +611,7 @@
NTSTATUS Status;
KEVENT Event;
PDEVICE_OBJECT DeviceObject;
+ KIRQL OldIrql;
/* Check if the file has a device object */
if (FileObject->DeviceObject)
@@ -656,7 +657,7 @@
StackPtr->FileObject = FileObject;
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Call the FS Driver */
Status = IoCallDriver(DeviceObject, Irp);
@@ -665,6 +666,11 @@
/* Wait for completion */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
}
+
+ /* Raise to APC level and de-queue the IRP */
+ KeRaiseIrql(APC_LEVEL, &OldIrql);
+ IopUnQueueIrpFromThread(Irp);
+ KeLowerIrql(OldIrql);
/* Free the IRP */
IoFreeIrp(Irp);
@@ -830,7 +836,7 @@
}
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Update operation counts */
IopUpdateOperationCount(IopOtherTransfer);
@@ -1024,6 +1030,7 @@
PIO_STACK_LOCATION StackPtr;
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
+ KIRQL OldIrql;
/* Check if the file is locked and has more then one handle opened */
if ((FileObject->LockOperation) && (SystemHandleCount != 1))
@@ -1075,7 +1082,7 @@
StackPtr->FileObject = FileObject;
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Update operation counts */
IopUpdateOperationCount(IopOtherTransfer);
@@ -1087,6 +1094,11 @@
/* Wait for completion */
KeWaitForSingleObject(&Event, UserRequest, KernelMode, FALSE, NULL);
}
+
+ /* Raise to APC level and de-queue the IRP */
+ KeRaiseIrql(APC_LEVEL, &OldIrql);
+ IopUnQueueIrpFromThread(Irp);
+ KeLowerIrql(OldIrql);
/* Free the IRP */
IoFreeIrp(Irp);
Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c Sat Jul 29 23:26:13 2006
@@ -13,6 +13,8 @@
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
+
+ULONG IopMissedOptimizations;
#if 0
IOTRACE(IO_IRP_DEBUG,
@@ -127,7 +129,7 @@
PAGED_CODE();
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Update operation counts */
IopUpdateOperationCount(TransferType);
@@ -449,7 +451,7 @@
}
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Call the Driver */
Status = IoCallDriver(FileObject->DeviceObject, Irp);
@@ -696,7 +698,17 @@
StackPtr->Parameters.SetFile.Length = Length;
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
+
+ /* FIXME BUGBUG TEMPORARY CODE */
+ if ((FileInformationClass == FileModeInformation) ||
+ (FileInformationClass == FileRenameInformation ) ||
+ (FileInformationClass == FileLinkInformation ) ||
+ (FileInformationClass == FileMoveClusterInformation))
+ {
+ DPRINT1("Missed optimization: %lx\n", FileInformationClass);
+ IopMissedOptimizations++;
+ }
/* Call the Driver */
Status = IoCallDriver(FileObject->DeviceObject, Irp);
@@ -1635,10 +1647,20 @@
StackPtr->Parameters.QueryFile.Length = Length;
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Update operation counts */
IopUpdateOperationCount(IopOtherTransfer);
+
+ /* FIXME BUGBUG TEMPORARY CODE */
+ if ((FileInformationClass == FileAccessInformation) ||
+ (FileInformationClass == FileModeInformation) ||
+ (FileInformationClass == FileAlignmentInformation) ||
+ (FileInformationClass == FileAllInformation))
+ {
+ DPRINT1("Missed optimization: %lx\n", FileInformationClass);
+ IopMissedOptimizations++;
+ }
/* Call the Driver */
Status = IoCallDriver(DeviceObject, Irp);
@@ -2181,12 +2203,22 @@
StackPtr->Parameters.SetFile.Length = Length;
/* Queue the IRP */
- //IopQueueIrpToThread(Irp);
+ IopQueueIrpToThread(Irp);
/* Update operation counts */
IopUpdateOperationCount(IopOtherTransfer);
- /* FIXME: Later, we can implement a lot of stuff here and avoid a driver call */
+ /* FIXME BUGBUG TEMPORARY CODE */
+ if ((FileInformationClass == FileModeInformation) ||
+ (FileInformationClass == FileRenameInformation ) ||
+ (FileInformationClass == FileLinkInformation ) ||
+ (FileInformationClass == FileMoveClusterInformation ) ||
+ (FileInformationClass == FileDispositionInformation ))
+ {
+ DPRINT1("Missed optimization: %lx\n", FileInformationClass);
+ IopMissedOptimizations++;
+ }
+
/* Handle IO Completion Port quickly */
if (FileInformationClass == FileCompletionInformation)
{