Subject: VOP_FSYNC() interface change
To: None <tech-kern@NetBSD.ORG>
From: Klaus Klein <>
List: tech-kern
Date: 06/01/1998 15:35:04
First, a bit of background:

POSIX1.b defines the fdatasync() function, which, like fsync(),
completes the queued I/O operations of a file descriptor, but enforcing
synchronized I/O data integrity completition only.  Basically, when
fdatasync() returns successful, the file data has been written to
stable storage but file attributes that are not necessary for data
retrieval need not be successfully transferred prior to returning.

In order to implement this functionality I considered adding an
`fdatasync' vnode operator, but after a conversation with Frank van
der Linden about this subject, I think it's more feasible to merge
this functionality into the existing fsync vnode operator.

The current fsync vnode operator receives a `waitfor' argument, which
may be either MNT_WAIT (synchronous operation) or MNT_NOWAIT
(asynchronous operation).  This should be a bitwise inclusive-or'ed
flag argument, and a `MNT_*' argument should not be passed to an
operation that doesn't operate on a file system (or mount point) as
such but on a vnode.  I propose the following fsync operator interface

    * rename the `waitfor' argument to `flags',

    * define two flags which can be bitwise inclusive-or'ed into this

      - FSYNC_WAIT, which specifies synchronous operation; if not set,
        operation will be asynchronous,

      - FSYNC_DATAONLY, which is a hint: if possible, enforce data
        integrity completition only.  If it's not feasible for a file
        store implementation to omit file status synchronization when
        synchronizing file data, this is ignored.