{
int ret;
+ if (f->filetype == FIO_TYPE_PIPE) {
+ log_err("zonemode=zbd does not support pipes\n");
+ return -EINVAL;
+ }
+
+ /* If regular file, always emulate zones inside the file. */
+ if (f->filetype == FIO_TYPE_FILE) {
+ *model = ZBD_NONE;
+ return 0;
+ }
+
if (td->io_ops && td->io_ops->get_zoned_model)
ret = td->io_ops->get_zoned_model(td, f, model);
else
int i;
if (zone_size == 0) {
- log_err("%s: Specifying the zone size is mandatory for regular block devices with --zonemode=zbd\n\n",
+ log_err("%s: Specifying the zone size is mandatory for regular file/block device with --zonemode=zbd\n\n",
f->file_name);
return 1;
}
return 1;
}
+ if (f->real_file_size < zone_size) {
+ log_err("%s: file/device size %"PRIu64" is smaller than zone size %"PRIu64"\n",
+ f->file_name, f->real_file_size, zone_size);
+ return -EINVAL;
+ }
+
nr_zones = (f->real_file_size + zone_size - 1) / zone_size;
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
return ret;
switch (zbd_model) {
- case ZBD_IGNORE:
- return 0;
case ZBD_HOST_AWARE:
case ZBD_HOST_MANAGED:
ret = parse_zone_info(td, f);
return -EINVAL;
}
+ assert(f->zbd_info);
f->zbd_info->model = zbd_model;
ret = zbd_set_max_open_zones(td, f);
struct fio_zone_info *z;
int zi;
- if (!zbd)
- continue;
+ 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);
uint32_t zone_idx;
uint64_t zone_end;
- if (!zbd_info)
- return;
+ assert(zbd_info);
zone_idx = zbd_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
struct fio_zone_info *z;
uint32_t zone_idx;
- if (!zbd_info)
- return;
+ assert(zbd_info);
zone_idx = zbd_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
assert(td->o.zone_mode == ZONE_MODE_ZBD);
assert(td->o.zone_size);
+ assert(f->zbd_info);
zone_idx = zbd_zone_idx(f, f->last_pos[ddir]);
z = get_zone(f, zone_idx);
* devices with all empty zones. Overwrite the first I/O direction as
* write to make sure data to read exists.
*/
+ assert(io_u->file->zbd_info);
if (ddir != DDIR_READ || !td_rw(td))
return ddir;
uint64_t new_len;
int64_t range;
- if (!f->zbd_info)
- return io_u_accept;
-
+ assert(f->zbd_info);
assert(min_bs);
assert(is_valid_offset(f, io_u->offset));
assert(io_u->buflen);