Commit 26f14a57 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Add commit=0 to ext3, meaning "set commit to default".

From: Bart Samwel <bart@samwel.tk>

Add support for the value "0" to ext3's "commit" option.  When this value
is given, ext3 substitutes it by the default commit interval.  Introduce a
constant JBD_DEFAULT_MAX_COMMIT_AGE for this.
parent 93d33a48
...@@ -735,6 +735,10 @@ static int parse_options (char * options, struct ext3_sb_info *sbi, ...@@ -735,6 +735,10 @@ static int parse_options (char * options, struct ext3_sb_info *sbi,
case Opt_commit: case Opt_commit:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return 0;
if (option < 0)
return 0;
if (option == 0)
option = JBD_DEFAULT_MAX_COMMIT_AGE;
sbi->s_commit_interval = HZ * option; sbi->s_commit_interval = HZ * option;
break; break;
case Opt_data_journal: case Opt_data_journal:
......
...@@ -636,7 +636,7 @@ static journal_t * journal_init_common (void) ...@@ -636,7 +636,7 @@ static journal_t * journal_init_common (void)
spin_lock_init(&journal->j_list_lock); spin_lock_init(&journal->j_list_lock);
spin_lock_init(&journal->j_state_lock); spin_lock_init(&journal->j_state_lock);
journal->j_commit_interval = (HZ * 5); journal->j_commit_interval = (HZ * JBD_DEFAULT_MAX_COMMIT_AGE);
/* The journal is marked for error until we succeed with recovery! */ /* The journal is marked for error until we succeed with recovery! */
journal->j_flags = JFS_ABORT; journal->j_flags = JFS_ABORT;
......
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
*/ */
#undef JBD_PARANOID_IOFAIL #undef JBD_PARANOID_IOFAIL
/*
* The default maximum commit age, in seconds.
*/
#define JBD_DEFAULT_MAX_COMMIT_AGE 5
#ifdef CONFIG_JBD_DEBUG #ifdef CONFIG_JBD_DEBUG
/* /*
* Define JBD_EXPENSIVE_CHECKING to enable more expensive internal * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment