Re: v_iocount and cache_lookup()
Re: v_iocount and cache_lookup()
- Subject: Re: v_iocount and cache_lookup()
- From: Ken Hornstein <email@hidden>
- Date: Wed, 27 Apr 2011 15:01:34 -0400
>I am looking at all vnode_get()s and vnode_put()s in my code and I have come
>across a piece of code that seems to assume that cache_lookup() returns with
>a v_iocount taken. I looked at cache_lookup() and I did not see any
>implicit vnode_get() or vnode_getiocount() when there's a positive match.
>From bsd/vfs/vfs_cache.c:1369 - cache_lookup() (Latest Darwin sources)
/* We found a "positive" match, return the vnode */
if (vp) {
NCHSTAT(ncs_goothds);
vid = vp->v_id;
NAME_CACHE_UNLOCK();
if (vnode_getwithvid(vp, vid)) {
Note the last line (vnode_getwithvid()); that's what increments the iocount.
So yes, cache_lookup() returns a vnode with an iocount. Also, looking at
bsd/vfs/vfs_subr.c ... vnode_getiocount() is an internal function.
--Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden