zbd: Avoid excessive zone resets
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 30 Oct 2020 06:57:39 +0000 (15:57 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 30 Oct 2020 13:24:58 +0000 (07:24 -0600)
When zbd_reset_zone() is called for a zone repeatedly, reset zone command
is issued multiple times to a single zone even though its status is
empty. This is excessive and meaningless. Especially when zones are reset
at file set up with multiple jobs, zone reset is repeated for each job
and delays fio work load start.

To avoid the repeated zone resets, check the write pointer of the zone
before issuing zone reset command. If the write pointer is at the zone
start, do not reset the zone and just return.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index 905c0c2b4323b7297aaac22ca9ad7c73661c603c..9327816aaf8f8eb68f7f971eb8958b9fbcf0e616 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -718,6 +718,9 @@ static int zbd_reset_zone(struct thread_data *td, struct fio_file *f,
        uint64_t length = (z+1)->start - offset;
        int ret = 0;
 
+       if (z->wp == z->start)
+               return 0;
+
        assert(is_valid_offset(f, offset + length - 1));
 
        dprint(FD_ZBD, "%s: resetting wp of zone %u.\n", f->file_name,