---
name: "VFS_SYNC"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
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*, *struct ucred \*cred*, *struct thread \*td*);

## 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

- *cred*

  The caller's credentials.

- *td*

  The calling thread.

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.
