return min(zone_idx, f->zbd_info->nr_zones);
}
-/**
- * zbd_zone_swr - Test whether a zone requires sequential writes
- * @z: zone info pointer.
- */
-static inline bool zbd_zone_swr(struct fio_zone_info *z)
-{
- return z->type == ZBD_ZONE_TYPE_SWR;
-}
-
/**
* zbd_zone_end - Return zone end location
* @z: zone info pointer.
{
assert((required & 511) == 0);
- return zbd_zone_swr(z) &&
+ return z->has_wp &&
z->wp + required > zbd_zone_capacity_end(z);
}
zone_idx_b = zbd_zone_idx(f, f->file_offset);
zone_idx_e = zbd_zone_idx(f, f->file_offset + f->io_size - 1);
for (zone_idx = zone_idx_b; zone_idx <= zone_idx_e; zone_idx++)
- if (zbd_zone_swr(get_zone(f, zone_idx)))
+ if (get_zone(f, zone_idx)->has_wp)
return true;
return false;
p->type = ZBD_ZONE_TYPE_SWR;
p->cond = ZBD_ZONE_COND_EMPTY;
p->capacity = zone_capacity;
+ p->has_wp = 1;
}
/* a sentinel */
p->start = nr_zones * zone_size;
p->wp = z->wp;
break;
}
+
+ switch (z->type) {
+ case ZBD_ZONE_TYPE_SWR:
+ p->has_wp = 1;
+ break;
+ default:
+ p->has_wp = 0;
+ }
p->type = z->type;
p->cond = z->cond;
+
if (j > 0 && p->start != p[-1].start + zone_size) {
log_info("%s: invalid zone data\n",
f->file_name);
for (z = zb; z < ze; z++) {
uint32_t nz = zbd_zone_nr(f, z);
- if (!zbd_zone_swr(z))
+ if (!z->has_wp)
continue;
zone_lock(td, f, z);
if (all_zones) {
assert(zone_idx < zbd_info->nr_zones);
z = get_zone(f, zone_idx);
- if (!zbd_zone_swr(z))
+ if (!z->has_wp)
return;
if (!success)
assert(zone_idx < zbd_info->nr_zones);
z = get_zone(f, zone_idx);
- if (!zbd_zone_swr(z))
+ if (!z->has_wp)
return;
dprint(FD_ZBD,
orig_zb = zb;
/* Accept the I/O offset for conventional zones. */
- if (!zbd_zone_swr(zb))
+ if (!zb->has_wp)
return io_u_accept;
/*
* @mutex: protects the modifiable members in this structure
* @type: zone type (BLK_ZONE_TYPE_*)
* @cond: zone state (BLK_ZONE_COND_*)
+ * @has_wp: whether or not this zone can have a valid write pointer
* @open: whether or not this zone is currently open. Only relevant if
* max_open_zones > 0.
* @reset_zone: whether or not this zone should be reset before writing to it
uint32_t verify_block;
enum zbd_zone_type type:2;
enum zbd_zone_cond cond:4;
+ unsigned int has_wp:1;
unsigned int open:1;
unsigned int reset_zone:1;
};