f2fs: add iostat latency statistics support for discard
Subsystems (2)
PATCH v2 1/1 f2fs: add iostat latency statistics support for discard
In this patch, it adds to account discard latency.
---
v2:
-rename get_bio_iostat_private to iostat_get_bio_private
fs/f2fs/data.c | 2 +- fs/f2fs/f2fs.h | 1 + fs/f2fs/iostat.c | 83 +++++++++++++++++++++---------------- fs/f2fs/iostat.h | 49 +++++++++++----------- fs/f2fs/segment.c | 8 +++- include/trace/events/f2fs.h | 68 ++++++++++++++++-------------- 6 files changed, 118 insertions(+), 93 deletions(-)
fs/f2fs/data.c +1 -1
@@ -2311,7 +2311,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,if (bio_add_page (bio, page, blocksize,0 ) < blocksize) goto submit_and_realloc; - ctx =get_post_read_ctx (bio); + ctx =iostat_get_bio_private (bio); ctx->enabled_steps |=STEP_DECOMPRESS ;refcount_inc (&dic->refcnt);
fs/f2fs/f2fs.h +1 -0
@@ -1131,6 +1131,7 @@ enum page_type {META_FLUSH ,IPU ,/* the below types are used by tracepoints only. */ OPU , + DISCARD, /* used by iostat */ }; enum temp_type {
fs/f2fs/iostat.c +47 -36
132 lines not on this page · raw message
fs/f2fs/iostat.h +24 -25
89 lines not on this page · raw message
fs/f2fs/segment.c +7 -1
@@ -1012,9 +1012,12 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi,static void f2fs_submit_discard_endio (struct bio *bio) { -struct discard_cmd *dc = (struct discard_cmd *)bio->bi_private; +struct discard_cmd *dc;unsigned long flags; +iostat_update_and_unbind_ctx (bio); + dc = bio->bi_private; +spin_lock_irqsave (&dc->lock, flags);if (!dc->error) dc->error =blk_status_to_errno (bio->bi_status);
@@ -1188,6 +1191,9 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi, bio->bi_private = dc; bio->bi_end_io = f2fs_submit_discard_endio; bio->bi_opf |= flag; + +iostat_alloc_and_bind_ctx (sbi, bio, dc); +iostat_update_submit_ctx (bio,DISCARD );submit_bio (bio);atomic_inc (&dcc->issued_discard);
include/trace/events/f2fs.h +38 -30
96 lines not on this page · raw message
Signature · 8 lines
2.35.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi Yangtao,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev linus/master v6.3-rc3 next-20230320] [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/Yangtao-Li/f2fs-add-iostat-latency-statistics-support-for-discard/20230321-020736 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test patch link: https://lore.kernel.org/r/20230320175529.39129-1-frank.li%40vivo.com patch subject: [PATCH v2] f2fs: add iostat latency statistics support for discard config: x86_64-randconfig-s023 (https://download.01.org/0day-ci/archive/20230321/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/a094ea0014763420eb8e3577552baac00c63efad git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yangtao-Li/f2fs-add-iostat-latency-statistics-support-for-discard/20230321-020736 git checkout a094ea0014763420eb8e3577552baac00c63efad # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 olddefconfig make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/f2fs/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> fs/f2fs/iostat.c:259:29: sparse: sparse: mixing different enum types: >> fs/f2fs/iostat.c:259:29: sparse: unsigned int enum iostat_lat_type >> fs/f2fs/iostat.c:259:29: sparse: unsigned int enum page_type
fs/f2fs/iostat.c:262:29: sparse: sparse: mixing different enum types:
fs/f2fs/iostat.c:262:29: sparse: unsigned int enum iostat_lat_type
fs/f2fs/iostat.c:262:29: sparse: unsigned int enum page_type
vim +259 fs/f2fs/iostat.c
246
247 void iostat_update_submit_ctx(struct bio *bio, enum page_type type)
248 {
249 struct bio_iostat_ctx *iostat_ctx = bio->bi_private;
250 enum iostat_lat_type lat_type;
251
252 iostat_ctx->submit_ts = jiffies;
253
254 if (type == DISCARD) {
255 lat_type = DISCARD_LAT;
256 } else if (op_is_write(bio_op(bio))) {
257 lat_type = bio->bi_opf & REQ_SYNC ?
258 WRITE_SYNC_DATA_LAT : WRITE_ASYNC_DATA_LAT;
> 259 lat_type += type;
260 } else {
261 lat_type = READ_DATA_LAT;
262 lat_type += type;
263 }
264
265 iostat_ctx->lat_type = lat_type;
266 }
267
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests