Recent changes (master)
The following changes since commit 2459bd33b3dbb7a34f28c612d595311a6bc7593d:
ioengines: fix crash with --enghelp option (2021-08-04 12:49:57 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to faff87e6f0da68853908652a95f0ec40dd12869d:
t/zbd: Add test #58 to test zone reset by trim workload (2021-08-06 16:39:31 -0600)
----------------------------------------------------------------
Shin'ichiro Kawasaki (5):
zbd: Add min_bytes argument to zbd_find_zone()
zbd: Support zone reset by trim
engines/libzbc: Enable trim for libzbc I/O engine HOWTO/man: Describe trim support by zone reset for zoned devices t/zbd: Add test #58 to test zone reset by trim workload
HOWTO | 8 +++++ engines/libzbc.c | 13 ++++---- fio.1 | 9 +++--- io_u.c | 9 ++++++ t/zbd/test-zbd-support | 26 +++++++++++++++ zbd.c | 85 +++++++++++++++++++++++++++++++++++++++++--------- zbd.h | 2 ++ 7 files changed, 128 insertions(+), 24 deletions(-)
---
Diff of recent changes:
HOWTO +8 -0
@@ -992,6 +992,9 @@ Target file/device single zone. The :option:`zoneskip` parameter is ignored. :option:`zonerange` and :option:`zonesize` must be identical. + Trim is handled using a zone reset operation. + Trim only considers non-empty sequential write + required and sequential write preferred zones. .. option:: zonerange=int
@@ -1965,6 +1968,11 @@ I/O engine character devices. This engine supports trim operations. The sg engine includes engine specific options. + **libzbc** + Read, write, trim and ZBC/ZAC operations to a zoned + block device using libzbc library. The target can be + either an SG character device or a block device file. + **null** Doesn't transfer any data, just pretends to. This is mainly used to exercise fio itself and for debugging/testing purposes.
engines/libzbc.c +7 -6
@@ -14,6 +14,7 @@#include "fio.h" #include "err.h" #include "zbd_types.h" +#include "zbd.h" struct libzbc_data {struct zbc_device *zdev;
@@ -63,7 +64,7 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f,return -EINVAL ; } -if (td_write (td)) { +if (td_write (td) ||td_trim (td)) {if (!read_only) flags |=O_RDWR ; }else if (td_read (td)) {
@@ -71,10 +72,6 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f, flags |=O_RDWR ; else flags |= O_RDONLY; - }else if (td_trim (td)) { -td_verror (td,EINVAL ,"libzbc does not support trim" ); -log_err ("%s: libzbc does not support trim\n" , f->file_name); -return -EINVAL ; }if (td->o.oatomic) {
@@ -411,7 +408,11 @@ static enum fio_q_status libzbc_queue(struct thread_data *td, struct io_u *io_u) ret =zbc_flush (ld->zdev);if (ret)log_err ("zbc_flush error %zd\n" , ret); - }else if (io_u->ddir !=DDIR_TRIM ) { + }else if (io_u->ddir ==DDIR_TRIM ) { + ret =zbd_do_io_u_trim (td, io_u); +if (!ret) + ret =EINVAL ; + }else {log_err ("Unsupported operation %u\n" , io_u->ddir); ret = -EINVAL ; }
fio.1 +5 -4
@@ -766,6 +766,8 @@ starts. The \fBzonecapacity\fR parameter is ignored. Zoned block device mode. I/O happens sequentially in each zone, even if random I/O has been selected. Random I/O happens across all zones instead of being restricted to a single zone. +Trim is handled using a zone reset operation. Trim only considers non-empty +sequential write required and sequential write preferred zones. .RE .RE .TP
@@ -1761,10 +1763,9 @@ character devices. This engine supports trim operations. The sg engine includes engine specific options. .TP .B libzbc -Synchronous I/O engine for SMR hard-disks using the \fBlibzbc\fR -library. The target can be either an sg character device or -a block device file. This engine supports the zonemode=zbd zone -operations. +Read, write, trim and ZBC/ZAC operations to a zoned block device using +\fBlibzbc\fR library. The target can be either an SG character device or +a block device file. .TP .B null Doesn't transfer any data, just pretends to. This is mainly used to
io_u.c +9 -0
@@ -2317,10 +2317,19 @@ int do_io_u_trim(const struct thread_data *td, struct io_u *io_u)struct fio_file *f = io_u->file;int ret; +if (td->o.zone_mode ==ZONE_MODE_ZBD ) { + ret =zbd_do_io_u_trim (td, io_u); +if (ret == io_u_completed) +return io_u->xfer_buflen; +if (ret) + goto err; + } + ret =os_trim (f, io_u->offset, io_u->xfer_buflen);if (!ret)return io_u->xfer_buflen; +err: io_u->error = ret;return 0 ;#endif
t/zbd/test-zbd-support +26 -0
@@ -1215,6 +1215,32 @@ test57() { >> "${logfile}.${test_number}" 2>&1 || return $? } +# Random writes and random trims to sequential write required zones for 30s. +test58() { + local off size bs + + require_seq_zones 128 || return $SKIP_TESTCASE + + size=$((zone_size * 128)) + bs="$(max $((zone_size / 128)) "$logical_block_size")" + prep_write + off=$((first_sequential_zone_sector * 512)) + run_fio --zonemode=zbd --direct=1 --zonesize="${zone_size}" --thread=1 \ + --filename="${dev}" --norandommap=1 \ + --name="precondition" --rw=write "$(ioengine "psync")" \ + --offset="${off}" --size=$((zone_size * 16)) --bs="${bs}" \ + "${job_var_opts[@]}" \ + --name=wjob --wait_for="precondition" --rw=randwrite \ + "$(ioengine "libaio")" --iodepth=8 \ + --offset="${off}" --size="${size}" --bs="${bs}" \ + --time_based --runtime=30s --flow=128 "${job_var_opts[@]}" \ + --name=trimjob --wait_for="precondition" --rw=randtrim \ + "$(ioengine "psync")" \ + --offset="${off}" --size="${size}" --bs="${zone_size}" \ + --time_based --runtime=30s --flow=1 "${job_var_opts[@]}" \ + >>"${logfile}.${test_number}" 2>&1 +} + SECONDS=0 tests=() dynamic_analyzer=()
zbd.c +71 -14
149 lines not on this page · raw message
zbd.h +2 -0
@@ -17,6 +17,7 @@ struct fio_file;enum io_u_action { io_u_accept =0 , io_u_eof =1 , + io_u_completed =2 , };/**
@@ -99,6 +100,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u, enum fio_ddir ddir);enum io_u_action zbd_adjust_block (struct thread_data *td,struct io_u *io_u);char *zbd_write_status (const struct thread_stat *ts); +int zbd_do_io_u_trim (const struct thread_data *td,struct io_u *io_u);static inline void zbd_close_file (struct fio_file *f) {