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

# VFS\_SYNC(9freebsd)

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.
