From d4a0828949c7cb2c86d6f87914b4b4b3e80d9e76 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 24 May 2015 12:28:51 +0000 Subject: [PATCH] [NTFS] Implement request qeueing (based on FastFAT work) svn path=/trunk/; revision=67878 --- reactos/drivers/filesystems/ntfs/dispatch.c | 34 ++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/filesystems/ntfs/dispatch.c b/reactos/drivers/filesystems/ntfs/dispatch.c index acc7f515a90..27bbad45864 100644 --- a/reactos/drivers/filesystems/ntfs/dispatch.c +++ b/reactos/drivers/filesystems/ntfs/dispatch.c @@ -31,8 +31,29 @@ #define NDEBUG #include +static LONG QueueCount = 0; + /* FUNCTIONS ****************************************************************/ +static WORKER_THREAD_ROUTINE NtfsDoRequest; + +static +NTSTATUS +NtfsQueueRequest(PNTFS_IRP_CONTEXT IrpContext) +{ + InterlockedIncrement(&QueueCount); + DPRINT("NtfsQueueRequest(IrpContext %p), %d\n", IrpContext, QueueCount); + + ASSERT(!(IrpContext->Flags & IRPCONTEXT_QUEUE) && + (IrpContext->Flags & IRPCONTEXT_COMPLETE)); + IrpContext->Flags |= IRPCONTEXT_CANWAIT; + IoMarkIrpPending(IrpContext->Irp); + ExInitializeWorkItem(&IrpContext->WorkQueueItem, NtfsDoRequest, IrpContext); + ExQueueWorkItem(&IrpContext->WorkQueueItem, CriticalWorkQueue); + + return STATUS_PENDING; +} + static NTSTATUS NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext) @@ -92,7 +113,7 @@ NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext) /* Reset our status flags before queueing the IRP */ IrpContext->Flags |= IRPCONTEXT_COMPLETE; IrpContext->Flags &= ~IRPCONTEXT_QUEUE; - UNIMPLEMENTED_DBGBREAK(); + Status = NtfsQueueRequest(IrpContext); } else { @@ -105,6 +126,17 @@ NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext) return Status; } +static +VOID +NTAPI +NtfsDoRequest(PVOID IrpContext) +{ + InterlockedDecrement(&QueueCount); + DPRINT("NtfsDoRequest(IrpContext %p), MajorFunction %x, %d\n", + IrpContext, ((PNTFS_IRP_CONTEXT)IrpContext)->MajorFunction, QueueCount); + NtfsDispatch((PNTFS_IRP_CONTEXT)IrpContext); +} + /* * FUNCTION: This function manages IRP for various major functions * ARGUMENTS: