Difference between revisions of "VFS"

From OpenZFS on OS X
Jump to: navigation, search
m
Line 38: Line 38:
 
|vn_unlock
 
|vn_unlock
 
|}
 
|}
 +
 +
The call vput in FreeBSD, means vn_unlock AND vrele.
  
 
OSX:
 
OSX:

Revision as of 05:41, 2 May 2014

VFS

Short-term holds vnode->name incr decr Long-term holds vnode->name incr decr
OSX: iocount vnode_get* vnode_put OSX: usecount vnode_ref vnode_rele
IllumOS: ? ? ? IllumOS: ? ? ?
FreeBSD: usecount vget vrele/vput FreeBSD: holdcount vn_lock vn_unlock

The call vput in FreeBSD, means vn_unlock AND vrele.

OSX:

When calling vnode_create(), the created vnode will have a iocount++ set. When you are finished with it, someone will call vnode_put()


vnop_lookup is given a name, and if found, should call vnode_create, and return a vnode with iocount+1. vfs_root will return the rootvp, with iocount+1

All other vnops that take a vnode as input, will generally do

vnode_get(vp)
VNOP_GETATTR(vp)
node_put(vp)

So in most of your vnops, you do not call vnode_put, as that is handled by the caller (VFS). (list all vnops where this is true here)

If your code calls vnop_lookup, or vfs_root, they return a vnode with iocount+1, so you should call vnode_put() when you are done with the vnode.