Difference between revisions of "VFS"
m |
m |
||
(4 intermediate revisions by one user not shown) | |||
Line 21: | Line 21: | ||
|- | |- | ||
!align="right" |IllumOS: | !align="right" |IllumOS: | ||
− | | | + | |v_count |
− | | | + | |VN_HOLD |
− | | | + | |VN_RELE |
|'''IllumOS:''' | |'''IllumOS:''' | ||
|? | |? | ||
Line 36: | Line 36: | ||
|holdcount | |holdcount | ||
|vn_lock | |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) |
Latest revision as of 07:14, 2 May 2014
VFS[edit]
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: | v_count | VN_HOLD | VN_RELE | 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[edit]
VNOP_ROOT on OSX will hold iocount. On FreeBSD will hold usecount as well as vn_lock (holdcount)