aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/the_nilfs.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-06-29 01:42:13 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-22 21:02:11 -0400
commit325020477a51ffa849418b3e38189fd266f2ae20 (patch)
treea02d99b61ed3b98fbbd56f857fdd46808326dff7 /fs/nilfs2/the_nilfs.c
parent6c12516083cf51b6e576691ac6e20c4a32f4edb9 (diff)
nilfs2: do not update log cursor for small change
Super blocks of nilfs are periodically overwritten in order to record the recent log position. This shortens recovery time after unclean unmount, but the current implementation performs the update even for a few blocks of change. If the filesystem gets small changes slowly and continually, super blocks may be updated excessively. This moderates the issue by skipping update of log cursor if it does not cross a segment boundary. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r--fs/nilfs2/the_nilfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 88c8976c55a9..f2efc8c5be7f 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -47,6 +47,16 @@ void nilfs_set_last_segment(struct the_nilfs *nilfs,
47 nilfs->ns_last_pseg = start_blocknr; 47 nilfs->ns_last_pseg = start_blocknr;
48 nilfs->ns_last_seq = seq; 48 nilfs->ns_last_seq = seq;
49 nilfs->ns_last_cno = cno; 49 nilfs->ns_last_cno = cno;
50
51 if (!nilfs_sb_dirty(nilfs)) {
52 if (nilfs->ns_prev_seq == nilfs->ns_last_seq)
53 goto stay_cursor;
54
55 set_nilfs_sb_dirty(nilfs);
56 }
57 nilfs->ns_prev_seq = nilfs->ns_last_seq;
58
59 stay_cursor:
50 spin_unlock(&nilfs->ns_last_segment_lock); 60 spin_unlock(&nilfs->ns_last_segment_lock);
51} 61}
52 62
@@ -267,6 +277,7 @@ static int nilfs_store_log_cursor(struct the_nilfs *nilfs,
267 nilfs->ns_last_cno = le64_to_cpu(sbp->s_last_cno); 277 nilfs->ns_last_cno = le64_to_cpu(sbp->s_last_cno);
268 nilfs->ns_last_seq = le64_to_cpu(sbp->s_last_seq); 278 nilfs->ns_last_seq = le64_to_cpu(sbp->s_last_seq);
269 279
280 nilfs->ns_prev_seq = nilfs->ns_last_seq;
270 nilfs->ns_seg_seq = nilfs->ns_last_seq; 281 nilfs->ns_seg_seq = nilfs->ns_last_seq;
271 nilfs->ns_segnum = 282 nilfs->ns_segnum =
272 nilfs_get_segnum_of_block(nilfs, nilfs->ns_last_pseg); 283 nilfs_get_segnum_of_block(nilfs, nilfs->ns_last_pseg);