[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Thu, 11 Jun 2015 20:54:01 +0000 (20:54 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 11 Jun 2015 20:54:01 +0000 (20:54 +0000)
- Use a lookaside list for FCB allocation
- Properly delete FCB in NtfsMountVolume()

svn path=/trunk/; revision=68106

reactos/drivers/filesystems/ntfs/fcb.c
reactos/drivers/filesystems/ntfs/fsctl.c
reactos/drivers/filesystems/ntfs/ntfs.c
reactos/drivers/filesystems/ntfs/ntfs.h

index 337aa97..fe97f53 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-/* MACROS *******************************************************************/
-
-#define TAG_FCB 'BCFI'
-
 /* FUNCTIONS ****************************************************************/
 
 static
@@ -76,7 +72,7 @@ NtfsCreateFCB(PCWSTR FileName,
     ASSERT(Vcb);
     ASSERT(Vcb->Identifier.Type == NTFS_TYPE_VCB);
 
-    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_FCB), TAG_FCB);
+    Fcb = ExAllocateFromNPagedLookasideList(&NtfsGlobalData->FcbLookasideList);
     RtlZeroMemory(Fcb, sizeof(NTFS_FCB));
 
     Fcb->Identifier.Type = NTFS_TYPE_FCB;
@@ -113,7 +109,7 @@ NtfsDestroyFCB(PNTFS_FCB Fcb)
 
     ExDeleteResourceLite(&Fcb->MainResource);
 
-    ExFreePool(Fcb);
+    ExFreeToNPagedLookasideList(&NtfsGlobalData->FcbLookasideList, Fcb);
 }
 
 
index 99f107e..cd0845d 100644 (file)
@@ -524,7 +524,7 @@ ByeBye:
             ObDereferenceObject(Vcb->StreamFileObject);
 
         if (Fcb)
-            ExFreePool(Fcb);
+            NtfsDestroyFCB(Fcb);
 
         if (Ccb)
             ExFreePool(Ccb);
index 5599701..7646a50 100644 (file)
@@ -99,6 +99,9 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
     /* Initialize lookaside list for IRP contexts */
     ExInitializeNPagedLookasideList(&NtfsGlobalData->IrpContextLookasideList,
                                     NULL, NULL, 0, sizeof(NTFS_IRP_CONTEXT), 'PRIN', 0);
+    /* Initialize lookaside list for FCBs */
+    ExInitializeNPagedLookasideList(&NtfsGlobalData->FcbLookasideList,
+                                    NULL, NULL, 0, sizeof(NTFS_FCB), TAG_FCB, 0);
 
     /* Driver can't be unloaded */
     DriverObject->DriverUnload = NULL;
index 1da9e07..f712091 100644 (file)
@@ -127,6 +127,7 @@ typedef struct
 } NTFS_CCB, *PNTFS_CCB;
 
 #define TAG_CCB 'BCCI'
+#define TAG_FCB 'BCFI'
 
 typedef struct
 {
@@ -138,6 +139,7 @@ typedef struct
     ULONG Flags;
     FAST_IO_DISPATCH FastIoDispatch;
     NPAGED_LOOKASIDE_LIST IrpContextLookasideList;
+    NPAGED_LOOKASIDE_LIST FcbLookasideList;
 } NTFS_GLOBAL_DATA, *PNTFS_GLOBAL_DATA;