Date: Sun, 2 May 1999 05:35:30 +1000 From: Bruce Evans <bde@zeta.org.au> To: dg@root.com, oppermann@pipeline.ch Cc: brad@shub-internet.org, FreeBSD-current@FreeBSD.ORG, grog@lemis.com, mjacob@feral.com Subject: Re: Porting Greg Lehey's rawio.c from FreeBSD to Linux... Message-ID: <199905011935.FAA08996@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> >Linux' fsync() works only on directories, not on files. >> >> Huh? That doesn't make any sense. The "f" in fsync() stands for "file". > >It does write the file to the disk but not the inode. To get the inode >on the disk you have to fsync() the directory (which sync'ed the whole >FS before 2.0.35). Kinda stupid... fsync() can't reasonably sync everything on filesystems with async metadata. It think it should sync the file's contents and inode, but not directory entries pointing to the inode. fsync() on the directories containing the entries that you care about seems reasonable. >If you can't believe it: >http://www.ornl.gov/its/archives/mailing-lists/qmail/1998/05/threads.html#00691 No one mentioned the POSIX.1b way, perhaps because it has only been standard for 4-5 years. It has: __POSIX_FSYNC feature test macro. If this is defined, then fsync() exists and synchronizes the file to an implementation-defined stage. __POSIX_SYNCHRONIZED_IO feature test macro. If this is defined, then fsync() synchronizes to completion. Also, fdatasync() exists and synchronizes the file's contents, like Linux's fsync() does. Also, there are open flags ODSYNC, O_RSYNC and O_SYNC. O_SYNC and O_DSYNC have similar semantics to fsync() and fdatasync(). O_RSYNC is to synchronise metadata changed by reads (mainly access timestamps). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905011935.FAA08996>