diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-12-08 10:57:52 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-02-12 22:26:03 -0500 |
commit | e605f0a7249d8002c660af379f884896cbaa45ae (patch) | |
tree | 8daadf8848cd8f6c7817c399e568a2fcecdf0255 /fs | |
parent | dcd76186955e2b595c378dbe5b9bb6c8c5374b10 (diff) |
nilfs2: get rid of s_dirt flag use
This replaces s_dirt flag use in nilfs with a new flag added on the
nilfs object. The s_dirt flag was used to indicate if
sop->write_super() should be called, however the current version of
nilfs does not use the callback. Thus, it can be replaced with the
own flag.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Jiro SEKIBA <jir@unicus.jp>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/segment.c | 11 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 4 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.h | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index fa4abfc22d33..c4fcdd1567a9 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1937,8 +1937,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
1937 | { | 1937 | { |
1938 | struct nilfs_segment_buffer *segbuf; | 1938 | struct nilfs_segment_buffer *segbuf; |
1939 | struct page *bd_page = NULL, *fs_page = NULL; | 1939 | struct page *bd_page = NULL, *fs_page = NULL; |
1940 | struct nilfs_sb_info *sbi = sci->sc_sbi; | 1940 | struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs; |
1941 | struct the_nilfs *nilfs = sbi->s_nilfs; | ||
1942 | int update_sr = (sci->sc_super_root != NULL); | 1941 | int update_sr = (sci->sc_super_root != NULL); |
1943 | 1942 | ||
1944 | list_for_each_entry(segbuf, &sci->sc_write_logs, sb_list) { | 1943 | list_for_each_entry(segbuf, &sci->sc_write_logs, sb_list) { |
@@ -2020,7 +2019,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
2020 | if (update_sr) { | 2019 | if (update_sr) { |
2021 | nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, | 2020 | nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, |
2022 | segbuf->sb_sum.seg_seq, nilfs->ns_cno++); | 2021 | segbuf->sb_sum.seg_seq, nilfs->ns_cno++); |
2023 | sbi->s_super->s_dirt = 1; | 2022 | set_nilfs_sb_dirty(nilfs); |
2024 | 2023 | ||
2025 | clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); | 2024 | clear_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); |
2026 | clear_bit(NILFS_SC_DIRTY, &sci->sc_flags); | 2025 | clear_bit(NILFS_SC_DIRTY, &sci->sc_flags); |
@@ -2645,6 +2644,7 @@ static int nilfs_segctor_flush_mode(struct nilfs_sc_info *sci) | |||
2645 | static int nilfs_segctor_thread(void *arg) | 2644 | static int nilfs_segctor_thread(void *arg) |
2646 | { | 2645 | { |
2647 | struct nilfs_sc_info *sci = (struct nilfs_sc_info *)arg; | 2646 | struct nilfs_sc_info *sci = (struct nilfs_sc_info *)arg; |
2647 | struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs; | ||
2648 | struct timer_list timer; | 2648 | struct timer_list timer; |
2649 | int timeout = 0; | 2649 | int timeout = 0; |
2650 | 2650 | ||
@@ -2690,7 +2690,6 @@ static int nilfs_segctor_thread(void *arg) | |||
2690 | } else { | 2690 | } else { |
2691 | DEFINE_WAIT(wait); | 2691 | DEFINE_WAIT(wait); |
2692 | int should_sleep = 1; | 2692 | int should_sleep = 1; |
2693 | struct the_nilfs *nilfs; | ||
2694 | 2693 | ||
2695 | prepare_to_wait(&sci->sc_wait_daemon, &wait, | 2694 | prepare_to_wait(&sci->sc_wait_daemon, &wait, |
2696 | TASK_INTERRUPTIBLE); | 2695 | TASK_INTERRUPTIBLE); |
@@ -2711,8 +2710,8 @@ static int nilfs_segctor_thread(void *arg) | |||
2711 | finish_wait(&sci->sc_wait_daemon, &wait); | 2710 | finish_wait(&sci->sc_wait_daemon, &wait); |
2712 | timeout = ((sci->sc_state & NILFS_SEGCTOR_COMMIT) && | 2711 | timeout = ((sci->sc_state & NILFS_SEGCTOR_COMMIT) && |
2713 | time_after_eq(jiffies, sci->sc_timer->expires)); | 2712 | time_after_eq(jiffies, sci->sc_timer->expires)); |
2714 | nilfs = sci->sc_sbi->s_nilfs; | 2713 | |
2715 | if (sci->sc_super->s_dirt && nilfs_sb_need_update(nilfs)) | 2714 | if (nilfs_sb_dirty(nilfs) && nilfs_sb_need_update(nilfs)) |
2716 | set_nilfs_discontinued(nilfs); | 2715 | set_nilfs_discontinued(nilfs); |
2717 | } | 2716 | } |
2718 | goto loop; | 2717 | goto loop; |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index f068270f6c75..92579cc4c935 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -298,7 +298,7 @@ int nilfs_commit_super(struct nilfs_sb_info *sbi, int dupsb) | |||
298 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | 298 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); |
299 | nilfs->ns_sbwtime[1] = t; | 299 | nilfs->ns_sbwtime[1] = t; |
300 | } | 300 | } |
301 | sbi->s_super->s_dirt = 0; | 301 | clear_nilfs_sb_dirty(nilfs); |
302 | return nilfs_sync_super(sbi, dupsb); | 302 | return nilfs_sync_super(sbi, dupsb); |
303 | } | 303 | } |
304 | 304 | ||
@@ -342,7 +342,7 @@ static int nilfs_sync_fs(struct super_block *sb, int wait) | |||
342 | err = nilfs_construct_segment(sb); | 342 | err = nilfs_construct_segment(sb); |
343 | 343 | ||
344 | down_write(&nilfs->ns_sem); | 344 | down_write(&nilfs->ns_sem); |
345 | if (sb->s_dirt) | 345 | if (nilfs_sb_dirty(nilfs)) |
346 | nilfs_commit_super(sbi, 1); | 346 | nilfs_commit_super(sbi, 1); |
347 | up_write(&nilfs->ns_sem); | 347 | up_write(&nilfs->ns_sem); |
348 | 348 | ||
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index fd057f8ad439..e9795f1724d7 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -38,6 +38,7 @@ enum { | |||
38 | the latest checkpoint was loaded */ | 38 | the latest checkpoint was loaded */ |
39 | THE_NILFS_DISCONTINUED, /* 'next' pointer chain has broken */ | 39 | THE_NILFS_DISCONTINUED, /* 'next' pointer chain has broken */ |
40 | THE_NILFS_GC_RUNNING, /* gc process is running */ | 40 | THE_NILFS_GC_RUNNING, /* gc process is running */ |
41 | THE_NILFS_SB_DIRTY, /* super block is dirty */ | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | /** | 44 | /** |
@@ -197,6 +198,7 @@ THE_NILFS_FNS(INIT, init) | |||
197 | THE_NILFS_FNS(LOADED, loaded) | 198 | THE_NILFS_FNS(LOADED, loaded) |
198 | THE_NILFS_FNS(DISCONTINUED, discontinued) | 199 | THE_NILFS_FNS(DISCONTINUED, discontinued) |
199 | THE_NILFS_FNS(GC_RUNNING, gc_running) | 200 | THE_NILFS_FNS(GC_RUNNING, gc_running) |
201 | THE_NILFS_FNS(SB_DIRTY, sb_dirty) | ||
200 | 202 | ||
201 | /* Minimum interval of periodical update of superblocks (in seconds) */ | 203 | /* Minimum interval of periodical update of superblocks (in seconds) */ |
202 | #define NILFS_SB_FREQ 10 | 204 | #define NILFS_SB_FREQ 10 |