- Use a lookaside list for FCB allocation
- Properly delete FCB in NtfsMountVolume()

svn path=/trunk/; revision=68106
This commit is contained in:
Pierre Schweitzer 2015-06-11 20:54:01 +00:00
parent 658c64a7fe
commit ad577755ca
4 changed files with 8 additions and 7 deletions

View file

@ -32,10 +32,6 @@
#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);
}

View file

@ -524,7 +524,7 @@ ByeBye:
ObDereferenceObject(Vcb->StreamFileObject);
if (Fcb)
ExFreePool(Fcb);
NtfsDestroyFCB(Fcb);
if (Ccb)
ExFreePool(Ccb);

View 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;

View 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;