zbd: only put an upper limit on max open zones once
authorNiklas Cassel <niklas.cassel@wdc.com>
Fri, 14 May 2021 12:52:51 +0000 (12:52 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 14 May 2021 14:57:26 +0000 (08:57 -0600)
There is an upper limit that is checked for each td, and for each file,
even though a file has a pointer to a zoned_block_device_info that has
already been created. Multiple files, from the same or from another td
can point to the same zoned_block_device_info.
All zoned_block_device_info:s have already been created earlier in the
call chain.

Simplify this by only checking the upper limit on max open zones when a
zoned_block_device_info is created.

This way, max_open_zones is handled from a single location, instead of
potentially being reassigned from a completely different location.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index eed796b3217d297eb94942b28b4cfbf0ab5113ab..46ff9aeb040dafd031b97f6a20e6f9dc4da2d20a 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -588,7 +588,8 @@ static int zbd_create_zone_info(struct thread_data *td, struct fio_file *f)
 
        if (ret == 0) {
                f->zbd_info->model = zbd_model;
 
        if (ret == 0) {
                f->zbd_info->model = zbd_model;
-               f->zbd_info->max_open_zones = td->o.max_open_zones;
+               f->zbd_info->max_open_zones =
+                       min_not_zero(td->o.max_open_zones, ZBD_MAX_OPEN_ZONES);
        }
        return ret;
 }
        }
        return ret;
 }
@@ -726,8 +727,6 @@ int zbd_setup_files(struct thread_data *td)
                if (zbd_is_seq_job(f))
                        assert(f->min_zone < f->max_zone);
 
                if (zbd_is_seq_job(f))
                        assert(f->min_zone < f->max_zone);
 
-               zbd->max_open_zones = zbd->max_open_zones ?: ZBD_MAX_OPEN_ZONES;
-
                if (td->o.max_open_zones > 0 &&
                    zbd->max_open_zones != td->o.max_open_zones) {
                        log_err("Different 'max_open_zones' values\n");
                if (td->o.max_open_zones > 0 &&
                    zbd->max_open_zones != td->o.max_open_zones) {
                        log_err("Different 'max_open_zones' values\n");