f2fs: introduce f2fs_flush_merged_bios for cleanup
authorChao Yu <chao2.yu@samsung.com>
Wed, 24 Feb 2016 09:17:55 +0000 (17:17 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 26 Feb 2016 19:52:02 +0000 (11:52 -0800)
Add a new helper f2fs_flush_merged_bios to clean up redundant codes.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/super.c

index b32ecc9542290c24875b48fd16d33d1b39897790..4933b82feeddbe241651e0e9e1260b037a790564 100644 (file)
@@ -1141,9 +1141,7 @@ int write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
        trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish block_ops");
 
-       f2fs_submit_merged_bio(sbi, DATA, WRITE);
-       f2fs_submit_merged_bio(sbi, NODE, WRITE);
-       f2fs_submit_merged_bio(sbi, META, WRITE);
+       f2fs_flush_merged_bios(sbi);
 
        /*
         * update checkpoint pack index
index cc5ce9f5ad80fe2889dd734898af6f32089b10dc..9643d88a01af8ed1897821e3d0baeb7be327413a 100644 (file)
@@ -206,6 +206,13 @@ void f2fs_submit_merged_bio_cond(struct f2fs_sb_info *sbi,
                __f2fs_submit_merged_bio(sbi, inode, page, ino, type, rw);
 }
 
+void f2fs_flush_merged_bios(struct f2fs_sb_info *sbi)
+{
+       f2fs_submit_merged_bio(sbi, DATA, WRITE);
+       f2fs_submit_merged_bio(sbi, NODE, WRITE);
+       f2fs_submit_merged_bio(sbi, META, WRITE);
+}
+
 /*
  * Fill the locked page with data located in the block address.
  * Return unlocked page.
index 684c1e6f375c7656b39148ff4972f2895bdc1a76..e43ab17f42ab72db849aaf2b9ebecc6bf2b0d747 100644 (file)
@@ -1907,6 +1907,7 @@ void destroy_checkpoint_caches(void);
 void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int);
 void f2fs_submit_merged_bio_cond(struct f2fs_sb_info *, struct inode *,
                                struct page *, nid_t, enum page_type, int);
+void f2fs_flush_merged_bios(struct f2fs_sb_info *);
 int f2fs_submit_page_bio(struct f2fs_io_info *);
 void f2fs_submit_page_mbio(struct f2fs_io_info *);
 void set_data_blkaddr(struct dnode_of_data *);
index 2a5fc08b4ec7c2e7d4d6a815b4339631a500e847..579372d9291f1b9b2a35de65771e1f91ecc13b2d 100644 (file)
@@ -583,11 +583,8 @@ static void f2fs_put_super(struct super_block *sb)
        mutex_unlock(&sbi->umount_mutex);
 
        /* our cp_error case, we can wait for any writeback page */
-       if (get_pages(sbi, F2FS_WRITEBACK)) {
-               f2fs_submit_merged_bio(sbi, DATA, WRITE);
-               f2fs_submit_merged_bio(sbi, NODE, WRITE);
-               f2fs_submit_merged_bio(sbi, META, WRITE);
-       }
+       if (get_pages(sbi, F2FS_WRITEBACK))
+               f2fs_flush_merged_bios(sbi);
 
        iput(sbi->node_inode);
        iput(sbi->meta_inode);