mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
- Massively improve File I/O by using deferred I/O completion for MJ_(MAILSLOT/FILE/NAMEDPIPE)CREATE and manually completing the IRP.
svn path=/trunk/; revision=22926
This commit is contained in:
parent
a49990d5ac
commit
12e1a16066
1 changed files with 29 additions and 13 deletions
|
@ -41,6 +41,7 @@ IopParseDevice(IN PVOID ParseObject,
|
||||||
BOOLEAN DirectOpen = FALSE;
|
BOOLEAN DirectOpen = FALSE;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
BOOLEAN OpenCancelled;
|
BOOLEAN OpenCancelled;
|
||||||
|
KIRQL OldIrql;
|
||||||
DPRINT("IopParseDevice:\n"
|
DPRINT("IopParseDevice:\n"
|
||||||
"DeviceObject : %p\n"
|
"DeviceObject : %p\n"
|
||||||
"RelatedFileObject : %p\n"
|
"RelatedFileObject : %p\n"
|
||||||
|
@ -232,8 +233,8 @@ IopParseDevice(IN PVOID ParseObject,
|
||||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
||||||
Irp->RequestorMode = AccessMode;
|
Irp->RequestorMode = AccessMode;
|
||||||
Irp->Flags = IRP_CREATE_OPERATION |
|
Irp->Flags = IRP_CREATE_OPERATION |
|
||||||
IRP_SYNCHRONOUS_API;// |
|
IRP_SYNCHRONOUS_API |
|
||||||
//IRP_DEFER_IO_COMPLETION;
|
IRP_DEFER_IO_COMPLETION;
|
||||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
Irp->UserEvent = &FileObject->Event;
|
Irp->UserEvent = &FileObject->Event;
|
||||||
Irp->UserIosb = &IoStatusBlock;
|
Irp->UserIosb = &IoStatusBlock;
|
||||||
|
@ -341,26 +342,41 @@ IopParseDevice(IN PVOID ParseObject,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
/* Get the new status */
|
||||||
Status = IoStatusBlock.Status;
|
Status = IoStatusBlock.Status;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
|
||||||
PKNORMAL_ROUTINE NormalRoutine;
|
|
||||||
PVOID NormalContext;
|
|
||||||
|
|
||||||
/* We'll have to complete it ourselves */
|
/* We'll have to complete it ourselves */
|
||||||
ASSERT(!Irp->PendingReturned);
|
ASSERT(!Irp->PendingReturned);
|
||||||
|
|
||||||
|
/* Completion happens at APC_LEVEL */
|
||||||
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
IopCompleteRequest(&Irp->Tail.Apc,
|
|
||||||
&NormalRoutine,
|
/* Get the new I/O Status block ourselves */
|
||||||
&NormalContext,
|
IoStatusBlock = Irp->IoStatus;
|
||||||
(PVOID*)&FileObject,
|
Status = IoStatusBlock.Status;
|
||||||
&NormalContext);
|
|
||||||
|
/* Manually signal the even, we can't have any waiters */
|
||||||
|
FileObject->Event.Header.SignalState = 1;
|
||||||
|
|
||||||
|
/* Now that we've signaled the events, de-associate the IRP */
|
||||||
|
RemoveEntryList(&Irp->ThreadListEntry);
|
||||||
|
InitializeListHead(&Irp->ThreadListEntry);
|
||||||
|
|
||||||
|
/* Check if the IRP had an input buffer */
|
||||||
|
if ((Irp->Flags & IRP_BUFFERED_IO) &&
|
||||||
|
(Irp->Flags & IRP_DEALLOCATE_BUFFER))
|
||||||
|
{
|
||||||
|
/* Free it. A driver might've tacked one on */
|
||||||
|
ExFreePool(Irp->AssociatedIrp.SystemBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free the IRP and bring the IRQL back down */
|
||||||
|
IoFreeIrp(Irp);
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Copy the I/O Status */
|
/* Copy the I/O Status */
|
||||||
OpenPacket->Information = IoStatusBlock.Information;
|
OpenPacket->Information = IoStatusBlock.Information;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue