1 jbd2: fix dbench4 performance regression for 'nobarrier' mounts
3 From: Jan Kara <jack@suse.cz>
5 Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
6 synchronous" removed REQ_SYNC flag from WRITE_FUA implementation. Since
7 JBD2 strips REQ_FUA and REQ_FLUSH flags from submitted IO when the
8 filesystem is mounted with nobarrier mount option, journal superblock
9 writes ended up being async writes after this patch and that caused
10 heavy performance regression for dbench4 benchmark with high number of
11 processes. In my test setup with HP RAID array with non-volatile write
12 cache and 32 GB ram, dbench4 runs with 8 processes regressed by ~25%.
14 Fix the problem by making sure journal superblock writes are always
15 treated as synchronous since they generally block progress of the
16 journalling machinery and thus the whole filesystem.
18 Fixes: b685d3d65ac791406e0dfd8779cc9b3707fea5a3
19 CC: stable@vger.kernel.org
20 Signed-off-by: Jan Kara <jack@suse.cz>
21 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
23 fs/jbd2/journal.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
26 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
27 index 5adc2fb62b0f..e768126f6a72 100644
28 --- a/fs/jbd2/journal.c
29 +++ b/fs/jbd2/journal.c
30 @@ -1348,7 +1348,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
31 jbd2_superblock_csum_set(journal, sb);
33 bh->b_end_io = end_buffer_write_sync;
34 - ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
35 + ret = submit_bh(REQ_OP_WRITE, write_flags | REQ_SYNC, bh);
37 if (buffer_write_io_error(bh)) {
38 clear_buffer_write_io_error(bh);