Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bvanassche/fio
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/bvanassche/fio:
  zbd: Report the zone capacity
  zbd: Make an error message more detailed
  • Loading branch information
vincentkfu committed May 23, 2023
2 parents 870ea00 + 04f9090 commit 1bb4253
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions zbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ static int zbd_report_zones(struct thread_data *td, struct fio_file *f,
ret = blkzoned_report_zones(td, f, offset, zones, nr_zones);
if (ret < 0) {
td_verror(td, errno, "report zones failed");
log_err("%s: report zones from sector %"PRIu64" failed (%d).\n",
f->file_name, offset >> 9, errno);
log_err("%s: report zones from sector %"PRIu64" failed (nr_zones=%d; errno=%d).\n",
f->file_name, offset >> 9, nr_zones, errno);
} else if (ret == 0) {
td_verror(td, errno, "Empty zone report");
log_err("%s: report zones from sector %"PRIu64" is empty.\n",
Expand Down Expand Up @@ -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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 1bb4253

Please sign in to comment.