From 04f9090b68e7350f25873387ab62738b667c9201 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 22 Feb 2023 13:54:18 -0800 Subject: [PATCH] zbd: Report the zone capacity The zone capacity is important information. Hence report the zone capacity if it is identical for all zones and if ZBD debugging is enabled. Signed-off-by: Bart Van Assche --- zbd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zbd.c b/zbd.c index 5f6b9ef4..5f1a7d7f 100644 --- a/zbd.c +++ b/zbd.c @@ -776,7 +776,8 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f) int nr_zones, nrz; struct zbd_zone *zones, *z; struct fio_zone_info *p; - uint64_t zone_size, offset; + uint64_t zone_size, offset, capacity; + bool same_zone_cap = true; struct zoned_block_device_info *zbd_info = NULL; int i, j, ret = -ENOMEM; @@ -793,6 +794,7 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f) } zone_size = zones[0].len; + capacity = zones[0].capacity; nr_zones = (f->real_file_size + zone_size - 1) / zone_size; if (td->o.zone_size == 0) { @@ -821,6 +823,8 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f) PTHREAD_MUTEX_RECURSIVE); p->start = z->start; p->capacity = z->capacity; + if (capacity != z->capacity) + same_zone_cap = false; switch (z->cond) { case ZBD_ZONE_COND_NOT_WP: @@ -876,6 +880,11 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f) f->zbd_info->zone_size_log2 = is_power_of_2(zone_size) ? ilog2(zone_size) : 0; f->zbd_info->nr_zones = nr_zones; + + if (same_zone_cap) + dprint(FD_ZBD, "Zone capacity = %"PRIu64" KB\n", + capacity / 1024); + zbd_info = NULL; ret = 0; -- 2.25.1