diff options
-rw-r--r-- | fs/nilfs2/segment.c | 1 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 11 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.h | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 04e04854a311..9fd051a33c4f 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1951,7 +1951,6 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
1951 | if (update_sr) { | 1951 | if (update_sr) { |
1952 | nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, | 1952 | nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, |
1953 | segbuf->sb_sum.seg_seq, nilfs->ns_cno++); | 1953 | segbuf->sb_sum.seg_seq, nilfs->ns_cno++); |
1954 | set_nilfs_sb_dirty(nilfs); | ||
1955 | 1954 | ||
1956 | clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); | 1955 | clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); |
1957 | clear_bit(NILFS_SC_DIRTY, &sci->sc_flags); | 1956 | clear_bit(NILFS_SC_DIRTY, &sci->sc_flags); |
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); |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index 32b4983b7458..f785a7b0ab99 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -74,6 +74,7 @@ enum { | |||
74 | * @ns_last_seq: sequence value of the latest segment | 74 | * @ns_last_seq: sequence value of the latest segment |
75 | * @ns_last_cno: checkpoint number of the latest segment | 75 | * @ns_last_cno: checkpoint number of the latest segment |
76 | * @ns_prot_seq: least sequence number of segments which must not be reclaimed | 76 | * @ns_prot_seq: least sequence number of segments which must not be reclaimed |
77 | * @ns_prev_seq: base sequence number used to decide if advance log cursor | ||
77 | * @ns_segctor_sem: segment constructor semaphore | 78 | * @ns_segctor_sem: segment constructor semaphore |
78 | * @ns_dat: DAT file inode | 79 | * @ns_dat: DAT file inode |
79 | * @ns_cpfile: checkpoint file inode | 80 | * @ns_cpfile: checkpoint file inode |
@@ -151,6 +152,7 @@ struct the_nilfs { | |||
151 | u64 ns_last_seq; | 152 | u64 ns_last_seq; |
152 | __u64 ns_last_cno; | 153 | __u64 ns_last_cno; |
153 | u64 ns_prot_seq; | 154 | u64 ns_prot_seq; |
155 | u64 ns_prev_seq; | ||
154 | 156 | ||
155 | struct rw_semaphore ns_segctor_sem; | 157 | struct rw_semaphore ns_segctor_sem; |
156 | 158 | ||