]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ext4: Make non-journal fsync work properly
authorFrank Mayhar <fmayhar@google.com>
Thu, 10 Sep 2009 02:33:47 +0000 (22:33 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:06:33 +0000 (08:06 -0800)
commit90608af946cb40a743f3d7af58310ff8381b7101
tree3f8a6a3aa3e3b5f83eb0c9f0012a2c0669bcd560
parent75c1a3f1f6b164f280b7713a8b301e125ae86292
ext4: Make non-journal fsync work properly

(cherry picked from commit 91ac6f43317c0bf99969665f98016548011dfa38)

Teach ext4_write_inode() and ext4_do_update_inode() about non-journal
mode:  If we're not using a journal, ext4_write_inode() now calls
ext4_do_update_inode() (after getting the iloc via ext4_get_inode_loc())
with a new "do_sync" parameter.  If that parameter is nonzero _and_ we're
not using a journal, ext4_do_update_inode() calls sync_dirty_buffer()
instead of ext4_handle_dirty_metadata().

This problem was found in power-fail testing, checking the amount of
loss of files and blocks after a power failure when using fsync() and
when not using fsync().  It turned out that using fsync() was actually
worse than not doing so, possibly because it increased the likelihood
that the inodes would remain unflushed and would therefore be lost at
the power failure.

Signed-off-by: Frank Mayhar <fmayhar@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/inode.c