jbd commit interval tuning Allow an arbitrary commit interval to be set when mounting or remounting a filesystem. Note that if this is greater than the system bdflush interval, then the regular sync()s will beat the commit timer and you won't get longer commit timeouts. --- linux-2.4.19-ext3/fs/ext3/super.c.=K0015=.orig Fri Oct 11 15:52:00 2002 +++ linux-2.4.19-ext3/fs/ext3/super.c Fri Oct 11 15:52:01 2002 @@ -646,6 +646,11 @@ *mount_options &= ~EXT3_MOUNT_DATA_FLAGS; *mount_options |= data_opt; } + } else if (!strcmp (this_char, "commit")) { + unsigned long v; + if (want_numeric(value, "commit", &v)) + return 0; + sbi->s_commit_interval = (HZ * v); } else { printk (KERN_ERR "EXT3-fs: Unrecognized mount option %s\n", @@ -1229,6 +1234,22 @@ return NULL; } +/* + * Setup any per-fs journal parameters now. We'll do this both on + * initial mount, once the journal has been initialised but before we've + * done any recovery; and again on any subsequent remount. + */ +static void ext3_init_journal_params(struct ext3_sb_info *sbi, + journal_t *journal) +{ + if (sbi->s_commit_interval) + journal->j_commit_interval = sbi->s_commit_interval; + /* We could also set up an ext3-specific default for the commit + * interval here, but for now we'll just fall back to the jbd + * default. */ +} + + static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum) { struct inode *journal_inode; @@ -1263,7 +1284,7 @@ printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); iput(journal_inode); } - + ext3_init_journal_params(EXT3_SB(sb), journal); return journal; } @@ -1341,6 +1362,7 @@ goto out_journal; } EXT3_SB(sb)->journal_bdev = bdev; + ext3_init_journal_params(EXT3_SB(sb), journal); return journal; out_journal: journal_destroy(journal); @@ -1638,6 +1660,8 @@ es = sbi->s_es; + ext3_init_journal_params(sbi, sbi->s_journal); + if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) return -EROFS;