VREF(9)
π VREF(9) β like, the vnode reference counter manual, bestie
okay so this is a page from the Kernel Developer's Manual (that's the manual name, iykyk π) and honestly it's short but it matters, so let's get into it β¨
β¨ NAME β¨
vref, vrefl β increment the use count for a vnode
like literally that's the whole job. bumping the counter. no cap. π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
void
vref(struct vnode *vp);
void
vrefl(struct vnode *vp);
two functions, both void, both take a struct vnode *vp, both return nothing because they're too busy slaying π¦
π DESCRIPTION π
So bestie, the tea is: these functions increment the v_usecount field of a vnode. That's it. That's the whole vibe check. β¨
vpβ the vnode to increment π«Ά
okay but why do we care, right? because every single vnode keeps a reference count of how many parts of the system are using it. think of it as a little tally of everyone who's currently obsessed with that vnode π and the whole point is that this lets the system detect when a vnode is no longer being used β and once nobody's using it, it can be safely recycled for a different file. so it's giving responsible resource management, main character energy for the kernel π₯
the rule, fr fr: any code in the system which is using a vnode (like, during the operation of some algorithm, or to store in a data structure) should call vref() or vrefl(). no excuses, no skipping, periodt π
and here's the difference between the two, pay attention because this is the part people mess up π
vref()locks the vnode interlock while it does its thingvrefl()expects the interlock to already be held β so like, it's on you, you better already have it π
so if you callvrefl()without already holding the interlock, that's a you problem, not avrefl()problem. pick the right one, bestie π
π¦ SEE ALSO π¦
the whole vnode friend group, go read them too, they all ate π
π AUTHORS π
This manual page was written by Doug Rabson. iconic behaviour honestly, thank you Doug π«Ά
and that's the page!! this version came to you from Debian, dated January 18, 2016, filed under VREF(9) β mwah, go increment some counters responsibly bestie πβ¨
π¦ 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
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms