1 ext4: disable synchronous transaction batching if max_batch_time==0
3 From: Eric Sandeen <sandeen@redhat.com>
5 The mount manpage says of the max_batch_time option,
7 This optimization can be turned off entirely
8 by setting max_batch_time to 0.
10 But the code doesn't do that. So fix the code to do
13 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 Cc: stable@vger.kernel.org
18 Lightly tested: it mounts, accepts the mount option == 0,
19 shows "0" in /proc/mounts, and does basic IO & unmounts
22 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
23 index 6f9e6fa..ab5a791 100644
26 @@ -1524,8 +1524,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
27 arg = JBD2_DEFAULT_MAX_COMMIT_AGE;
28 sbi->s_commit_interval = HZ * arg;
29 } else if (token == Opt_max_batch_time) {
31 - arg = EXT4_DEF_MAX_BATCH_TIME;
32 sbi->s_max_batch_time = arg;
33 } else if (token == Opt_min_batch_time) {
34 sbi->s_min_batch_time = arg;
36 diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
37 index 38cfcf5..6f0f590 100644
38 --- a/fs/jbd2/transaction.c
39 +++ b/fs/jbd2/transaction.c
40 @@ -1588,9 +1588,12 @@ int jbd2_journal_stop(handle_t *handle)
41 * to perform a synchronous write. We do this to detect the
42 * case where a single process is doing a stream of sync
43 * writes. No point in waiting for joiners in that case.
45 + * Setting max_batch_time to 0 disables this completely.
48 - if (handle->h_sync && journal->j_last_sync_writer != pid) {
49 + if (handle->h_sync && journal->j_last_sync_writer != pid &&
50 + journal->j_max_batch_time) {
51 u64 commit_time, trans_time;
53 journal->j_last_sync_writer = pid;
56 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
57 the body of a message to majordomo@vger.kernel.org
58 More majordomo info at http://vger.kernel.org/majordomo-info.html