diff options
author | Niklas Cassel <niklas.cassel@wdc.com> | 2021-06-14 13:49:05 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-06-14 08:54:55 -0600 |
commit | 5ddf46d0b2dfe10b9a518db1f936c81e099b2646 (patch) | |
tree | 87fc37751b2f31cbab1b120051c35cb6987fbfa7 /zbd.c | |
parent | 2c7dd23e5142e421723ede2557fe868ac32c8265 (diff) | |
download | fio-5ddf46d0b2dfe10b9a518db1f936c81e099b2646.tar.gz fio-5ddf46d0b2dfe10b9a518db1f936c81e099b2646.tar.bz2 |
zbd: change some f->zbd_info conditionals to asserts
Unfortunately, generic fio code calls some zbd_* functions unconditionally.
These functions will be called regardless if zonemode == ZONE_MODE_NONE,
ZONE_MODE_STRIDED or ZONE_MODE_ZBD, and cannot be optimized.
However, some functions are only called when zonemode == ZONE_MODE_ZBD.
Since f->zbd_info will always be non-NULL for a job with zonemode=zbd,
these functions can be optimized to not check if f->zbd_info is set.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'zbd.c')
-rw-r--r-- | zbd.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -808,8 +808,7 @@ int zbd_setup_files(struct thread_data *td) 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); @@ -1470,8 +1469,7 @@ static void zbd_queue_io(struct thread_data *td, struct io_u *io_u, int q, 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); @@ -1531,8 +1529,7 @@ static void zbd_put_io(struct thread_data *td, const struct io_u *io_u) 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); @@ -1588,6 +1585,7 @@ void setup_zbd_zone_mode(struct thread_data *td, struct io_u *io_u) 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); @@ -1662,6 +1660,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u, * 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; @@ -1691,9 +1690,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u) 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); |