diff options
author | Joern Engel <joern@logfs.org> | 2010-03-04 15:36:19 -0500 |
---|---|---|
committer | Joern Engel <joern@logfs.org> | 2010-03-04 15:36:19 -0500 |
commit | c6d3830140f1d56b07d8ab56a6e14ca3c492a39a (patch) | |
tree | 8dd9923b4217f6f7dc2735356d112fdcfa277852 /fs/logfs/segment.c | |
parent | 9421502b4fc894cc477be8fc49776830e37ca157 (diff) |
[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.c | 7 |
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, | |||
352 | int ret; | 352 | int ret; |
353 | void *buf; | 353 | void *buf; |
354 | 354 | ||
355 | BUG_ON(logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN); | 355 | super->s_flags |= LOGFS_SB_FLAG_DIRTY; |
356 | BUG_ON(super->s_flags & LOGFS_SB_FLAG_SHUTDOWN); | ||
356 | do_compress = logfs_inode(inode)->li_flags & LOGFS_IF_COMPRESSED; | 357 | do_compress = logfs_inode(inode)->li_flags & LOGFS_IF_COMPRESSED; |
357 | if (shadow->gc_level != 0) { | 358 | if (shadow->gc_level != 0) { |
358 | /* temporarily disable compression for indirect blocks */ | 359 | /* temporarily disable compression for indirect blocks */ |
@@ -653,11 +654,13 @@ int logfs_segment_read(struct inode *inode, struct page *page, | |||
653 | int logfs_segment_delete(struct inode *inode, struct logfs_shadow *shadow) | 654 | int logfs_segment_delete(struct inode *inode, struct logfs_shadow *shadow) |
654 | { | 655 | { |
655 | struct super_block *sb = inode->i_sb; | 656 | struct super_block *sb = inode->i_sb; |
657 | struct logfs_super *super = logfs_super(sb); | ||
656 | struct logfs_object_header h; | 658 | struct logfs_object_header h; |
657 | u16 len; | 659 | u16 len; |
658 | int err; | 660 | int err; |
659 | 661 | ||
660 | BUG_ON(logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN); | 662 | super->s_flags |= LOGFS_SB_FLAG_DIRTY; |
663 | BUG_ON(super->s_flags & LOGFS_SB_FLAG_SHUTDOWN); | ||
661 | BUG_ON(shadow->old_ofs & LOGFS_FULLY_POPULATED); | 664 | BUG_ON(shadow->old_ofs & LOGFS_FULLY_POPULATED); |
662 | if (!shadow->old_ofs) | 665 | if (!shadow->old_ofs) |
663 | return 0; | 666 | return 0; |