diff options
author | Joern Engel <joern@logfs.org> | 2010-03-04 21:36:19 +0100 |
---|---|---|
committer | Joern Engel <joern@logfs.org> | 2010-03-04 21:36:19 +0100 |
commit | c6d3830140f1d56b07d8ab56a6e14ca3c492a39a (patch) | |
tree | 8dd9923b4217f6f7dc2735356d112fdcfa277852 /fs/logfs/journal.c | |
parent | 9421502b4fc894cc477be8fc49776830e37ca157 (diff) | |
download | linux-c6d3830140f1d56b07d8ab56a6e14ca3c492a39a.tar.bz2 |
[LogFS] Only write journal if dirty
This prevents unnecessary journal writes. More importantly it prevents
an oops due to a journal write on failed mount.
Diffstat (limited to 'fs/logfs/journal.c')
-rw-r--r-- | fs/logfs/journal.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/logfs/journal.c b/fs/logfs/journal.c index c0e7d63221d4..57eb4fb444a9 100644 --- a/fs/logfs/journal.c +++ b/fs/logfs/journal.c @@ -724,14 +724,17 @@ static int logfs_write_obj_aliases(struct super_block *sb) * bit wasteful, but robustness is more important. With this we can *always* * erase all journal segments except the one containing the most recent commit. */ -void logfs_write_anchor(struct inode *inode) +void logfs_write_anchor(struct super_block *sb) { - struct super_block *sb = inode->i_sb; struct logfs_super *super = logfs_super(sb); struct logfs_area *area = super->s_journal_area; int i, err; - BUG_ON(logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN); + if (!(super->s_flags & LOGFS_SB_FLAG_DIRTY)) + return; + super->s_flags &= ~LOGFS_SB_FLAG_DIRTY; + + BUG_ON(super->s_flags & LOGFS_SB_FLAG_SHUTDOWN); mutex_lock(&super->s_journal_mutex); /* Do this first or suffer corruption */ @@ -821,7 +824,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb) area->a_is_open = 0; area->a_used_bytes = 0; /* Write journal */ - logfs_write_anchor(super->s_master_inode); + logfs_write_anchor(sb); /* Write superblocks */ err = logfs_write_sb(sb); BUG_ON(err); |