return (uint64_t)(offset - f->file_offset) < f->io_size;
}
-static inline unsigned int zbd_zone_nr(const struct fio_file *f,
- struct fio_zone_info *zone)
+static inline unsigned int zbd_zone_idx(const struct fio_file *f,
+ struct fio_zone_info *zone)
{
return zone - f->zbd_info->zone_info;
}
/**
- * zbd_zone_idx - convert an offset into a zone number
+ * zbd_offset_to_zone_idx - convert an offset into a zone number
* @f: file pointer.
* @offset: offset in bytes. If this offset is in the first zone_size bytes
* past the disk size then the index of the sentinel is returned.
*/
-static uint32_t zbd_zone_idx(const struct fio_file *f, uint64_t offset)
+static unsigned int zbd_offset_to_zone_idx(const struct fio_file *f,
+ uint64_t offset)
{
uint32_t zone_idx;
assert(is_valid_offset(f, offset + length - 1));
dprint(FD_ZBD, "%s: resetting wp of zone %u.\n",
- f->file_name, zbd_zone_nr(f, z));
+ f->file_name, zbd_zone_idx(f, z));
switch (f->zbd_info->model) {
case ZBD_HOST_AWARE:
return;
dprint(FD_ZBD, "%s: closing zone %u\n",
- f->file_name, zbd_zone_nr(f, z));
+ f->file_name, zbd_zone_idx(f, z));
memmove(f->zbd_info->open_zones + ozi,
f->zbd_info->open_zones + ozi + 1,
assert(min_bs);
dprint(FD_ZBD, "%s: examining zones %u .. %u\n",
- f->file_name, zbd_zone_nr(f, zb), zbd_zone_nr(f, ze));
+ f->file_name, zbd_zone_idx(f, zb), zbd_zone_idx(f, ze));
for (z = zb; z < ze; z++) {
if (!z->has_wp)
if (z->wp != z->start) {
dprint(FD_ZBD, "%s: resetting zone %u\n",
- f->file_name, zbd_zone_nr(f, z));
+ f->file_name, zbd_zone_idx(f, z));
if (zbd_reset_zone(td, f, z) < 0)
res = 1;
}
{
const uint64_t min_bs = td->o.min_bs[DDIR_WRITE];
struct zoned_block_device_info *zbdi = f->zbd_info;
- uint32_t zone_idx = zbd_zone_nr(f, z);
+ uint32_t zone_idx = zbd_zone_idx(f, z);
bool res = true;
if (z->cond == ZBD_ZONE_COND_OFFLINE)
if (f->io_size == 0)
return false;
- zone_idx_b = zbd_zone_idx(f, f->file_offset);
- zone_idx_e = zbd_zone_idx(f, f->file_offset + f->io_size - 1);
+ zone_idx_b = zbd_offset_to_zone_idx(f, f->file_offset);
+ zone_idx_e =
+ zbd_offset_to_zone_idx(f, f->file_offset + f->io_size - 1);
for (zone_idx = zone_idx_b; zone_idx <= zone_idx_e; zone_idx++)
if (get_zone(f, zone_idx)->has_wp)
return true;
return false;
}
- zone_idx = zbd_zone_idx(f, f->file_offset);
+ zone_idx = zbd_offset_to_zone_idx(f, f->file_offset);
z = get_zone(f, zone_idx);
if ((f->file_offset != z->start) &&
(td->o.td_ddir != TD_DDIR_READ)) {
f->file_offset = new_offset;
}
- zone_idx = zbd_zone_idx(f, f->file_offset + f->io_size);
+ zone_idx = zbd_offset_to_zone_idx(f, f->file_offset + f->io_size);
z = get_zone(f, zone_idx);
new_end = z->start;
if ((td->o.td_ddir != TD_DDIR_READ) &&
assert(zbd);
- f->min_zone = zbd_zone_idx(f, f->file_offset);
- f->max_zone = zbd_zone_idx(f, f->file_offset + f->io_size);
+ f->min_zone = zbd_offset_to_zone_idx(f, f->file_offset);
+ f->max_zone =
+ zbd_offset_to_zone_idx(f, f->file_offset + f->io_size);
/*
* When all zones in the I/O range are conventional, io_size
*/
zone_idx = zbdi->open_zones[pick_random_zone_idx(f, io_u)];
} else {
- zone_idx = zbd_zone_idx(f, io_u->offset);
+ zone_idx = zbd_offset_to_zone_idx(f, io_u->offset);
}
if (zone_idx < f->min_zone)
zone_idx = f->min_zone;
assert(zbd_info);
- zone_idx = zbd_zone_idx(f, io_u->offset);
+ zone_idx = zbd_offset_to_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
z = get_zone(f, zone_idx);
assert(zbd_info);
- zone_idx = zbd_zone_idx(f, io_u->offset);
+ zone_idx = zbd_offset_to_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
z = get_zone(f, zone_idx);
assert(td->o.zone_size);
assert(f->zbd_info);
- zone_idx = zbd_zone_idx(f, f->last_pos[ddir]);
+ zone_idx = zbd_offset_to_zone_idx(f, f->last_pos[ddir]);
z = get_zone(f, zone_idx);
/*
assert(is_valid_offset(f, io_u->offset));
assert(io_u->buflen);
- zone_idx_b = zbd_zone_idx(f, io_u->offset);
+ zone_idx_b = zbd_offset_to_zone_idx(f, io_u->offset);
zb = get_zone(f, zone_idx_b);
orig_zb = zb;
uint32_t zone_idx;
int ret;
- zone_idx = zbd_zone_idx(f, io_u->offset);
+ zone_idx = zbd_offset_to_zone_idx(f, io_u->offset);
z = get_zone(f, zone_idx);
if (!z->has_wp)