[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 24 May 2015 12:28:51 +0000 (12:28 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 24 May 2015 12:28:51 +0000 (12:28 +0000)
Implement request qeueing (based on FastFAT work)

svn path=/trunk/; revision=67878

reactos/drivers/filesystems/ntfs/dispatch.c

index acc7f51..27bbad4 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
+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: