[FASTFAT]
[reactos.git] / reactos / drivers / filesystems / fastfat / misc.c
index 8a5adde..39e5896 100644 (file)
@@ -85,8 +85,6 @@ VfatLockControl(
     Status = FsRtlProcessFileLock(&Fcb->FileLock,
                                   IrpContext->Irp,
                                   NULL);
-
-    VfatFreeIrpContext(IrpContext);
     return Status;
 }
 
@@ -114,6 +112,8 @@ VfatDispatchRequest(
 
     ASSERT(IrpContext);
 
+    FsRtlEnterFileSystem();
+
     switch (IrpContext->MajorFunction)
     {
         case IRP_MJ_CLOSE:
@@ -204,6 +204,8 @@ VfatDispatchRequest(
         VfatFreeIrpContext(IrpContext);
     }
 
+    FsRtlExitFileSystem();
+
     return Status;
 }
 
@@ -230,9 +232,7 @@ VfatBuildRequest(
     }
     else
     {
-        FsRtlEnterFileSystem();
         Status = VfatDispatchRequest(IrpContext);
-        FsRtlExitFileSystem();
     }
     return Status;
 }
@@ -304,9 +304,7 @@ VfatDoRequest(
     InterlockedDecrement(&QueueCount);
     DPRINT("VfatDoRequest(IrpContext %p), MajorFunction %x, %d\n",
            IrpContext, ((PVFAT_IRP_CONTEXT)IrpContext)->MajorFunction, QueueCount);
-    FsRtlEnterFileSystem();
     VfatDispatchRequest((PVFAT_IRP_CONTEXT)IrpContext);
-    FsRtlExitFileSystem();
 }
 
 static
@@ -319,6 +317,8 @@ VfatQueueRequest(
 
     ASSERT(IrpContext != NULL);
     ASSERT(IrpContext->Irp != NULL);
+    ASSERT(!(IrpContext->Flags & IRPCONTEXT_QUEUE) &&
+           (IrpContext->Flags & IRPCONTEXT_COMPLETE));
 
     IrpContext->Flags |= IRPCONTEXT_CANWAIT;
     IoMarkIrpPending(IrpContext->Irp);
@@ -329,15 +329,14 @@ VfatQueueRequest(
 
 PVOID
 VfatGetUserBuffer(
-    IN PIRP Irp)
+    IN PIRP Irp,
+    IN BOOLEAN Paging)
 {
     ASSERT(Irp);
 
     if (Irp->MdlAddress)
     {
-        /* This call may be in the paging path, so use maximum priority */
-        /* FIXME: call with normal priority in the non-paging path */
-        return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, HighPagePriority);
+        return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, (Paging ? HighPagePriority : NormalPagePriority));
     }
     else
     {