Commit c4373a9a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Add "commit=0" to reiserfs

From: Bart Samwel <bart@samwel.tk>

Add support for value 0 to the commit option of reiserfs.  Means "restore
to the default value".  For the maximum commit age, this default value is
normally read from the journal; this patch adds an extra variable to cache
the default value for the maximum commit age.
parent 21c2358c
...@@ -2308,6 +2308,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo ...@@ -2308,6 +2308,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = commit_max_age; SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = commit_max_age;
} else { } else {
SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_max_commit_age); SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_max_commit_age);
SB_JOURNAL_DEFAULT_MAX_COMMIT_AGE(p_s_sb) = SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb);
SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = JOURNAL_MAX_TRANS_AGE; SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = JOURNAL_MAX_TRANS_AGE;
} }
......
...@@ -709,14 +709,12 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st ...@@ -709,14 +709,12 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
char *p = 0; char *p = 0;
int val = simple_strtoul (arg, &p, 0); int val = simple_strtoul (arg, &p, 0);
/* commit=NNN (time in seconds) */ /* commit=NNN (time in seconds) */
if ( *p != '\0' || val == 0) { if ( *p != '\0' || val < 0) {
printk ("reiserfs_parse_options: bad value %s\n", arg); printk ("reiserfs_parse_options: bad value %s\n", arg);
return 0; return 0;
} }
if ( val > 0 ) {
*commit_max_age = val; *commit_max_age = val;
} }
}
if ( c == 'w' ) { if ( c == 'w' ) {
char *p=0; char *p=0;
...@@ -824,6 +822,12 @@ static int reiserfs_remount (struct super_block * s, int * mount_flags, char * a ...@@ -824,6 +822,12 @@ static int reiserfs_remount (struct super_block * s, int * mount_flags, char * a
SB_JOURNAL_MAX_COMMIT_AGE(s) = commit_max_age; SB_JOURNAL_MAX_COMMIT_AGE(s) = commit_max_age;
SB_JOURNAL_MAX_TRANS_AGE(s) = commit_max_age; SB_JOURNAL_MAX_TRANS_AGE(s) = commit_max_age;
} }
else
{
/* 0 means restore defaults. */
SB_JOURNAL_MAX_COMMIT_AGE(s) = SB_JOURNAL_DEFAULT_MAX_COMMIT_AGE(s);
SB_JOURNAL_MAX_TRANS_AGE(s) = JOURNAL_MAX_TRANS_AGE;
}
if(blocks) { if(blocks) {
int rc = reiserfs_resize(s, blocks); int rc = reiserfs_resize(s, blocks);
......
...@@ -208,6 +208,7 @@ struct reiserfs_journal { ...@@ -208,6 +208,7 @@ struct reiserfs_journal {
unsigned int s_journal_trans_max ; /* max number of blocks in a transaction. */ unsigned int s_journal_trans_max ; /* max number of blocks in a transaction. */
unsigned int s_journal_max_batch ; /* max number of blocks to batch into a trans */ unsigned int s_journal_max_batch ; /* max number of blocks to batch into a trans */
unsigned int s_journal_max_commit_age ; /* in seconds, how old can an async commit be */ unsigned int s_journal_max_commit_age ; /* in seconds, how old can an async commit be */
unsigned int s_journal_default_max_commit_age ; /* the default for the max commit age */
unsigned int s_journal_max_trans_age ; /* in seconds, how old can a transaction be */ unsigned int s_journal_max_trans_age ; /* in seconds, how old can a transaction be */
struct reiserfs_journal_cnode *j_cnode_free_list ; struct reiserfs_journal_cnode *j_cnode_free_list ;
...@@ -481,6 +482,7 @@ int reiserfs_resize(struct super_block *, unsigned long) ; ...@@ -481,6 +482,7 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
#define SB_JOURNAL_TRANS_MAX(s) (SB_JOURNAL(s)->s_journal_trans_max) #define SB_JOURNAL_TRANS_MAX(s) (SB_JOURNAL(s)->s_journal_trans_max)
#define SB_JOURNAL_MAX_BATCH(s) (SB_JOURNAL(s)->s_journal_max_batch) #define SB_JOURNAL_MAX_BATCH(s) (SB_JOURNAL(s)->s_journal_max_batch)
#define SB_JOURNAL_MAX_COMMIT_AGE(s) (SB_JOURNAL(s)->s_journal_max_commit_age) #define SB_JOURNAL_MAX_COMMIT_AGE(s) (SB_JOURNAL(s)->s_journal_max_commit_age)
#define SB_JOURNAL_DEFAULT_MAX_COMMIT_AGE(s) (SB_JOURNAL(s)->s_journal_default_max_commit_age)
#define SB_JOURNAL_MAX_TRANS_AGE(s) (SB_JOURNAL(s)->s_journal_max_trans_age) #define SB_JOURNAL_MAX_TRANS_AGE(s) (SB_JOURNAL(s)->s_journal_max_trans_age)
/* A safe version of the "bdevname", which returns the "s_id" field of /* A safe version of the "bdevname", which returns the "s_id" field of
......
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