ext4: Fix async commit mode to be safe by using a barrier
authorTheodore Ts'o <tytso@mit.edu>
Fri, 11 Sep 2009 13:30:12 +0000 (09:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 11 Sep 2009 13:30:12 +0000 (09:30 -0400)
commit0e3d2a6313d03413d93327202a60256d1d726fdc
tree3b4165751568e4332edad89a82e76bc6708c8ccd
parent71290b368ad5e1e0b0b300c9d5638490a9fd1a2d
ext4: Fix async commit mode to be safe by using a barrier

Previously the journal_async_commit mount option was equivalent to
using barrier=0 (and just as unsafe).  This patch fixes it so that we
eliminate the barrier before the commit block (by not using ordered
mode), and explicitly issuing an empty barrier bio after writing the
commit block.  Because of the journal checksum, it is safe to do this;
if the journal blocks are not all written before a power failure, the
checksum in the commit block will prevent the last transaction from
being replayed.

Using the fs_mark benchmark, using journal_async_commit shows a 50%
improvement:

FSUse%        Count         Size    Files/sec     App Overhead
     8         1000        10240         30.5            28242

vs.

FSUse%        Count         Size    Files/sec     App Overhead
     8         1000        10240         45.8            28620

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/jbd2/commit.c