VINVALBUF(9)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

okay so bestie, welcome to VINVALBUF(9) from the Kernel Developer's Manual β€” the page that flushes and invalidates buffers like it’s cleaning out a group chat πŸ’…βœ¨

🌸 NAME 🌸

vinvalbuf β€” flushes and invalidates all buffers associated with a vnode. literally all the buffers tied to that vnode, bestie. 🫢

✨ SYNOPSIS ✨

Include these first, no skipping:

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

int
vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, int slpflag,
    int slptimeo);

πŸ’– DESCRIPTION πŸ’–

The vinvalbuf() function invalidates all of the buffers associated with the given vnode. This includes buffers on the clean list and the dirty list. If the V_SAVE flag is specified, then the buffers on the dirty list are synced prior to being released. If there is a VM Object associated with the vnode, it is removed. πŸ‘‘πŸ”₯

Its arguments are:

  • vp β€” a pointer to the vnode whose buffers will be invalidated.
  • flags β€” the only supported flag is V_SAVE, and it indicates that dirty buffers should be synced with the disk.
  • cred β€” the user credentials that are used to VOP_FSYNC(9) buffers if V_SAVE is set.
  • slpflag β€” the slp flag that will be used in the priority of any sleeps in the function.
  • slptimeo β€” the timeout for any sleeps in the function.

πŸ”’ LOCKS πŸ”’

The vnode is assumed to be locked prior to the call and remains locked upon return. yep, it stays locked, no cap. πŸ”

Giant must be held before the call and remains locked upon return. so yeah, get that lock sorted first, bestie. 🧚

πŸ’€ RETURN VALUES πŸ’€

A 0 value is returned on success. that’s the whole vibe: 0 means slay. ✨

πŸ¦‹ PSEUDOCODE πŸ¦‹

      vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
      error = vinvalbuf(devvp, V_SAVE, cred, 0, 0);
      VOP_UNLOCK(devvp, 0);
      if (error)
              return (error);

πŸ“ ERRORS πŸ“

  • [ENOSPC] β€” the file system is full. (With V_SAVE)
  • [EDQUOT] β€” disc quota exceeded. (With V_SAVE)
  • [EWOULDBLOCK] β€” sleep operation timed out. (See slptimeo)
  • [ERESTART] β€” a signal needs to be delivered and the system call should be restarted. (With PCATCH set in slpflag)
  • [EINTR] β€” the system has been interrupted by a signal. (With PCATCH set in slpflag)

🌈 SEE ALSO 🌈

go read tsleep(9) and VOP_FSYNC(9) too, iykyk πŸ‘€πŸ’œ

πŸŽ€ AUTHORS πŸŽ€

This manual page was written by Chad David <davidc@acns.ab.ca>. iconic. πŸ‘‘


β€” πŸŽ€ xoxo, Debian β€” October 20, 2008 πŸŽ€

πŸ“¦ where this page comes from