Is it okay to ExAllocatePool(IrpSp->Parameters.Read.Length) then ExFree()
upon start of read/after read completion?
Or it is better to once allocate a buffer w/ fixed aligned size then read
the file by chunks (loop ReadLength/MyChunkSize, then %) into that buffer
then transfer memory from my buffer to the user buffer as each read chunk is
completed?
Won’t continious allocation / deallocation fragment the system memory?
I would do both. The problem with initially allocated buffer would be
that you have to share it among multiple reads coming from different
threads thus blocking rest of the reads while satisfying one. Besides,
if you break a big single read into multiple small ones you will be hit
(and hit hard) with performance degradation. Besides, you permanently
hold big chunk of memory out of the system. So, an alternative would be:
For big reads (actual numbers should be statistically calculated) use
ExAllocatePool (in this case an overhead of allocation will be small
comparing to actual read time)
For small reads use lookaside list to allocate temp. buffer. This way
you will have quick allocation and eventually that memory will be
returned to the system.
-----Original Message-----
From: lallous [mailto:xxxxx@lgwm.org]
Sent: Wednesday, December 10, 2003 2:18 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] On Read
Hello,
I hooked DispatchRead in my filter driver.
Is it okay to ExAllocatePool(IrpSp->Parameters.Read.Length) then
ExFree()
upon start of read/after read completion?
Or it is better to once allocate a buffer w/ fixed aligned size then
read
the file by chunks (loop ReadLength/MyChunkSize, then %) into that
buffer
then transfer memory from my buffer to the user buffer as each read
chunk is
completed?
Won’t continious allocation / deallocation fragment the system memory?