3 .\" Copyright (c) 1996 Doug Rabson
5 .\" All rights reserved.
7 .\" Copyright (c) 2019 The FreeBSD Foundation
9 .\" Portions of this documentation were written by BFF Storage Systems under
10 .\" sponsorship from the FreeBSD Foundation.
12 .\" This program is free software.
14 .\" Redistribution and use in source and binary forms, with or without
15 .\" modification, are permitted provided that the following conditions
17 .\" 1. Redistributions of source code must retain the above copyright
18 .\" notice, this list of conditions and the following disclaimer.
19 .\" 2. Redistributions in binary form must reproduce the above copyright
20 .\" notice, this list of conditions and the following disclaimer in the
21 .\" documentation and/or other materials provided with the distribution.
23 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
24 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 .Nd flush file system buffers for a file
47 .Fn VOP_FDATASYNC "struct vnode *vp" "struct thread *td"
49 .Fn VOP_FSYNC "struct vnode *vp" "int waitfor" "struct thread *td"
52 ensures that a file can be recovered to its current state following a crash.
53 That typically requires flushing the file's dirty buffers, its inode, and
54 possibly other filesystem metadata to persistent media.
56 is used to implement the
63 .Bl -tag -width waitfor
65 The vnode of the file.
67 Whether the function should wait for I/O to complete.
69 .Bl -tag -width MNT_NOWAIT
71 Synchronously wait for I/O to complete.
73 Start all I/O, but do not wait for it.
75 Push data not written by file system syncer.
82 is similar, but it does not require that all of the file's metadata be flushed.
83 It only requires that the file's data be recoverable after a crash.
84 That implies that the data itself must be flushed to disk, as well as some
85 metadata such as the file's size but not necessarily its attributes.
87 should always wait for I/O to complete, as if called with
93 The vnode should be exclusively locked on entry, and stays locked on return.
95 Zero is returned if the call is successful, otherwise an appropriate
96 error code is returned.
100 The file system is full.
107 This manual page was written by