diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-12 12:25:41 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:48 -0500 |
commit | fd66c0d5c377ee8146909d0eb9258539e4b0f293 (patch) | |
tree | 7fefab4c3108aff9d18943a17cd3522a53bdc3bd | |
parent | 3961f0e2775f84a8f81b0dcddb0b356ebfe0696b (diff) |
nilfs2: hide nilfs_mdt_clear calls in nilfs_mdt_destroy
This will hide a function call of nilfs_mdt_clear() in
nilfs_mdt_destroy().
This ensures nilfs_mdt_destroy() to do cleanup jobs included in
nilfs_mdt_clear().
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
-rw-r--r-- | fs/nilfs2/gcinode.c | 1 | ||||
-rw-r--r-- | fs/nilfs2/mdt.c | 7 | ||||
-rw-r--r-- | fs/nilfs2/mdt.h | 1 | ||||
-rw-r--r-- | fs/nilfs2/recovery.c | 6 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 1 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 4 |
6 files changed, 5 insertions, 15 deletions
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c index 32b04da03829..67d2099475b2 100644 --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c | |||
@@ -266,7 +266,6 @@ struct inode *nilfs_gc_iget(struct the_nilfs *nilfs, ino_t ino, __u64 cno) | |||
266 | */ | 266 | */ |
267 | void nilfs_clear_gcinode(struct inode *inode) | 267 | void nilfs_clear_gcinode(struct inode *inode) |
268 | { | 268 | { |
269 | nilfs_mdt_clear(inode); | ||
270 | nilfs_mdt_destroy(inode); | 269 | nilfs_mdt_destroy(inode); |
271 | } | 270 | } |
272 | 271 | ||
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 62074e8d25cb..3028e8f31be2 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -553,14 +553,15 @@ void nilfs_mdt_set_shadow(struct inode *orig, struct inode *shadow) | |||
553 | &NILFS_I(orig)->i_btnode_cache; | 553 | &NILFS_I(orig)->i_btnode_cache; |
554 | } | 554 | } |
555 | 555 | ||
556 | void nilfs_mdt_clear(struct inode *inode) | 556 | static void nilfs_mdt_clear(struct inode *inode) |
557 | { | 557 | { |
558 | struct nilfs_inode_info *ii = NILFS_I(inode); | 558 | struct nilfs_inode_info *ii = NILFS_I(inode); |
559 | 559 | ||
560 | invalidate_mapping_pages(inode->i_mapping, 0, -1); | 560 | invalidate_mapping_pages(inode->i_mapping, 0, -1); |
561 | truncate_inode_pages(inode->i_mapping, 0); | 561 | truncate_inode_pages(inode->i_mapping, 0); |
562 | 562 | ||
563 | nilfs_bmap_clear(ii->i_bmap); | 563 | if (test_bit(NILFS_I_BMAP, &ii->i_state)) |
564 | nilfs_bmap_clear(ii->i_bmap); | ||
564 | nilfs_btnode_cache_clear(&ii->i_btnode_cache); | 565 | nilfs_btnode_cache_clear(&ii->i_btnode_cache); |
565 | } | 566 | } |
566 | 567 | ||
@@ -568,6 +569,8 @@ void nilfs_mdt_destroy(struct inode *inode) | |||
568 | { | 569 | { |
569 | struct nilfs_mdt_info *mdi = NILFS_MDT(inode); | 570 | struct nilfs_mdt_info *mdi = NILFS_MDT(inode); |
570 | 571 | ||
572 | nilfs_mdt_clear(inode); | ||
573 | |||
571 | kfree(mdi->mi_bgl); /* kfree(NULL) is safe */ | 574 | kfree(mdi->mi_bgl); /* kfree(NULL) is safe */ |
572 | kfree(mdi); | 575 | kfree(mdi); |
573 | nilfs_destroy_inode(inode); | 576 | nilfs_destroy_inode(inode); |
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h index cd2903af3c30..c396b6c03931 100644 --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h | |||
@@ -79,7 +79,6 @@ struct inode *nilfs_mdt_new(struct the_nilfs *, struct super_block *, ino_t, | |||
79 | struct inode *nilfs_mdt_new_common(struct the_nilfs *, struct super_block *, | 79 | struct inode *nilfs_mdt_new_common(struct the_nilfs *, struct super_block *, |
80 | ino_t, gfp_t, size_t); | 80 | ino_t, gfp_t, size_t); |
81 | void nilfs_mdt_destroy(struct inode *); | 81 | void nilfs_mdt_destroy(struct inode *); |
82 | void nilfs_mdt_clear(struct inode *); | ||
83 | void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned); | 82 | void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned); |
84 | void nilfs_mdt_set_shadow(struct inode *, struct inode *); | 83 | void nilfs_mdt_set_shadow(struct inode *, struct inode *); |
85 | 84 | ||
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 6dc83591d118..bcd386d604d7 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
@@ -770,14 +770,8 @@ int nilfs_recover_logical_segments(struct the_nilfs *nilfs, | |||
770 | nilfs_finish_roll_forward(nilfs, sbi, ri); | 770 | nilfs_finish_roll_forward(nilfs, sbi, ri); |
771 | } | 771 | } |
772 | 772 | ||
773 | nilfs_detach_checkpoint(sbi); | ||
774 | return 0; | ||
775 | |||
776 | failed: | 773 | failed: |
777 | nilfs_detach_checkpoint(sbi); | 774 | nilfs_detach_checkpoint(sbi); |
778 | nilfs_mdt_clear(nilfs->ns_cpfile); | ||
779 | nilfs_mdt_clear(nilfs->ns_sufile); | ||
780 | nilfs_mdt_clear(nilfs->ns_dat); | ||
781 | return err; | 775 | return err; |
782 | } | 776 | } |
783 | 777 | ||
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 05ae52a482c6..f52616977ea0 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -407,7 +407,6 @@ void nilfs_detach_checkpoint(struct nilfs_sb_info *sbi) | |||
407 | { | 407 | { |
408 | struct the_nilfs *nilfs = sbi->s_nilfs; | 408 | struct the_nilfs *nilfs = sbi->s_nilfs; |
409 | 409 | ||
410 | nilfs_mdt_clear(sbi->s_ifile); | ||
411 | nilfs_mdt_destroy(sbi->s_ifile); | 410 | nilfs_mdt_destroy(sbi->s_ifile); |
412 | sbi->s_ifile = NULL; | 411 | sbi->s_ifile = NULL; |
413 | down_write(&nilfs->ns_super_sem); | 412 | down_write(&nilfs->ns_super_sem); |
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index bc7760c2a8f2..75095edec2fc 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -146,13 +146,9 @@ void put_nilfs(struct the_nilfs *nilfs) | |||
146 | 146 | ||
147 | might_sleep(); | 147 | might_sleep(); |
148 | if (nilfs_loaded(nilfs)) { | 148 | if (nilfs_loaded(nilfs)) { |
149 | nilfs_mdt_clear(nilfs->ns_sufile); | ||
150 | nilfs_mdt_destroy(nilfs->ns_sufile); | 149 | nilfs_mdt_destroy(nilfs->ns_sufile); |
151 | nilfs_mdt_clear(nilfs->ns_cpfile); | ||
152 | nilfs_mdt_destroy(nilfs->ns_cpfile); | 150 | nilfs_mdt_destroy(nilfs->ns_cpfile); |
153 | nilfs_mdt_clear(nilfs->ns_dat); | ||
154 | nilfs_mdt_destroy(nilfs->ns_dat); | 151 | nilfs_mdt_destroy(nilfs->ns_dat); |
155 | /* XXX: how and when to clear nilfs->ns_gc_dat? */ | ||
156 | nilfs_mdt_destroy(nilfs->ns_gc_dat); | 152 | nilfs_mdt_destroy(nilfs->ns_gc_dat); |
157 | } | 153 | } |
158 | if (nilfs_init(nilfs)) { | 154 | if (nilfs_init(nilfs)) { |