> If you want to sync _everything_, it's at least 5 seeks per write
> syscall when you're writing a new file: superblock, group descriptor,
> block bitmap, inode, data, and potentially inode indirect.
>
> There's no point doing all that, especially since some of that data is
> redundant and will be rebuilt by e2fsck anyway after a crash.
The file system cannot judge on what's needed, neither can the file
system developer.
The developer however can offer the administrator
and/or application developer the corresponding interfaces. In the sense
of portability, however, it may be rather useful to correspond to BSD
semantics, so I vote to change sync and offer dirsync -- it might be
useful to use BSD nomenclature though and offer a synonymous noasync
option (which also has dirsync semantics as laid out in this thread
before).
It does not matter whether you look at BSD or Linux man pages, either
one documents "sync - All I/O to the file system should be done
synchronously." It should behave like documented. Let's not introduce
compatibility problems by fixing the documentation.
> Is it really such an important feature that we're willing to suffer a
> factor-of-100 or more slowdown for it?
It depends on the task. If the machine regularly reads data from an
external interface and records it to disk, like in a log, synchronous
data writes may be important.
BTW, Wietse Venema was dazzled when he got to know that Linux values its
syslog (defaults to all-synchronous writes) more than its mail (defaults
to all-asynchronous writes that not even a file fsync() rectifies).
> Not-scalable is doing 5000 seeks to write a 4MB file.
If that's what the admin wants, let him do so.
> what the inode is like during the write. All that is desired in that
> example is fsync-on-close, and it is insane to implement
> fsync-on-close by writing every single block of the file
> synchronously.
Yes, but you cannot generalize this example.
> appropriate. If we want that, lets add it as a new option, but I
> don't see the benefit in making o- sync do all file data writes 100%
> synchronously.
Compatibility and reliability are good points.
-- Matthias Andree"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/