[PATCH 1/2] stat: report zone reset count only when zonemode is set to zbd
Shin'ichiro Kawasaki <[email protected]> Wed, 8 Oct 2025 18:48:46 +0900
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <[email protected]> |
Currently, fio reports the zone reset count regardless of whether the zbd zonemode is specified. Reporting the zone reset count lacking the zbd zonemode is irrelevant and unnecessary. Suppress the zone reset count report unless the zbd zonemode is specified. For that purpose, introduce the new flag "count_zone_resets" to the struct thread_stat. To maintain 32-bit alignment of the struct, repurpose the existing "pad3" field to allocate the flag. To group the related fields together, move the field "nr_zone_resets" and "latency_depth" within the struct. Make corresponding adjustments in the relevant functions fio_server_send_ts() and convert_ts(). Set the flag count_zone_resets only when the zbd zonemode is set, and the workload is write or trim. Refer to the flag in show_ddir_status() to determine if the zone reset count should be reported. Also refer to the flag in sum_thread_stats() to decide if the nr_zone_resets field should be summed up. Signed-off-by: Shin'ichiro Kawasaki <[email protected]> --- client.c | 4 +++- server.c | 4 +++- stat.c | 7 +++++-- stat.h | 9 +++++---- zbd.c | 4 ++++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/client.c b/client.c index 923b092e..8c0744b8 100644 --- a/client.c +++ b/client.c @@ -1027,7 +1027,6 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src) dst->total_submit = le64_to_cpu(src->total_submit); dst->total_complete = le64_to_cpu(src->total_complete); - dst->nr_zone_resets = le64_to_cpu(src->nr_zone_resets); for (i = 0; i < DDIR_RWDIR_CNT; i++) { dst->io_bytes[i] = le64_to_cpu(src->io_bytes[i]); @@ -1043,6 +1042,9 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src) dst->sig_figs = le32_to_cpu(src->sig_figs); + dst->nr_zone_resets = le64_to_cpu(src->nr_zone_resets); + dst->count_zone_resets = le16_to_cpu(src->count_zone_resets); + dst->latency_depth = le32_to_cpu(src->latency_depth); dst->latency_target = le64_to_cpu(src->latency_target); dst->latency_window = le64_to_cpu(src->latency_window); diff --git a/server.c b/server.c index 5967f421..efb31879 100644 --- a/server.c +++ b/server.c @@ -1770,7 +1770,6 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs) p.ts.total_submit = cpu_to_le64(ts->total_submit); p.ts.total_complete = cpu_to_le64(ts->total_complete); - p.ts.nr_zone_resets = cpu_to_le64(ts->nr_zone_resets); for (i = 0; i < DDIR_RWDIR_CNT; i++) { p.ts.io_bytes[i] = cpu_to_le64(ts->io_bytes[i]); @@ -1784,6 +1783,9 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs) p.ts.kb_base = cpu_to_le32(ts->kb_base); p.ts.unit_base = cpu_to_le32(ts->unit_base); + p.ts.nr_zone_resets = cpu_to_le64(ts->nr_zone_resets); + p.ts.count_zone_resets = cpu_to_le16(ts->count_zone_resets); + p.ts.latency_depth = cpu_to_le32(ts->latency_depth); p.ts.latency_target = cpu_to_le64(ts->latency_target); p.ts.latency_window = cpu_to_le64(ts->latency_window); diff --git a/stat.c b/stat.c index 1151a09f..76b74b3c 100644 --- a/stat.c +++ b/stat.c @@ -565,7 +565,7 @@ static void show_ddir_status(const struct group_run_stats *rs, struct thread_sta iops = (1000 * (uint64_t)ts->total_io_u[ddir]) / runt; iops_p = num2str(iops, ts->sig_figs, 1, 0, N2S_NONE); - if (ddir == DDIR_WRITE || ddir == DDIR_TRIM) + if (ts->count_zone_resets) post_st = zbd_write_status(ts); else if (ddir == DDIR_READ && ts->cachehit && ts->cachemiss) { uint64_t total; @@ -2360,7 +2360,10 @@ void sum_thread_stats(struct thread_stat *dst, const struct thread_stat *src) dst->total_run_time += src->total_run_time; dst->total_submit += src->total_submit; dst->total_complete += src->total_complete; - dst->nr_zone_resets += src->nr_zone_resets; + if (src->count_zone_resets) { + dst->count_zone_resets = 1; + dst->nr_zone_resets += src->nr_zone_resets; + } dst->cachehit += src->cachehit; dst->cachemiss += src->cachemiss; } diff --git a/stat.h b/stat.h index 02bea976..f40507e3 100644 --- a/stat.h +++ b/stat.h @@ -233,17 +233,18 @@ struct thread_stat { uint32_t first_error; uint64_t total_err_count; - /* ZBD stats */ - uint64_t nr_zone_resets; - uint64_t nr_block_infos; uint32_t block_infos[MAX_NR_BLOCK_INFOS]; uint32_t kb_base; uint32_t unit_base; + /* ZBD stats */ + uint64_t nr_zone_resets; + uint16_t count_zone_resets; /* Flag to enable nr_zone_resets */ + uint16_t pad3; + uint32_t latency_depth; - uint32_t pad3; uint64_t latency_target; fio_fp64_t latency_percentile; uint64_t latency_window; diff --git a/zbd.c b/zbd.c index 8f0e4bc6..7a66b665 100644 --- a/zbd.c +++ b/zbd.c @@ -1284,6 +1284,10 @@ int zbd_setup_files(struct thread_data *td) return 1; } + /* Enable zone reset stat report for write and trim workloads */ + if (td_write(td) || td_trim(td)) + td->ts.count_zone_resets = 1; + for_each_file(td, f, i) { struct zoned_block_device_info *zbd = f->zbd_info; struct fio_zone_info *z; -- 2.49.0