aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2013-06-17 14:45:50 +0900
committerDaniel Phillips <daniel@tux3.org>2013-06-17 14:45:50 +0900
commit6d297edba68d8683c153f1ffaa461f6ee7833f07 (patch)
tree20f529dbd4331a01d7c162bfa6c340e1c8bdd568
parent944c2a913102b39ced8229ecd617c28d0c7e37ca (diff)
downloadlinux-tux3-6d297edba68d8683c153f1ffaa461f6ee7833f07.tar.gz
tux3: Check I_DIRTY for tux3_flush_inode_internal() to avoid locking
tux3_flush_inode_internal() is called always to force order to flush. But, if internal inode is not dirty, some locks are just overhead. So, this checks dirty flags roughly before checking the detail. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/commit.c7
-rw-r--r--fs/tux3/writeback.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/fs/tux3/commit.c b/fs/tux3/commit.c
index 4a8c73cd856342..3b7cf4a20c5481 100644
--- a/fs/tux3/commit.c
+++ b/fs/tux3/commit.c
@@ -241,6 +241,13 @@ static int rollup_log(struct sb *sb)
*/
list_splice_init(&sb->rollup_buffers,
tux3_dirty_buffers(sb->volmap, TUX3_INIT_DELTA));
+ /*
+ * tux3_mark_buffer_rollup() doesn't dirty inode, so we make
+ * sure volmap is dirty for rollup buffers, now.
+ *
+ * See comment in tux3_mark_buffer_rollup().
+ */
+ __tux3_mark_inode_dirty(sb->volmap, I_DIRTY_PAGES);
/* Flush bitmap */
trace("> flush bitmap %u", rollup);
diff --git a/fs/tux3/writeback.c b/fs/tux3/writeback.c
index 8d9c6702e1f860..1cdb88a6047867 100644
--- a/fs/tux3/writeback.c
+++ b/fs/tux3/writeback.c
@@ -467,6 +467,14 @@ int tux3_flush_inode_internal(struct inode *inode, unsigned delta)
assert(tux3_is_inode_no_flush(inode));
assert(atomic_read(&inode->i_count) >= 1);
+ /*
+ * Check dirty state roughly (possibly false positive. True
+ * dirty state is in tuxnode->flags and per-delta dirty
+ * buffers list) to avoid lock overhead.
+ */
+ if (!(inode->i_state & I_DIRTY))
+ return 0;
+
err = tux3_flush_inode(inode, delta);
/* FIXME: error handling */
__tux3_clear_dirty_inode(inode, delta);