Ayush,
Thanks for pointing that out. I hadn’t thought of the case of having to
maintain state between openings because it doesn’t apply in my
situation. Just out of curiousity, how do you decide when to drop a
file’s state from your hash table? Obviously if the answer is never,
you’ll eventually eat up all the available memory. Do you limit the
total size of the table and purge using a least recently used strategy,
possibly weighted with the size of the file (if longer files take more
time to scan, the penalty for making a redundant scan is higher)?
Anyhow, with that in mind, I’ll definitely hang on to the hash table
code I wrote in case I need it down the road.
~Eric
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ayush Gupta
Sent: Friday, January 11, 2008 12:07 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Which context shall I use?
Hi Eric,
Actually, this is exactly the place I just realized I’m reinventing the
wheel
At least it seems that way. Is there a reason I should be
using a hash table over a streamcontext?
It seems like using a stream
context frees you from having to worry about which volume a file id is
on, or maintaining separate hash tables on a per-volume basis. Of
course you need to be able to maintain state yourself if the FS doesn’t
support StreamContexts which may necessitate a hash table anyway. If
the FS supports it though, is one preferable over the other?
It is not reinventing the wheel. 
If you look at it more carefully, this approach lets you keep the
information even if the file (stream) has been closed.
This is not the case with StreamContext. As soon as no FILE_OBJECT
representing the stream is left, the context is also deleted.
Hence, if you need to maintain any information related to a stream
(file), you need to implement something that is managed by you and not
the file system. Only then can you make that information persist across
multiple open-close on a stream.
Regards,
Ayush Gupta
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com