[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.
This commit is contained in:
Joern Engel
2010-03-04 21:36:19 +01:00
parent 9421502b4f
commit c6d3830140
6 changed files with 19 additions and 13 deletions

View File

@@ -469,7 +469,7 @@ static void __logfs_gc_pass(struct super_block *sb, int target)
/* Sync in-memory state with on-medium state in case they
* diverged */
logfs_write_anchor(super->s_master_inode);
logfs_write_anchor(sb);
round += logfs_scan_some(sb);
if (no_free_segments(sb) >= target)
goto write_alias;
@@ -613,8 +613,8 @@ void logfs_gc_pass(struct super_block *sb)
*/
if (super->s_dirty_used_bytes + super->s_dirty_free_bytes
+ LOGFS_MAX_OBJECTSIZE >= super->s_free_bytes)
logfs_write_anchor(super->s_master_inode);
__logfs_gc_pass(sb, logfs_super(sb)->s_total_levels);
logfs_write_anchor(sb);
__logfs_gc_pass(sb, super->s_total_levels);
logfs_wl_pass(sb);
logfs_journal_wl_pass(sb);
}