diff options
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r-- | fs/nilfs2/segment.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index c9201649cc49..9fd051a33c4f 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1914,12 +1914,12 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
1914 | } | 1914 | } |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | if (!NILFS_SEG_SIMPLEX(&segbuf->sb_sum)) { | 1917 | if (!nilfs_segbuf_simplex(segbuf)) { |
1918 | if (NILFS_SEG_LOGBGN(&segbuf->sb_sum)) { | 1918 | if (segbuf->sb_sum.flags & NILFS_SS_LOGBGN) { |
1919 | set_bit(NILFS_SC_UNCLOSED, &sci->sc_flags); | 1919 | set_bit(NILFS_SC_UNCLOSED, &sci->sc_flags); |
1920 | sci->sc_lseg_stime = jiffies; | 1920 | sci->sc_lseg_stime = jiffies; |
1921 | } | 1921 | } |
1922 | if (NILFS_SEG_LOGEND(&segbuf->sb_sum)) | 1922 | if (segbuf->sb_sum.flags & NILFS_SS_LOGEND) |
1923 | clear_bit(NILFS_SC_UNCLOSED, &sci->sc_flags); | 1923 | clear_bit(NILFS_SC_UNCLOSED, &sci->sc_flags); |
1924 | } | 1924 | } |
1925 | } | 1925 | } |
@@ -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); |
@@ -2082,7 +2081,7 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode) | |||
2082 | 2081 | ||
2083 | /* Avoid empty segment */ | 2082 | /* Avoid empty segment */ |
2084 | if (sci->sc_stage.scnt == NILFS_ST_DONE && | 2083 | if (sci->sc_stage.scnt == NILFS_ST_DONE && |
2085 | NILFS_SEG_EMPTY(&sci->sc_curseg->sb_sum)) { | 2084 | nilfs_segbuf_empty(sci->sc_curseg)) { |
2086 | nilfs_segctor_abort_construction(sci, nilfs, 1); | 2085 | nilfs_segctor_abort_construction(sci, nilfs, 1); |
2087 | goto out; | 2086 | goto out; |
2088 | } | 2087 | } |
@@ -2408,6 +2407,7 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode) | |||
2408 | { | 2407 | { |
2409 | struct nilfs_sb_info *sbi = sci->sc_sbi; | 2408 | struct nilfs_sb_info *sbi = sci->sc_sbi; |
2410 | struct the_nilfs *nilfs = sbi->s_nilfs; | 2409 | struct the_nilfs *nilfs = sbi->s_nilfs; |
2410 | struct nilfs_super_block **sbp; | ||
2411 | int err = 0; | 2411 | int err = 0; |
2412 | 2412 | ||
2413 | nilfs_segctor_accept(sci); | 2413 | nilfs_segctor_accept(sci); |
@@ -2423,8 +2423,13 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode) | |||
2423 | if (test_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags) && | 2423 | if (test_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags) && |
2424 | nilfs_discontinued(nilfs)) { | 2424 | nilfs_discontinued(nilfs)) { |
2425 | down_write(&nilfs->ns_sem); | 2425 | down_write(&nilfs->ns_sem); |
2426 | err = nilfs_commit_super( | 2426 | err = -EIO; |
2427 | sbi, nilfs_altsb_need_update(nilfs)); | 2427 | sbp = nilfs_prepare_super(sbi, |
2428 | nilfs_sb_will_flip(nilfs)); | ||
2429 | if (likely(sbp)) { | ||
2430 | nilfs_set_log_cursor(sbp[0], nilfs); | ||
2431 | err = nilfs_commit_super(sbi, NILFS_SB_COMMIT); | ||
2432 | } | ||
2428 | up_write(&nilfs->ns_sem); | 2433 | up_write(&nilfs->ns_sem); |
2429 | } | 2434 | } |
2430 | } | 2435 | } |