mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[NTOS:IO]
- Implement Lookaside Floats allocations in IoAllocateIrp and IoFreeIrp * Fixes 2 tests in kmtest:IoIrp svn path=/trunk/; revision=72554
This commit is contained in:
parent
7dc1fbc420
commit
8612af94d2
1 changed files with 22 additions and 13 deletions
|
@ -562,13 +562,14 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
/* Set Charge Quota Flag */
|
/* Set Charge Quota Flag */
|
||||||
if (ChargeQuota) Flags |= IRP_QUOTA_CHARGED;
|
if (ChargeQuota) Flags |= IRP_QUOTA_CHARGED;
|
||||||
|
|
||||||
/* FIXME: Implement Lookaside Floats */
|
/* Get the PRCB */
|
||||||
|
Prcb = KeGetCurrentPrcb();
|
||||||
|
|
||||||
/* Figure out which Lookaside List to use */
|
/* Figure out which Lookaside List to use */
|
||||||
if ((StackSize <= 8) && (ChargeQuota == FALSE))
|
if ((StackSize <= 8) && (ChargeQuota == FALSE || Prcb->LookasideIrpFloat > 0))
|
||||||
{
|
{
|
||||||
/* Set Fixed Size Flag */
|
/* Set Fixed Size Flag */
|
||||||
Flags = IRP_ALLOCATED_FIXED_SIZE;
|
Flags |= IRP_ALLOCATED_FIXED_SIZE;
|
||||||
|
|
||||||
/* See if we should use big list */
|
/* See if we should use big list */
|
||||||
if (StackSize != 1)
|
if (StackSize != 1)
|
||||||
|
@ -577,9 +578,6 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
ListType = LookasideLargeIrpList;
|
ListType = LookasideLargeIrpList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the PRCB */
|
|
||||||
Prcb = KeGetCurrentPrcb();
|
|
||||||
|
|
||||||
/* Get the P List First */
|
/* Get the P List First */
|
||||||
List = (PNPAGED_LOOKASIDE_LIST)Prcb->PPLookasideList[ListType].P;
|
List = (PNPAGED_LOOKASIDE_LIST)Prcb->PPLookasideList[ListType].P;
|
||||||
|
|
||||||
|
@ -622,8 +620,12 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
/* Make sure it was sucessful */
|
/* Make sure it was sucessful */
|
||||||
if (!Irp) return NULL;
|
if (!Irp) return NULL;
|
||||||
}
|
}
|
||||||
else
|
else if (Flags & IRP_QUOTA_CHARGED)
|
||||||
{
|
{
|
||||||
|
/* Decrement lookaside float */
|
||||||
|
InterlockedDecrement(&Prcb->LookasideIrpFloat);
|
||||||
|
Flags |= IRP_LOOKASIDE_ALLOCATION;
|
||||||
|
|
||||||
/* In this case there is no charge quota */
|
/* In this case there is no charge quota */
|
||||||
Flags &= ~IRP_QUOTA_CHARGED;
|
Flags &= ~IRP_QUOTA_CHARGED;
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1589,7 @@ NTAPI
|
||||||
IoFreeIrp(IN PIRP Irp)
|
IoFreeIrp(IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PNPAGED_LOOKASIDE_LIST List;
|
PNPAGED_LOOKASIDE_LIST List;
|
||||||
PP_NPAGED_LOOKASIDE_NUMBER ListType = LookasideSmallIrpList;
|
PP_NPAGED_LOOKASIDE_NUMBER ListType = LookasideSmallIrpList;
|
||||||
PKPRCB Prcb;
|
PKPRCB Prcb;
|
||||||
IOTRACE(IO_IRP_DEBUG,
|
IOTRACE(IO_IRP_DEBUG,
|
||||||
"%s - Freeing IRPs %p\n",
|
"%s - Freeing IRPs %p\n",
|
||||||
|
@ -1599,6 +1601,16 @@ IoFreeIrp(IN PIRP Irp)
|
||||||
ASSERT(IsListEmpty(&Irp->ThreadListEntry));
|
ASSERT(IsListEmpty(&Irp->ThreadListEntry));
|
||||||
ASSERT(Irp->CurrentLocation >= Irp->StackCount);
|
ASSERT(Irp->CurrentLocation >= Irp->StackCount);
|
||||||
|
|
||||||
|
/* Get the PRCB */
|
||||||
|
Prcb = KeGetCurrentPrcb();
|
||||||
|
|
||||||
|
/* If this was a lookaside alloc, increment lookaside float */
|
||||||
|
if (Irp->AllocationFlags & IRP_LOOKASIDE_ALLOCATION)
|
||||||
|
{
|
||||||
|
Irp->AllocationFlags &= ~IRP_LOOKASIDE_ALLOCATION;
|
||||||
|
InterlockedIncrement(&Prcb->LookasideIrpFloat);
|
||||||
|
}
|
||||||
|
|
||||||
/* If this was a pool alloc, free it with the pool */
|
/* If this was a pool alloc, free it with the pool */
|
||||||
if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE))
|
if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE))
|
||||||
{
|
{
|
||||||
|
@ -1610,9 +1622,6 @@ IoFreeIrp(IN PIRP Irp)
|
||||||
/* Check if this was a Big IRP */
|
/* Check if this was a Big IRP */
|
||||||
if (Irp->StackCount != 1) ListType = LookasideLargeIrpList;
|
if (Irp->StackCount != 1) ListType = LookasideLargeIrpList;
|
||||||
|
|
||||||
/* Get the PRCB */
|
|
||||||
Prcb = KeGetCurrentPrcb();
|
|
||||||
|
|
||||||
/* Use the P List */
|
/* Use the P List */
|
||||||
List = (PNPAGED_LOOKASIDE_LIST)Prcb->PPLookasideList[ListType].P;
|
List = (PNPAGED_LOOKASIDE_LIST)Prcb->PPLookasideList[ListType].P;
|
||||||
List->L.TotalFrees++;
|
List->L.TotalFrees++;
|
||||||
|
@ -1640,8 +1649,8 @@ IoFreeIrp(IN PIRP Irp)
|
||||||
/* The free was within the Depth */
|
/* The free was within the Depth */
|
||||||
if (Irp)
|
if (Irp)
|
||||||
{
|
{
|
||||||
InterlockedPushEntrySList(&List->L.ListHead,
|
InterlockedPushEntrySList(&List->L.ListHead,
|
||||||
(PSLIST_ENTRY)Irp);
|
(PSLIST_ENTRY)Irp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue