Message ID | 20230428025646epcms2p35acbea45ee80d36808861edba8a3c84a@epcms2p3 (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v3] f2fs: add async reset zone command support | expand |
Hi Daejun, kernel test robot noticed the following build errors: [auto build test ERROR on jaegeuk-f2fs/dev-test] [also build test ERROR on jaegeuk-f2fs/dev linus/master next-20230427] [cannot apply to v6.3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Daejun-Park/f2fs-add-async-reset-zone-command-support/20230428-105944 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test patch link: https://lore.kernel.org/r/20230428025646epcms2p35acbea45ee80d36808861edba8a3c84a%40epcms2p3 patch subject: [PATCH v3] f2fs: add async reset zone command support config: microblaze-randconfig-r024-20230427 (https://download.01.org/0day-ci/archive/20230428/202304281424.WrTeoZ4B-lkp@intel.com/config) compiler: microblaze-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/2f3e641e3de509a5ed879fb10fdf3377fd9ca0d9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Daejun-Park/f2fs-add-async-reset-zone-command-support/20230428-105944 git checkout 2f3e641e3de509a5ed879fb10fdf3377fd9ca0d9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=microblaze olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=microblaze SHELL=/bin/bash fs/f2fs/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304281424.WrTeoZ4B-lkp@intel.com/ All errors (new ones prefixed by >>): fs/f2fs/segment.c: In function 'f2fs_wait_discard_bio': >> fs/f2fs/segment.c:1789:33: error: implicit declaration of function '__submit_zone_reset_cmd' [-Werror=implicit-function-declaration] 1789 | __submit_zone_reset_cmd(sbi, dc, REQ_SYNC, | ^~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/__submit_zone_reset_cmd +1789 fs/f2fs/segment.c 1775 1776 /* This should be covered by global mutex, &sit_i->sentry_lock */ 1777 static void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr) 1778 { 1779 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; 1780 struct discard_cmd *dc; 1781 bool need_wait = false; 1782 1783 mutex_lock(&dcc->cmd_lock); 1784 dc = __lookup_discard_cmd(sbi, blkaddr); 1785 if (dc) { 1786 if (f2fs_sb_has_blkzoned(sbi) && bdev_is_zoned(dc->bdev)) { 1787 /* force submit zone reset */ 1788 if (dc->state == D_PREP) > 1789 __submit_zone_reset_cmd(sbi, dc, REQ_SYNC, 1790 &dcc->wait_list, NULL); 1791 dc->ref++; 1792 need_wait = true; 1793 } else { 1794 if (dc->state == D_PREP) { 1795 __punch_discard_cmd(sbi, dc, blkaddr); 1796 } else { 1797 dc->ref++; 1798 need_wait = true; 1799 } 1800 } 1801 } 1802 mutex_unlock(&dcc->cmd_lock); 1803 1804 if (need_wait) 1805 __wait_one_discard_bio(sbi, dc); 1806 } 1807
Hi Daejun, kernel test robot noticed the following build errors: [auto build test ERROR on jaegeuk-f2fs/dev-test] [also build test ERROR on jaegeuk-f2fs/dev linus/master next-20230427] [cannot apply to v6.3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Daejun-Park/f2fs-add-async-reset-zone-command-support/20230428-105944 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test patch link: https://lore.kernel.org/r/20230428025646epcms2p35acbea45ee80d36808861edba8a3c84a%40epcms2p3 patch subject: [PATCH v3] f2fs: add async reset zone command support config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20230428/202304282103.nYW33DnO-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/2f3e641e3de509a5ed879fb10fdf3377fd9ca0d9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Daejun-Park/f2fs-add-async-reset-zone-command-support/20230428-105944 git checkout 2f3e641e3de509a5ed879fb10fdf3377fd9ca0d9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/f2fs/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304282103.nYW33DnO-lkp@intel.com/ All errors (new ones prefixed by >>): >> fs/f2fs/segment.c:1789:5: error: implicit declaration of function '__submit_zone_reset_cmd' is invalid in C99 [-Werror,-Wimplicit-function-declaration] __submit_zone_reset_cmd(sbi, dc, REQ_SYNC, ^ 1 error generated. vim +/__submit_zone_reset_cmd +1789 fs/f2fs/segment.c 1775 1776 /* This should be covered by global mutex, &sit_i->sentry_lock */ 1777 static void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr) 1778 { 1779 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; 1780 struct discard_cmd *dc; 1781 bool need_wait = false; 1782 1783 mutex_lock(&dcc->cmd_lock); 1784 dc = __lookup_discard_cmd(sbi, blkaddr); 1785 if (dc) { 1786 if (f2fs_sb_has_blkzoned(sbi) && bdev_is_zoned(dc->bdev)) { 1787 /* force submit zone reset */ 1788 if (dc->state == D_PREP) > 1789 __submit_zone_reset_cmd(sbi, dc, REQ_SYNC, 1790 &dcc->wait_list, NULL); 1791 dc->ref++; 1792 need_wait = true; 1793 } else { 1794 if (dc->state == D_PREP) { 1795 __punch_discard_cmd(sbi, dc, blkaddr); 1796 } else { 1797 dc->ref++; 1798 need_wait = true; 1799 } 1800 } 1801 } 1802 mutex_unlock(&dcc->cmd_lock); 1803 1804 if (need_wait) 1805 __wait_one_discard_bio(sbi, dc); 1806 } 1807
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6db410f1bb8c..d5be88fada0f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1196,6 +1196,44 @@ static void __init_discard_policy(struct f2fs_sb_info *sbi, static void __update_discard_tree_range(struct f2fs_sb_info *sbi, struct block_device *bdev, block_t lstart, block_t start, block_t len); + +#ifdef CONFIG_BLK_DEV_ZONED +static void __submit_zone_reset_cmd(struct f2fs_sb_info *sbi, + struct discard_cmd *dc, blk_opf_t flag, + struct list_head *wait_list, + unsigned int *issued) +{ + struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; + struct block_device *bdev = dc->bdev; + struct bio *bio = bio_alloc(bdev, 0, REQ_OP_ZONE_RESET | flag, GFP_NOFS); + unsigned long flags; + + trace_f2fs_issue_reset_zone(bdev, dc->di.start); + + spin_lock_irqsave(&dc->lock, flags); + dc->state = D_SUBMIT; + dc->bio_ref++; + spin_unlock_irqrestore(&dc->lock, flags); + + if (issued) + (*issued)++; + + atomic_inc(&dcc->queued_discard); + dc->queued++; + list_move_tail(&dc->list, wait_list); + + /* sanity check on discard range */ + __check_sit_bitmap(sbi, dc->di.lstart, dc->di.lstart + dc->di.len); + + bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(dc->di.start); + bio->bi_private = dc; + bio->bi_end_io = f2fs_submit_discard_endio; + submit_bio(bio); + + atomic_inc(&dcc->issued_discard); +} +#endif + /* this function is copied from blkdev_issue_discard from block/blk-lib.c */ static int __submit_discard_cmd(struct f2fs_sb_info *sbi, struct discard_policy *dpolicy, @@ -1217,6 +1255,13 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi, if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) return 0; +#ifdef CONFIG_BLK_DEV_ZONED + if (f2fs_sb_has_blkzoned(sbi) && bdev_is_zoned(bdev)) { + __submit_zone_reset_cmd(sbi, dc, flag, wait_list, issued); + return 0; + } +#endif + trace_f2fs_issue_discard(bdev, dc->di.start, dc->di.len); lstart = dc->di.lstart; @@ -1461,6 +1506,19 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi, } } +#ifdef CONFIG_BLK_DEV_ZONED +static void __queue_zone_reset_cmd(struct f2fs_sb_info *sbi, + struct block_device *bdev, block_t blkstart, block_t lblkstart, + block_t blklen) +{ + trace_f2fs_queue_reset_zone(bdev, blkstart); + + mutex_lock(&SM_I(sbi)->dcc_info->cmd_lock); + __insert_discard_cmd(sbi, bdev, lblkstart, blkstart, blklen); + mutex_unlock(&SM_I(sbi)->dcc_info->cmd_lock); +} +#endif + static void __queue_discard_cmd(struct f2fs_sb_info *sbi, struct block_device *bdev, block_t blkstart, block_t blklen) { @@ -1725,11 +1783,20 @@ static void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr) mutex_lock(&dcc->cmd_lock); dc = __lookup_discard_cmd(sbi, blkaddr); if (dc) { - if (dc->state == D_PREP) { - __punch_discard_cmd(sbi, dc, blkaddr); - } else { + if (f2fs_sb_has_blkzoned(sbi) && bdev_is_zoned(dc->bdev)) { + /* force submit zone reset */ + if (dc->state == D_PREP) + __submit_zone_reset_cmd(sbi, dc, REQ_SYNC, + &dcc->wait_list, NULL); dc->ref++; need_wait = true; + } else { + if (dc->state == D_PREP) { + __punch_discard_cmd(sbi, dc, blkaddr); + } else { + dc->ref++; + need_wait = true; + } } } mutex_unlock(&dcc->cmd_lock); @@ -1876,9 +1943,15 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, blkstart, blklen); return -EIO; } - trace_f2fs_issue_reset_zone(bdev, blkstart); - return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - sector, nr_sects, GFP_NOFS); + + if (unlikely(!is_sbi_flag_set(sbi, SBI_POR_DOING))) { + trace_f2fs_issue_reset_zone(bdev, blkstart); + return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, + sector, nr_sects, GFP_NOFS); + } + + __queue_zone_reset_cmd(sbi, bdev, blkstart, lblkstart, blklen); + return 0; } /* For conventional zones, use regular discard if supported */ diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 99cbc5949e3c..ee1477de8324 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1512,7 +1512,7 @@ DEFINE_EVENT(f2fs_discard, f2fs_remove_discard, TP_ARGS(dev, blkstart, blklen) ); -TRACE_EVENT(f2fs_issue_reset_zone, +DECLARE_EVENT_CLASS(f2fs_reset_zone, TP_PROTO(struct block_device *dev, block_t blkstart), @@ -1528,11 +1528,25 @@ TRACE_EVENT(f2fs_issue_reset_zone, __entry->blkstart = blkstart; ), - TP_printk("dev = (%d,%d), reset zone at block = 0x%llx", + TP_printk("dev = (%d,%d), zone at block = 0x%llx", show_dev(__entry->dev), (unsigned long long)__entry->blkstart) ); +DEFINE_EVENT(f2fs_reset_zone, f2fs_queue_reset_zone, + + TP_PROTO(struct block_device *dev, block_t blkstart), + + TP_ARGS(dev, blkstart) +); + +DEFINE_EVENT(f2fs_reset_zone, f2fs_issue_reset_zone, + + TP_PROTO(struct block_device *dev, block_t blkstart), + + TP_ARGS(dev, blkstart) +); + TRACE_EVENT(f2fs_issue_flush, TP_PROTO(struct block_device *dev, unsigned int nobarrier,
Changelog: v2 -> v3 Modified arguments to be correct for ftrace parameter. Changed __submit_zone_reset_cmd to void return. Refactored the f2fs_wait_discard_bio function. Fixed code that was previously incorrectly merged. v1 -> v2 Changed to apply the optional async reset write pointer by default. This patch enables submit reset zone command asynchornously. It helps decrease average latency of write IOs in high utilization scenario by faster checkpointing. Signed-off-by: Daejun Park <daejun7.park@samsung.com> --- fs/f2fs/segment.c | 85 ++++++++++++++++++++++++++++++++++--- include/trace/events/f2fs.h | 18 +++++++- 2 files changed, 95 insertions(+), 8 deletions(-)