[NTFS] Use LookasideList allocations for NTFS_ATTR_CONTEXT.

TODO: use a specific tag
This commit is contained in:
Pierre Schweitzer 2017-12-31 12:15:17 +01:00
parent 849fa7fbae
commit 3ddf44ff10
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 8 additions and 6 deletions

View file

@ -42,9 +42,7 @@ PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord)
{
PNTFS_ATTR_CONTEXT Context;
Context = ExAllocatePoolWithTag(NonPagedPool,
sizeof(NTFS_ATTR_CONTEXT),
TAG_NTFS);
Context = ExAllocateFromNPagedLookasideList(&NtfsGlobalData->AttrCtxtLookasideList);
if(!Context)
{
DPRINT1("Error: Unable to allocate memory for context!\n");
@ -56,7 +54,7 @@ PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord)
if(!Context->pRecord)
{
DPRINT1("Error: Unable to allocate memory for attribute record!\n");
ExFreePoolWithTag(Context, TAG_NTFS);
ExFreeToNPagedLookasideList(&NtfsGlobalData->AttrCtxtLookasideList, Context);
return NULL;
}
@ -93,7 +91,7 @@ PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord)
{
DPRINT1("Unable to convert data runs to MCB!\n");
ExFreePoolWithTag(Context->pRecord, TAG_NTFS);
ExFreePoolWithTag(Context, TAG_NTFS);
ExFreeToNPagedLookasideList(&NtfsGlobalData->AttrCtxtLookasideList, Context);
return NULL;
}
}
@ -115,7 +113,7 @@ ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
ExFreePoolWithTag(Context->pRecord, TAG_NTFS);
}
ExFreePoolWithTag(Context, TAG_NTFS);
ExFreeToNPagedLookasideList(&NtfsGlobalData->AttrCtxtLookasideList, Context);
}

View file

@ -146,6 +146,9 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
/* Initialize lookaside list for FCBs */
ExInitializeNPagedLookasideList(&NtfsGlobalData->FcbLookasideList,
NULL, NULL, 0, sizeof(NTFS_FCB), TAG_FCB, 0);
/* Initialize lookaside list for attributes contexts */
ExInitializeNPagedLookasideList(&NtfsGlobalData->AttrCtxtLookasideList,
NULL, NULL, 0, sizeof(NTFS_ATTR_CONTEXT), TAG_NTFS, 0);
/* Driver can't be unloaded */
DriverObject->DriverUnload = NULL;

View file

@ -152,6 +152,7 @@ typedef struct
FAST_IO_DISPATCH FastIoDispatch;
NPAGED_LOOKASIDE_LIST IrpContextLookasideList;
NPAGED_LOOKASIDE_LIST FcbLookasideList;
NPAGED_LOOKASIDE_LIST AttrCtxtLookasideList;
BOOLEAN EnableWriteSupport;
} NTFS_GLOBAL_DATA, *PNTFS_GLOBAL_DATA;