From: k00417925 <k00417...@notesmail.huawei.com>

Description: introduce a new fio cache for IPU sequential
writes. After commit 8648de2c581(f2fs: add bio cache for IPU)
in the mainline, we still have the problem in SQLite. After
discuss the issue with chao, we know there are still some bugs
in global bio cache for IPU. This patch introdce a new fio cache
to fix this bug.

Test case:
fio -filename=/data/1.txt -direct=0 -ioengine=psync -fdatasync=1 -rw=write 
-bs=256K -size=256M -numjobs=1 -group_reporting -name=test1

Before:
             fio-2635  [015] ....  2017.735514: block_rq_issue: 7,0 WS 4096 () 
548888 + 8 [fio]
             fio-2635  [015] ....  2017.735515: block_rq_issue: 7,0 WS 4096 () 
548896 + 8 [fio]
             fio-2635  [015] ....  2017.735516: block_rq_issue: 7,0 WS 4096 () 
548904 + 8 [fio]
             fio-2635  [015] ....  2017.735516: block_rq_issue: 7,0 WS 4096 () 
548912 + 8 [fio]
             fio-2635  [015] ....  2017.735517: block_rq_issue: 7,0 WS 4096 () 
548920 + 8 [fio]
             fio-2635  [015] ....  2017.735517: block_rq_issue: 7,0 WS 4096 () 
548928 + 8 [fio]
             fio-2635  [015] ....  2017.735518: block_rq_issue: 7,0 WS 4096 () 
548936 + 8 [fio]
             fio-2635  [015] ....  2017.735518: block_rq_issue: 7,0 WS 4096 () 
548944 + 8 [fio]
             fio-2635  [015] ....  2017.735519: block_rq_issue: 7,0 WS 4096 () 
548952 + 8 [fio]
             fio-2635  [015] ....  2017.735519: block_rq_issue: 7,0 WS 4096 () 
548960 + 8 [fio]
             fio-2635  [015] ....  2017.735520: block_rq_issue: 7,0 WS 4096 () 
548968 + 8 [fio]
             fio-2635  [015] ....  2017.735520: block_rq_issue: 7,0 WS 4096 () 
548976 + 8 [fio]
             fio-2635  [015] ....  2017.735521: block_rq_issue: 7,0 WS 4096 () 
548984 + 8 [fio]
After:
             fio-14692 [003] ....  1473.946721: block_rq_issue: 7,0 WS 262144 
() 195072 + 512 [fio]
             fio-14692 [003] ....  1473.947722: block_rq_issue: 7,0 WS 262144 
() 195584 + 512 [fio]
             fio-14692 [003] ....  1473.948716: block_rq_issue: 7,0 WS 262144 
() 196096 + 512 [fio]
             fio-14692 [003] ....  1473.949711: block_rq_issue: 7,0 WS 262144 
() 196608 + 512 [fio]
             fio-14692 [003] ....  1473.950704: block_rq_issue: 7,0 WS 262144 
() 197120 + 512 [fio]
             fio-14692 [003] ....  1473.951700: block_rq_issue: 7,0 WS 262144 
() 197632 + 512 [fio]
             fio-14692 [003] ....  1473.952687: block_rq_issue: 7,0 WS 262144 
() 198144 + 512 [fio]
             fio-14692 [003] ....  1473.953684: block_rq_issue: 7,0 WS 262144 
() 198656 + 512 [fio]
             fio-14692 [003] ....  1473.954683: block_rq_issue: 7,0 WS 262144 
() 199168 + 512 [fio]
             fio-14692 [003] ....  1473.955686: block_rq_issue: 7,0 WS 262144 
() 199680 + 512 [fio]
             fio-14692 [003] ....  1473.956732: block_rq_issue: 7,0 WS 262144 
() 200192 + 512 [fio]
             fio-14692 [003] ....  1473.957749: block_rq_issue: 7,0 WS 262144 
() 200704 + 512 [fio]
             fio-14692 [003] ....  1473.958741: block_rq_issue: 7,0 WS 262144 
() 201216 + 512 [fio]

Signed-off-by: koulihong <koulih...@huawei.com>
---
 fs/f2fs/checkpoint.c |  1 +
 fs/f2fs/data.c       |  5 +++++
 fs/f2fs/f2fs.h       |  1 +
 fs/f2fs/segment.c    | 19 +++++++++++--------
 fs/f2fs/super.c      |  2 ++
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index a0eef95..78d5db0 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1081,6 +1081,7 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum 
inode_type type)
                 * wribacking dentry pages in the freeing inode.
                 */
                f2fs_submit_merged_write(sbi, DATA);
