VOP_INACTIVE(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… VOP_INACTIVE(9) β€” the Kernel Developer's Manual, but make it cute

okay so bestie, we're in VOP_INACTIVE(9) territory today β€” that's the Kernel Developer's Manual section 9, the land of vnodes and vibes. two functions, one mission: giving file system resources back. let's go πŸ¦‹


✨ NAME ✨

VOP_INACTIVE, VOP_RECLAIM β€” reclaim file system resources for a vnode. that's the whole gig, no cap πŸ’–


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <sys/vnode.h>

int
VOP_INACTIVE(struct vnode *vp, struct thread *td);

int
VOP_RECLAIM(struct vnode *vp, struct thread *td);

πŸŽ€ DESCRIPTION πŸŽ€

first up, the arguments, because we always do the arguments:

  • vp β€” the vnode being reclaimed. that's it, that's the argument bestie 🫢

πŸ’œ VOP_INACTIVE()

so VOP_INACTIVE() is usually called when the kernel is no longer using the vnode. usually. not always. and that distinction is doing a lot of heavy lifting here πŸ‘‘

like, there is no guarantee it will be called at all β€” for example if the last reference was dropped while the vnode lock could not be upgraded to exclusive without sleeping. (yes, without sleeping, that whole situation 😭)

this may be because the reference count reaches zero, or it may be that the file system is being forcibly unmounted while there are open files. either way, same function.

it can be used to reclaim space on the last close of an 'open but deleted' file. iconic behaviour honestly ✨

🧚 VOP_RECLAIM()

VOP_RECLAIM() hits different β€” it's called when a vnode is being reused for a different file system. any file system specific resources associated with the vnode should be freed. that's your cue to clean up, no hoarding πŸ—‘οΈπŸ’…


πŸ”’ LOCKS πŸ”’

for both VOP_INACTIVE() and VOP_RECLAIM(), the vp will be exclusively locked on entry, and must be left exclusively locked on return. non-negotiable, fr fr πŸ”₯


πŸ‘€ SEE ALSO πŸ‘€


πŸ–ŠοΈ AUTHORS πŸ–ŠοΈ

this manual page was written by Doug Rabson. thank you Doug, you ate πŸ‘‘β­


and that's the whole page, bestie! πŸ’€πŸŒΈ


sign-off era: this one came from Debian, dated March 15, 2019 β€” so old, so iconic, we stan a vintage manpage πŸŽ€πŸ¦‹ go forth and reclaim those resources πŸ’–

πŸ“¦ where this page comes from