VRELE(9)
π VRELE(9) β vput, vrele, vunref π
okay bestie, come sit with me, we're talking about the Kernel Developer's Manual today and honestly? this one is a whole vibe. we're out here decrementing use counts on vnodes and it's giving very much "responsible resource management era" β¨
πΈ 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);
like yes, three little functions, all returning void, all taking a struct vnode *vp. no cap, that's the whole signature situation π
π DESCRIPTION π
So the tea is: these functions decrement the v_usecount field of a vnode. That's it. That's the job. π
vpβ the vnode to decrement π
Okay now let's get into the specifics because each one of these girlies has her own personality:
- The
vrele()function takes an unlocked vnode and returns with the vnode unlocked. She doesn't touch the lock, she just does her little count decrement and leaves. Lowkey the chill one π§ - The
vput()function should be given a locked vnode as argument, and the vnode is unlocked after the function returns. And here's the iconic part:vput()is operationally equivalent to callingVOP_UNLOCK(9)followed byvrele(9), with less overhead. It's literally the same thing but faster, iykyk π₯ - The
vunref()function takes a locked vnode as argument, and returns with the vnode still locked. She holds on. She's not letting go. Main character energy fr π
Any code in the system which signified its use of a vnode by usecount should call one of the listed functions to decrement the use counter. If the v_usecount field of the non-doomed vnode reaches zero, then it will be inactivated and placed on the free list. so like, when the count hits zero it's not gone-gone, it just goes to sit on the free list until someone needs it again. recycling era β»οΈ
Heads up bestie: the vrele() function may lock the vnode. And all three functions may sleep. So like, don't call these while holding something spicy, okay? π
Also important: the hold count for the vnode is always greater or equal to the usecount. And non-forced unmount fails when a mount point owns a vnode that has non-zero usecount β see vflush(9). So yeah, if you're trying to unmount nicely and something's still holding a usecount, it's not happening. Periodt. π
π¦ SEE ALSO π¦
go read these next, they're all part of the same little friend group π
π AUTHORS π
This manual page was written by Doug Rabson and Konstantin Belousov. absolute legends, we stan π
and that's the whole page bestie!! this was the VRELE(9) page from the Debian crew, dated February 24, 2016 β go forth and decrement responsibly, mwah π
β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 Doug Rabson
- Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms