Commit
219c662d3b12 ("zbd: introduce per job maximum open zones limit")
Introduced a global max open zones limit stored in zbd_info->max_open_zones.
This commit also removed the following check from zbd_open_zone():
if (!td->o.max_open_zones)
return true;
Before the commit in question, if td->o.max_open_zones == 0, zbd_open_zone()
would not track the zone as open in the zbd_info->open_zones array.
After the commit in question, zbd_open_zone() would always track the zone
as open in the zbd_info->open_zones array, regardless if a --max_open_zones
limit was set or not.
Change the initialization of zbd_info->max_open_zones to yet again allow
unlimited max open zones. If zbd_info->max_open_zones is unlimited,
we do not track the open zones in the zbd_info->open zone array.
Not tracking open zones reduces fio overhead for testing the performance of
zoned block devices that do not have a limit on the maximum number of open
zones.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
out:
/* Ensure that the limit is not larger than FIO's internal limit */
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);
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;
}
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");
struct zoned_block_device_info *zbdi = f->zbd_info;
int i;
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);
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;
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)) {
/*
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
* 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.
* @mutex: Protects the modifiable members in this structure (refcount and
* num_open_zones).
* @zone_size: size of a single zone in bytes.