Difference between revisions of "VFS"
m |
m |
||
Line 58: | Line 58: | ||
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. | 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. | ||
+ | |||
+ | |||
+ | === Differences === | ||
+ | |||
+ | '''VNOP_ROOT''' on OSX will hold iocount. On FreeBSD will hold usecount as well as vn_lock (holdcount) |
Revision as of 06:09, 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 | VOP_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.
Differences
VNOP_ROOT on OSX will hold iocount. On FreeBSD will hold usecount as well as vn_lock (holdcount)