FtlReleaseContext vs FltDeleteContext

What is the difference between these two in pratice.
I see from testing that calling FltReleaseContext not only decr the
reference count but also causes the context to be freed, even if it has been
set on an instance, for example, that is not being torned down.
Why is FtlDeleteContext at all? Does it ignore any reference counts and
delete the context?

A followup question: If for example an instance is being torn down, how can
I save the context so it does not get deleted. i.e. Is there a “remove”
context?

Ken

Ken,

FltReleaseContext will decrement the reference count on the context which
was added after a successful call to FltGetXxxContext or FltAllocateContext.
FltDeleteContext takes off the reference count which was added by
FltSetXxxContext and deletes the context associated with the object.
FltReleaseContext will free the context only if this was the last reference
on that context, it does not delete the context. The life time of the
context is associated with the life time of the object. When the object is
deleted, the context associated with it is automatically gets deleted, so
you should never have to delete the context. FltDeleteContext has been
provided if you want to delete the context before this object is deleted,
e.g. you may want to delete the stream context if this file is no longer
interesting to you and free up memory.

In your example described below you can remove the context by calling
FltDeleteContext. If you want to save this context do not call
FltReleaseContext and it won’t be freed. You can latter call FltSetContext
using this context on a new object.

Thanks
Ravinder

This posting is provided “AS IS” with no warranties, and confers no rights.

“Ken Galipeau” wrote in message news:xxxxx@ntfsd…
> What is the difference between these two in pratice.
> I see from testing that calling FltReleaseContext not only decr the
> reference count but also causes the context to be freed, even if it has
been
> set on an instance, for example, that is not being torned down.
> Why is FtlDeleteContext at all? Does it ignore any reference counts and
> delete the context?
>
> A followup question: If for example an instance is being torn down, how
can
> I save the context so it does not get deleted. i.e. Is there a “remove”
> context?
>
> Ken
>

From what I gathered from a similar exchange I had with Neal & Molly early
last month (Look at FltMgr archives 1/9/04).

FltDeleteContext() “undoes” a FltSetContext (i.e. - removes it from the
stream context list and decrements the refcount.)

FltReleaseContext() just decrements the refcount.

So, if in your pre-close, you call FltGetContext(), FltDeleteContext(), you
should now have a “detached” context with a residual refcount from the
FltGetContext(). You can pass this forward to post-close and the
FltReleaseContext() to free it. Seems to work for me!

/ted

-----Original Message-----
From: Ken Galipeau [mailto:xxxxx@legato.com]
Sent: Thursday, February 19, 2004 2:58 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FtlReleaseContext vs FltDeleteContext

What is the difference between these two in pratice.
I see from testing that calling FltReleaseContext not only decr the
reference count but also causes the context to be freed, even if it has been
set on an instance, for example, that is not being torned down.
Why is FtlDeleteContext at all? Does it ignore any reference counts and
delete the context?

A followup question: If for example an instance is being torn down, how can
I save the context so it does not get deleted. i.e. Is there a “remove”
context?

Ken

Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@livevault.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

This reminds me of another point regarding context reference counts which
may be just ambiguous documentation.

The scenario:
FltAllocateContext()
FltSetContext() –> fails

If I call FltReleaseContext() is the object is freed? Or, as the
documentation suggests, I need to call FltReleaseContext() twice - Once for
the Allocate and once for the Set - which by the way failed?

/ted

(I think I have another refcount issue with Instance teardown during system
shutdown, but I need to debug it further to see if it is my problem or not.
Some details: I see the Instance context cleanup callback even though I have
outstanding stream context references on the volume object & root
directory.)

-----Original Message-----
From: Ravinder Thind [mailto:xxxxx@windows.microsoft.com]
Sent: Thursday, February 19, 2004 3:36 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] FtlReleaseContext vs FltDeleteContext

Ken,

