Difference between revisions of "VFS"

From OpenZFS on OS X
Jump to: navigation, search
Line 36: Line 36:

Revision as of 05:59, 2 May 2014


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 VOP_UNLOCK

The call vput in FreeBSD, means vn_unlock AND vrele.


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


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.