diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2021-02-22 16:27:36 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-22 07:35:37 -0700 |
commit | 8f39afa7dc98303f2bf18f73f1a4161de3668c10 (patch) | |
tree | c9ced4ca4b5a71ef248750f146cf729e845a7eb4 /zbd.c | |
parent | 1ddd225e0b56f9d23c97ce99a18bae9cba5331a7 (diff) | |
download | fio-8f39afa7dc98303f2bf18f73f1a4161de3668c10.tar.gz fio-8f39afa7dc98303f2bf18f73f1a4161de3668c10.tar.bz2 |
zbd: support 'z' suffix for zone granularity
Allow users to pass some options with zone granularity which is natural
for ZBD workloads.
This is nifty for writing quick tests and when firmware guys change
zone sizes.
Converted options are
io_size=
offset=
offset_increment=
size=
zoneskip=
Example:
rw=write
numjobs=2
offset=1z
offset_increment=10z
size=5z
io_size=6z
Thread 1 will write zones 1, 2, 3, 4, 5, 1.
Thread 2 will write zones 11, 12, 13, 14, 15, 11.
Note:
zonemode=strided doesn't create ZBD zone structure but requires
value recalculation. This is why 2 functions are split.
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'zbd.c')
-rw-r--r-- | zbd.c | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -647,7 +647,7 @@ static bool zbd_open_zone(struct thread_data *td, const struct fio_file *f, static int zbd_reset_zone(struct thread_data *td, struct fio_file *f, struct fio_zone_info *z); -int zbd_setup_files(struct thread_data *td) +int zbd_init_files(struct thread_data *td) { struct fio_file *f; int i; @@ -656,6 +656,44 @@ int zbd_setup_files(struct thread_data *td) if (zbd_init_zone_info(td, f)) return 1; } + return 0; +} + +void zbd_recalc_options_with_zone_granularity(struct thread_data *td) +{ + struct fio_file *f; + int i; + + for_each_file(td, f, i) { + struct zoned_block_device_info *zbd = f->zbd_info; + // zonemode=strided doesn't get per-file zone size. + uint64_t zone_size = zbd ? zbd->zone_size : td->o.zone_size; + + if (zone_size == 0) + continue; + + if (td->o.size_nz > 0) { + td->o.size = td->o.size_nz * zone_size; + } + if (td->o.io_size_nz > 0) { + td->o.io_size = td->o.io_size_nz * zone_size; + } + if (td->o.start_offset_nz > 0) { + td->o.start_offset = td->o.start_offset_nz * zone_size; + } + if (td->o.offset_increment_nz > 0) { + td->o.offset_increment = td->o.offset_increment_nz * zone_size; + } + if (td->o.zone_skip_nz > 0) { + td->o.zone_skip = td->o.zone_skip_nz * zone_size; + } + } +} + +int zbd_setup_files(struct thread_data *td) +{ + struct fio_file *f; + int i; if (!zbd_using_direct_io()) { log_err("Using direct I/O is mandatory for writing to ZBD drives\n\n"); |