diff options
author | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2021-12-14 10:24:05 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-12-14 06:48:14 -0700 |
commit | b5a0f7ce303d5fa5cca51af0652b7f7cf9bc5d61 (patch) | |
tree | 597ee9df16166fce76088f849a932ccaed5af5c6 /zbd.c | |
parent | 410a071c59d7992968af7073bf39546df18542ff (diff) | |
download | fio-b5a0f7ce303d5fa5cca51af0652b7f7cf9bc5d61.tar.gz fio-b5a0f7ce303d5fa5cca51af0652b7f7cf9bc5d61.tar.bz2 |
zbd: remove is_zone_open() helper
The helper function is_zone_open() is useless as a each zone has an open
flag indicating if it is part of the array of open zones. Remove this
function code and use the zone open flag in zbd_open_zone().
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20211214012413.464798-5-damien.lemoal@opensource.wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'zbd.c')
-rw-r--r-- | zbd.c | 38 |
1 files changed, 5 insertions, 33 deletions
@@ -378,36 +378,6 @@ static int zbd_get_max_open_zones(struct thread_data *td, struct fio_file *f, } /** - * is_zone_open - Test if a zone is already in the array of open zones. - * @td: fio thread data. - * @f: fio file for which to test zones. - * @zone_idx: Index of the zone to check. - * - * The caller must hold f->zbd_info->mutex. - */ -static bool is_zone_open(const struct thread_data *td, const struct fio_file *f, - unsigned int zone_idx) -{ - 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); - - for (i = 0; i < zbdi->num_open_zones; i++) - if (zbdi->open_zones[i] == zone_idx) - return true; - - return false; -} - -/** * zbd_open_zone - Add a zone to the array of open zones. * @td: fio thread data. * @f: fio file that has the open zones to add. @@ -446,10 +416,12 @@ static bool zbd_open_zone(struct thread_data *td, const struct fio_file *f, return true; pthread_mutex_lock(&zbdi->mutex); - if (is_zone_open(td, f, zone_idx)) { + + if (z->open) { /* - * If the zone is already open and going to be full by writes - * in-flight, handle it as a full zone instead of an open zone. + * If the zone is going to be completely filled by writes + * already in-flight, handle it as a full zone instead of an + * open zone. */ if (z->wp >= zbd_zone_capacity_end(z)) res = false; |