On Wed, 2021-08-04 at 06:32 +0000, Shinichiro Kawasaki wrote: > Dmitry, thank you for the review comments. > > On Aug 03, 2021 / 19:36, Dmitry Fomichev wrote: > > On Wed, 2021-07-28 at 19:47 +0900, Shin'ichiro Kawasaki wrote: > > > Enable trim workload for zonemode=zbd by modifying do_io_u_trim() > > > to > > > call zoned block device unique function zbd_do_io_u_trim() which > > > resets > > > target zone. This allows fio to emulate workloads which mix data > > > read/write and zone resets with zonemode=zbd. > > > > > > To call reset zones, the trim I/O shall have offset aligned to > > > zone > > > start and block size same as zone size. Reset zone is called only > > > to > > > sequential write required zones and sequential write preferred > > > zones. > > > Conventional zones are handled in same manner as regular block > > > devices > > > by calling os_trim() function. > > > > > > When zones are reset with random trim workload, choose only non- > > > empty > > > zones as trim target. This avoids meaningless trim to empty zones > > > and > > > makes the workload more realistic. To find the non-empty zones, > > > utilize > > > zbd_find_zone() helper function which is already used for read > > > workload, > > > specifying 1 byte as the minimum valid data size. > > > > > > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > > > --- > > > HOWTO | 3 +++ > > > fio.1 | 2 ++ > > > io_u.c | 9 ++++++++ > > > zbd.c | 71 > > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- > > > zbd.h | 2 ++ > > > 5 files changed, 83 insertions(+), 4 deletions(-) > > > > > > diff --git a/HOWTO b/HOWTO > > > index 59c7f1ff..f1fd2045 100644 > > > --- a/HOWTO > > > +++ b/HOWTO > > > @@ -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. > > > > The documentation changes could be moved to a separate patch. While > > looking at HOWTO file, I notice that libzbc is absent from the list > > of > > i/o engines there. Perhaps, since you are making changes to this > > file, > > you could add a small description of libzbc there and mention that > > it > > supports read, write and trim workloads when run against zoned > > block > > devices. > > Okay, I will separate out changes in HOWTO and fio.1 into a patch. > Will > add the description of libzbc i/o engine also. > > > > > > > > > .. option:: zonerange=int > > > > > > diff --git a/fio.1 b/fio.1 > > > index 6cc82542..ef319062 100644 > > > --- a/fio.1 > > > +++ b/fio.1 > > > @@ -766,6 +766,8 @@ starts. The \fBzonecapacity\fR parameter is > > > ignored. > > > Zoned block device mode. I/O happens sequentially in each zone, > > > even > > > if random32ad4373 > > > 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 > > > diff --git a/io_u.c b/io_u.c > > > index 9a1cd547..696d25cd 100644 > > > --- a/io_u.c > > > +++ b/io_u.c > > > @@ -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 > > > diff --git a/zbd.c b/zbd.c > > > index f10b3267..39060ecd 100644 > > > --- a/zbd.cpassing in an offset > > modifier with a value of 8. If the suffix is used with a > > sequential I/O > > I did not catch this part. May I ask to rephrase? Please disregard this, I think my email client (Evolution) had a little glitch while formatting the reply... >