---
name: "VFS_SYNC"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/VFS_SYNC"
---

# VFS\_SYNC(9)

flush unwritten data

## NAME

**VFS\_SYNC** – flush unwritten data

## SYNOPSIS

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

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

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

*int*\

**VFS\_SYNC**(*struct mount \*mp*, *int waitfor*);

## DESCRIPTION

The **VFS\_SYNC**() macro writes out all unwritten data in the file system mounted as *mp*.

The arguments it expects are:

- *mp*

  The file system.

- *waitfor*

  Whether the function should wait for I/O to complete. Possible values are:

  - MNT\_WAIT

    synchronously wait for I/O to complete

  - MNT\_NOWAIT

    start all I/O, but do not wait for it

  - MNT\_LAZY

    push data not written by file system syncer

The **VFS\_SYNC**() macro calls the *vfs\_sync* method of the file system, which normally calls [VOP\_FSYNC(9)](/VOP_FSYNC/9.md) for all the vnodes in the file system.

## SEE ALSO

[fsync(2)](/fsync/2.md), [sync(2)](/sync/2.md), [VFS(9)](/VFS/9.md), [vnode(9)](/vnode/9.md), [VOP\_FSYNC(9)](/VOP_FSYNC/9.md)

## AUTHORS

This manual page was written by Doug Rabson.
