VRELE(9)
π VRELE(9) β the kernel dev manual, bestie edition π
okay so this is the page for vput, vrele, and vunref β the three little gremlins that all do the same vibe: decrement the use count for a vnode. yes they're from the Kernel Developer's Manual, and yes they're lowkey iconic.
β¨ NAME β¨
vput, vrele, vunref β decrement the use count for a vnode
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
void
vput(struct vnode *vp);
void
vrele(struct vnode *vp);
void
vunref(struct vnode *vp);
π¦ DESCRIPTION π¦
So the whole entire job of these three is: decrement the v_usecount field of a vnode. that's it. that's the post. π
Here's the one argument you're gonna be passing around like it's the aux cord:
vpβ the vnode to decrement
Now let's meet the trio, because they are not the same girlies even though they look alike:
vrele()β takes an unlocked vnode, and returns with the vnode unlocked. so it goes in chill and comes out chill. no cap.vput()β should be given a locked vnode as its argument, and the vnode is unlocked after the function returns. and here's the tea π βvput()is operationally equivalent to callingVOP_UNLOCK(9)followed byvrele(), just with less overhead. so it's the same fit, but snatched and efficient.vunref()β takes a locked vnode as its argument, and returns with the vnode locked. goes in locked, comes out locked. consistency queen.
Any code in the system which signified its use of a vnode by usecount should call one of the listed function to decrement use counter. like, that's the whole point. If the v_usecount field of the non-doomed vnode reaches zero, then it will be inactivated and placed on the free list. bye bestie, off to the free list you go π«Ά
Heads up though β the vrele() function may lock the vnode. And all three functions may sleep. so don't be out here calling them in places where sleeping is illegal, that's not the vibe π
The hold count for the vnode is always greater or equal to the usecount. fr fr, always. And non-forced unmount fails when a mount point owns a vnode that has a non-zero usecount β see vflush(9). so if your unmount is acting up, check your usecounts, that's the main character energy you're looking for π
π₯ SEE ALSO π₯
π AUTHORS π
This manual page was written by Doug Rabson and Konstantin Belousov. absolute legends, we stan π
and that's the page!! go forth and decrement responsibly, bestie. this lil beauty came to you from Debian, dated February 24, 2016 β vintage but still slaying β¨π¦πΈ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996 Doug Rabson
- Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms