summaryrefslogtreecommitdiffstats
path: root/fs/logfs/segment.c
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-03-04 21:36:19 +0100
committerJoern Engel <joern@logfs.org>2010-03-04 21:36:19 +0100
commitc6d3830140f1d56b07d8ab56a6e14ca3c492a39a (patch)
tree8dd9923b4217f6f7dc2735356d112fdcfa277852 /fs/logfs/segment.c
parent9421502b4fc894cc477be8fc49776830e37ca157 (diff)
downloadlinux-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/segment.c')
-rw-r--r--fs/logfs/segment.c7
1 files changed, 5 insertions, 2 deletions
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;