Skip to content

Commit 04f9090

Browse files
committed
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 <bvanassche@acm.org>
1 parent 362ce03 commit 04f9090

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

zbd.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,8 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
776776
int nr_zones, nrz;
777777
struct zbd_zone *zones, *z;
778778
struct fio_zone_info *p;
779-
uint64_t zone_size, offset;
779+
uint64_t zone_size, offset, capacity;
780+
bool same_zone_cap = true;
780781
struct zoned_block_device_info *zbd_info = NULL;
781782
int i, j, ret = -ENOMEM;
782783

@@ -793,6 +794,7 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
793794
}
794795

795796
zone_size = zones[0].len;
797+
capacity = zones[0].capacity;
796798
nr_zones = (f->real_file_size + zone_size - 1) / zone_size;
797799

798800
if (td->o.zone_size == 0) {
@@ -821,6 +823,8 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
821823
PTHREAD_MUTEX_RECURSIVE);
822824
p->start = z->start;
823825
p->capacity = z->capacity;
826+
if (capacity != z->capacity)
827+
same_zone_cap = false;
824828

825829
switch (z->cond) {
826830
case ZBD_ZONE_COND_NOT_WP:
@@ -876,6 +880,11 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
876880
f->zbd_info->zone_size_log2 = is_power_of_2(zone_size) ?
877881
ilog2(zone_size) : 0;
878882
f->zbd_info->nr_zones = nr_zones;
883+
884+
if (same_zone_cap)
885+
dprint(FD_ZBD, "Zone capacity = %"PRIu64" KB\n",
886+
capacity / 1024);
887+
879888
zbd_info = NULL;
880889
ret = 0;
881890

0 commit comments

Comments
 (0)