From c6d3830140f1d56b07d8ab56a6e14ca3c492a39a Mon Sep 17 00:00:00 2001 From: Joern Engel Date: Thu, 4 Mar 2010 21:36:19 +0100 Subject: [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. --- fs/logfs/segment.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fs/logfs/segment.c') diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c index 664cd0dd3576..1a14f9910d55 100644 --- a/fs/logfs/segment.c +++ b/fs/logfs/segment.c @@ -352,7 +352,8 @@ int logfs_segment_write(struct inode *inode, struct page *page, int ret; void *buf; - BUG_ON(logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN); + super->s_flags |= LOGFS_SB_FLAG_DIRTY; + BUG_ON(super->s_flags & LOGFS_SB_FLAG_SHUTDOWN); do_compress = logfs_inode(inode)->li_flags & LOGFS_IF_COMPRESSED; if (shadow->gc_level != 0) { /* temporarily disable compression for indirect blocks */ @@ -653,11 +654,13 @@ int logfs_segment_read(struct inode *inode, struct page *page, int logfs_segment_delete(struct inode *inode, struct logfs_shadow *shadow) { struct super_block *sb = inode->i_sb; + struct logfs_super *super = logfs_super(sb); struct logfs_object_header h; u16 len; int err; - BUG_ON(logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN); + super->s_flags |= LOGFS_SB_FLAG_DIRTY; + BUG_ON(super->s_flags & LOGFS_SB_FLAG_SHUTDOWN); BUG_ON(shadow->old_ofs & LOGFS_FULLY_POPULATED); if (!shadow->old_ofs) return 0; -- cgit v1.2.3-70-g09d2