https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ddf44ff1025283067133459c672fdad2313748d

commit 3ddf44ff1025283067133459c672fdad2313748d
Author: Pierre Schweitzer <[email protected]>
AuthorDate: Sun Dec 31 12:15:17 2017 +0100

    [NTFS] Use LookasideList allocations for NTFS_ATTR_CONTEXT.
    TODO: use a specific tag
---
 drivers/filesystems/ntfs/mft.c  | 10 ++++------
 drivers/filesystems/ntfs/ntfs.c |  3 +++
 drivers/filesystems/ntfs/ntfs.h |  1 +
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/filesystems/ntfs/mft.c b/drivers/filesystems/ntfs/mft.c
index f623c72e68..8594f79e56 100644
--- a/drivers/filesystems/ntfs/mft.c
+++ b/drivers/filesystems/ntfs/mft.c
@@ -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);
 }
 
 
diff --git a/drivers/filesystems/ntfs/ntfs.c b/drivers/filesystems/ntfs/ntfs.c
index c9bbc490bd..53733e1dec 100644
--- a/drivers/filesystems/ntfs/ntfs.c
+++ b/drivers/filesystems/ntfs/ntfs.c
@@ -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;
diff --git a/drivers/filesystems/ntfs/ntfs.h b/drivers/filesystems/ntfs/ntfs.h
index 97f4acd1d6..0b64b7247e 100644
--- a/drivers/filesystems/ntfs/ntfs.h
+++ b/drivers/filesystems/ntfs/ntfs.h
@@ -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;
 

Reply via email to