diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 07a7ae0d4413845e947cc3c51f17907d1b71e5aa..b69f190fb19592481239a0e4b6f71c2c039748ee 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1118,8 +1118,8 @@ int npages_for_summary_flush(struct f2fs_sb_info *); void allocate_new_segments(struct f2fs_sb_info *); struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); void write_meta_page(struct f2fs_sb_info *, struct page *); -void write_node_page(struct f2fs_sb_info *, struct page *, unsigned int, - block_t, block_t *); +void write_node_page(struct f2fs_sb_info *, struct page *, + struct f2fs_io_info *, unsigned int, block_t, block_t *); void write_data_page(struct page *, struct dnode_of_data *, block_t *, struct f2fs_io_info *); void rewrite_data_page(struct page *, block_t, struct f2fs_io_info *); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c77ad4d8b564fe412c2e38fe2f9f9f122bd71eec..14511b00fffa1aa5760f9e3c7133b7a675a3a6c7 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -115,7 +115,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) int ret = 0; bool need_cp = false; struct writeback_control wbc = { - .sync_mode = WB_SYNC_ALL, + .sync_mode = WB_SYNC_NONE, .nr_to_write = LONG_MAX, .for_reclaim = 0, }; diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 0230326be4953a1480e05c44bb795b5ea3af8fe3..b8c9301db52ce66977644e4cbd54ed52cba582c5 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1194,6 +1194,10 @@ static int f2fs_write_node_page(struct page *page, nid_t nid; block_t new_addr; struct node_info ni; + struct f2fs_io_info fio = { + .type = NODE, + .rw = (wbc->sync_mode == WB_SYNC_ALL) ? WRITE_SYNC: WRITE, + }; if (unlikely(sbi->por_doing)) goto redirty_out; @@ -1218,7 +1222,7 @@ static int f2fs_write_node_page(struct page *page, mutex_lock(&sbi->node_write); set_page_writeback(page); - write_node_page(sbi, page, nid, ni.blk_addr, &new_addr); + write_node_page(sbi, page, &fio, nid, ni.blk_addr, &new_addr); set_node_addr(sbi, &ni, new_addr); dec_page_count(sbi, F2FS_DIRTY_NODES); mutex_unlock(&sbi->node_write); @@ -1253,6 +1257,7 @@ static int f2fs_write_node_pages(struct address_space *mapping, /* if mounting is failed, skip writing node pages */ wbc->nr_to_write = 3 * max_hw_blocks(sbi); + wbc->sync_mode = WB_SYNC_NONE; sync_node_pages(sbi, 0, wbc); wbc->nr_to_write = nr_to_write - (3 * max_hw_blocks(sbi) - wbc->nr_to_write); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 555ae7693ea090d6e09c9ba42487c1975ebc2ffe..5f84639354e3adaa17209aa4daebbc5ee785c009 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -924,16 +924,12 @@ void write_meta_page(struct f2fs_sb_info *sbi, struct page *page) } void write_node_page(struct f2fs_sb_info *sbi, struct page *page, + struct f2fs_io_info *fio, unsigned int nid, block_t old_blkaddr, block_t *new_blkaddr) { struct f2fs_summary sum; - struct f2fs_io_info fio = { - .type = NODE, - .rw = WRITE_SYNC, - }; - set_summary(&sum, nid, 0, 0); - do_write_page(sbi, page, old_blkaddr, new_blkaddr, &sum, &fio); + do_write_page(sbi, page, old_blkaddr, new_blkaddr, &sum, fio); } void write_data_page(struct page *page, struct dnode_of_data *dn,