FltReleaseContext will decrement the reference count on the context which
was added after a successful call to FltGetXxxContext or FltAllocateContext.
FltDeleteContext takes off the reference count which was added by
FltSetXxxContext and deletes the context associated with the object.
FltReleaseContext will free the context only if this was the last reference
on that context, it does not delete the context. The life time of the
context is associated with the life time of the object. When the object is
deleted, the context associated with it is automatically gets deleted, so
you should never have to delete the context. FltDeleteContext has been
provided if you want to delete the context before this object is deleted,
e.g. you may want to delete the stream context if this file is no longer
interesting to you and free up memory.

In your example described below you can remove the context by calling
FltDeleteContext. If you want to save this context do not call
FltReleaseContext and it won’t be freed. You can latter call FltSetContext
using this context on a new object.

Thanks
Ravinder

This posting is provided “AS IS” with no warranties, and confers no rights.

“Ken Galipeau” wrote in message news:xxxxx@ntfsd…
> What is the difference between these two in pratice.
> I see from testing that calling FltReleaseContext not only decr the
> reference count but also causes the context to be freed, even if it
> has
been
> set on an instance, for example, that is not being torned down. Why is
> FtlDeleteContext at all? Does it ignore any reference counts and
> delete the context?
>
> A followup question: If for example an instance is being torn down,
> how
can
> I save the context so it does not get deleted. i.e. Is there a
> “remove” context?
>
> Ken
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@livevault.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

FltReleaseContext will free the context in this scenario. You don’t have to
call FltReleaseContext twice, just once for the Allocate.

-Ravinder

This posting is provided “AS IS” with no warranties, and confers no rights.

“Ted Hess” wrote in message news:xxxxx@ntfsd…
> This reminds me of another point regarding context reference counts which
> may be just ambiguous documentation.
>
> The scenario:
> FltAllocateContext()
> FltSetContext() –> fails
>
> If I call FltReleaseContext() is the object is freed? Or, as the
> documentation suggests, I need to call FltReleaseContext() twice - Once
for
> the Allocate and once for the Set - which by the way failed?
>
> /ted
>
> (I think I have another refcount issue with Instance teardown during
system
> shutdown, but I need to debug it further to see if it is my problem or
not.
> Some details: I see the Instance context cleanup callback even though I
have
> outstanding stream context references on the volume object & root
> directory.)
>
> -----Original Message-----
> From: Ravinder Thind [mailto:xxxxx@windows.microsoft.com]
> Sent: Thursday, February 19, 2004 3:36 PM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] FtlReleaseContext vs FltDeleteContext
>
>
> Ken,
>
> FltReleaseContext will decrement the reference count on the context which
> was added after a successful call to FltGetXxxContext or
FltAllocateContext.
> FltDeleteContext takes off the reference count which was added by
> FltSetXxxContext and deletes the context associated with the object.
> FltReleaseContext will free the context only if this was the last
reference
> on that context, it does not delete the context. The life time of the
> context is associated with the life time of the object. When the object is
> deleted, the context associated with it is automatically gets deleted, so
> you should never have to delete the context. FltDeleteContext has been
> provided if you want to delete the context before this object is deleted,
> e.g. you may want to delete the stream context if this file is no longer
> interesting to you and free up memory.
>
> In your example described below you can remove the context by calling
> FltDeleteContext. If you want to save this context do not call
> FltReleaseContext and it won’t be freed. You can latter call FltSetContext
> using this context on a new object.
>
> Thanks
> Ravinder
> –
> This posting is provided “AS IS” with no warranties, and confers no
rights.
>
> “Ken Galipeau” wrote in message news:xxxxx@ntfsd…
> > What is the difference between these two in pratice.
> > I see from testing that calling FltReleaseContext not only decr the
> > reference count but also causes the context to be freed, even if it
> > has
> been
> > set on an instance, for example, that is not being torned down. Why is
> > FtlDeleteContext at all? Does it ignore any reference counts and
> > delete the context?
> >
> > A followup question: If for example an instance is being torn down,
> > how
> can
> > I save the context so it does not get deleted. i.e. Is there a
> > “remove” context?
> >
> > Ken
> >
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@livevault.com To
unsubscribe
> send a blank email to xxxxx@lists.osr.com
>