On Mon, 4 Nov 1996 02:22:55 +0100, Andries.Brouwer@cwi.nl said:
[ Stephen Tweedie wrote: ]
> : No it doesn't! Linux's fsync() only falls back on doing a
> : whole-device sync if it is used on a file whose filesystem doesn't
> : provide its own specific fsync code.
> From a random kernel source:
> asmlinkage int sys_fsync(unsigned int fd)
> {
> ... ... ...
> if (file->f_op->fsync(inode,file))
> return -EIO;
> return 0;
> }
Indeed, but the kernel has good reason not to fall back to fsync_dev()
at this point --- the filesystem may not have fsync()-capable
semantics (eg. NFS or proc).
If you look in linux/fs/fat/file.c, you'll see that the
file_operations for dos has got
file_fsync /* fsync */
near the end. The dos filesystems don't have their own fsync, but
instead just reference file_fsync() which does
int file_fsync (struct inode *inode, struct file *filp)
{
return fsync_dev(inode->i_dev);
}
So the fallback to a whole device fsync() is the responsibility of the
filesystem itself, not of the upper layers. The fallback still
happens, though!
Cheers,
Stephen.