out:
/* Ensure that the limit is not larger than FIO's internal limit */
- zbd->max_open_zones = min_not_zero(zbd->max_open_zones,
- (uint32_t) ZBD_MAX_OPEN_ZONES);
+ if (zbd->max_open_zones > ZBD_MAX_OPEN_ZONES) {
+ td_verror(td, EINVAL, "'max_open_zones' value is too large");
+ log_err("'max_open_zones' value is larger than %u\n", ZBD_MAX_OPEN_ZONES);
+ return -EINVAL;
+ }
+
dprint(FD_ZBD, "%s: using max open zones limit: %"PRIu32"\n",
f->file_name, zbd->max_open_zones);
log_err("Different 'max_open_zones' values\n");
return 1;
}
- if (zbd->max_open_zones > ZBD_MAX_OPEN_ZONES) {
- log_err("'max_open_zones' value is limited by %u\n", ZBD_MAX_OPEN_ZONES);
+
+ /*
+ * The per job max open zones limit cannot be used without a
+ * global max open zones limit. (As the tracking of open zones
+ * is disabled when there is no global max open zones limit.)
+ */
+ if (td->o.job_max_open_zones && !zbd->max_open_zones) {
+ log_err("'job_max_open_zones' cannot be used without a global open zones limit\n");
return 1;
}
struct zoned_block_device_info *zbdi = f->zbd_info;
int i;
+ /* This function should never be called when zbdi->max_open_zones == 0 */
+ assert(zbdi->max_open_zones);
assert(td->o.job_max_open_zones == 0 || td->num_open_zones <= td->o.job_max_open_zones);
assert(td->o.job_max_open_zones <= zbdi->max_open_zones);
assert(zbdi->num_open_zones <= zbdi->max_open_zones);
if (td->o.verify != VERIFY_NONE && zbd_zone_full(f, z, min_bs))
return false;
+ /*
+ * zbdi->max_open_zones == 0 means that there is no limit on the maximum
+ * number of open zones. In this case, do no track open zones in
+ * zbdi->open_zones array.
+ */
+ if (!zbdi->max_open_zones)
+ return true;
+
pthread_mutex_lock(&zbdi->mutex);
if (is_zone_open(td, f, zone_idx)) {
/*
* zoned_block_device_info - zoned block device characteristics
* @model: Device model.
* @max_open_zones: global limit on the number of simultaneously opened
- * sequential write zones.
+ * sequential write zones. A zero value means unlimited open zones,
+ * and that open zones will not be tracked in the open_zones array.
* @mutex: Protects the modifiable members in this structure (refcount and
* num_open_zones).
* @zone_size: size of a single zone in bytes.