---
name: "VREF"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/VREF/9freebsd"
---

# VREF(9freebsd)

increment the use count for a vnode

## NAME

**vref**, **vrefl** – increment the use count for a vnode

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/vnode.h\>**

*void*\

**vref**(*struct vnode \*vp*);

*void*\

**vrefl**(*struct vnode \*vp*);

## DESCRIPTION

Increment the *v\_usecount* field of a vnode.

- *vp*

  the vnode to increment

Each vnode maintains a reference count of how many parts of the system are using the vnode. This allows the system to detect when a vnode is no longer being used and can be safely recycled for a different file.

Any code in the system which is using a vnode (e.g. during the operation of some algorithm or to store in a data structure) should call **vref**() or **vrefl**().

**vref**() locks the vnode interlock while **vrefl**() expects the interlock to already be held.

## SEE ALSO

[vget(9)](/vget/9.md), [vnode(9)](/vnode/9.md), [vput(9)](/vput/9.md), [vrefcnt(9)](/vrefcnt/9.md), [vrele(9)](/vrele/9.md)

## AUTHORS

This manual page was written by Doug Rabson.