+               f2fs_submit_merged_write(sbi, DATA_IPU);
                cond_resched();
        }
        goto retry;
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5af9810..16fdab2 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -440,6 +440,7 @@ void f2fs_flush_merged_writes(struct f2fs_sb_info *sbi)
        f2fs_submit_merged_write(sbi, DATA);
        f2fs_submit_merged_write(sbi, NODE);
        f2fs_submit_merged_write(sbi, META);
+       f2fs_submit_merged_write(sbi, DATA_IPU);
 }
 
 /*
@@ -2065,6 +2066,7 @@ static int __write_data_page(struct page *page, bool 
*submitted,
 
        if (wbc->for_reclaim) {
                f2fs_submit_merged_write_cond(sbi, NULL, page, 0, DATA);
+               f2fs_submit_merged_write_cond(sbi, NULL, page, 0, DATA_IPU);
                clear_inode_flag(inode, FI_HOT_DATA);
                f2fs_remove_dirty_inode(inode);
                submitted = NULL;
@@ -2077,6 +2079,7 @@ static int __write_data_page(struct page *page, bool 
*submitted,
 
        if (unlikely(f2fs_cp_error(sbi))) {
                f2fs_submit_merged_write(sbi, DATA);
+               f2fs_submit_merged_write(sbi, DATA_IPU);
                submitted = NULL;
        }
 
@@ -2253,6 +2256,8 @@ static int f2fs_write_cache_pages(struct address_space 
*mapping,
        if (nwritten)
                f2fs_submit_merged_write_cond(F2FS_M_SB(mapping), mapping->host,
                                                                NULL, 0, DATA);
+               f2fs_submit_merged_write_cond(F2FS_M_SB(mapping), mapping->host,
+                                                               NULL, 0, 
DATA_IPU);
 
        return ret;
 }
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index f1cf2843..79bf996 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -983,6 +983,7 @@ enum count_type {
 enum page_type {
        DATA,
        NODE,
+       DATA_IPU,
        META,
        NR_PAGE_TYPE,
        META_FLUSH,
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 380e0ab..9c67b55 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -430,8 +430,10 @@ static int __f2fs_commit_inmem_pages(struct inode *inode)
                list_move_tail(&cur->list, &revoke_list);
        }
 
-       if (submit_bio)
+       if (submit_bio) {
                f2fs_submit_merged_write_cond(sbi, inode, NULL, 0, DATA);
+               f2fs_submit_merged_write_cond(sbi, inode, NULL, 0, DATA_IPU);
+       }
 
        if (err) {
                /*
@@ -3234,7 +3236,6 @@ void f2fs_outplace_write_data(struct dnode_of_data *dn,
 
 int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 {
-       int err;
        struct f2fs_sb_info *sbi = fio->sbi;
        unsigned int segno;
 
@@ -3253,13 +3254,12 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 
        stat_inc_inplace_blocks(fio->sbi);
 
-       err = f2fs_submit_page_bio(fio);
-       if (!err) {
-               update_device_state(fio);
-               f2fs_update_iostat(fio->sbi, fio->io_type, F2FS_BLKSIZE);
-       }
+       fio->type = DATA_IPU;
+       f2fs_submit_page_write(fio);
+       update_device_state(fio);
+       f2fs_update_iostat(fio->sbi, fio->io_type, F2FS_BLKSIZE);
 
-       return err;
+       return 0;
 }
 
 static inline int __f2fs_get_curseg(struct f2fs_sb_info *sbi,
@@ -3375,6 +3375,9 @@ void f2fs_wait_on_page_writeback(struct page *page,
                struct f2fs_sb_info *sbi = F2FS_P_SB(page);
 
                f2fs_submit_merged_write_cond(sbi, NULL, page, 0, type);
+               if (type == DATA)
+                       f2fs_submit_merged_write_cond(sbi, NULL, page, 0, 
DATA_IPU);
+
                if (ordered) {
                        wait_on_page_writeback(page);
                        f2fs_bug_on(sbi, locked && PageWriteback(page));
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index d95a681..62e1799 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -899,6 +899,8 @@ static int f2fs_drop_inode(struct inode *inode)
 
                        f2fs_submit_merged_write_cond(F2FS_I_SB(inode),
                                        inode, NULL, 0, DATA);
+                       f2fs_submit_merged_write_cond(F2FS_I_SB(inode),
+                                       inode, NULL, 0, DATA_IPU);
                        truncate_inode_pages_final(inode->i_mapping);
 
                        if (F2FS_HAS_BLOCKS(inode))
-- 
2.7.4



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to