Resue MDL for a different length

Hi all,

I have allocated an MDL for a length of x bytes:
pMdl = IoAllocateMdl(va, x, …)
I have used this MDL for a data transfer of x bytes.

Then I want to perform a transfer of y bytes (x != y) using the same MDL.
Can I do this:
MmPrepareMdlForReuse(pMdl);
MmInitializeMdl(pMdl, newVa, y);

Is this OK if the length is different (x != y) or should I allocate a new MDL instead?

Thanks for all your time,
Alex.

> Is this OK if the length is different (x != y) or should I allocate a new MDL

instead?

Better to allocate new one. A must if the new length is larger then the old
one.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi,
You can if the number of pages( not region size ) which span the new region
is smaller or equal to the number for the old region.

wrote in message news:xxxxx@ntdev…
> Hi all,
>
> I have allocated an MDL for a length of x bytes:
> pMdl = IoAllocateMdl(va, x, …)
> I have used this MDL for a data transfer of x bytes.
>
> Then I want to perform a transfer of y bytes (x != y) using the same MDL.
> Can I do this:
> MmPrepareMdlForReuse(pMdl);
> MmInitializeMdl(pMdl, newVa, y);
>
> Is this OK if the length is different (x != y) or should I allocate a new
> MDL instead?
>
> Thanks for all your time,
> Alex.
>
>