zbd: remove zbd_zoned_model ZBD_IGNORE
authorNiklas Cassel <niklas.cassel@wdc.com>
Mon, 14 Jun 2021 13:49:04 +0000 (13:49 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 14 Jun 2021 14:54:51 +0000 (08:54 -0600)
For a job with zonemode=zbd, we do not want any file to be ignored.
Each file's file type in that job should be supported by either zbd.c
or the ioengine. If not, we should return an error.
This way, ZBD_IGNORE becomes redundant and can be removed.

By removing ZBD_IGNORE, we know that all files belonging to a job that
has zonemode=zbd set, will either be a zoned block device, or emulate
a zoned block device.

This means that for jobs that have zonemode=zbd, f->zbd_info will always
be non-NULL. This will make the zbd code slightly easier to reason about
and to maintain.

When removing zbd_zoned_model ZBD_IGNORE, define the new first enum value
as 0x1, so that we avoid potential ABI problems with existing binaries.

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>
engines/libzbc.c
engines/skeleton_external.c
oslib/linux-blkzoned.c
zbd.c
zbd_types.h

index 3dde93db54713dbe884a2c6b9d2708ee1af4e01e..7f2bc431b4352f7f3472fd00b63c268b823dbe64 100644 (file)
@@ -180,10 +180,8 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
        struct libzbc_data *ld;
        int ret;
 
-       if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
-               *model = ZBD_IGNORE;
-               return 0;
-       }
+       if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR)
+               return -EINVAL;
 
        ret = libzbc_open_dev(td, f, &ld);
        if (ret)
index c79b6f11146ff5ed7844f54da6ee03c3fbf971ac..cff83a10ef6c2631f6df2045bec6f4ffe6a238d8 100644 (file)
@@ -156,7 +156,6 @@ static int fio_skeleton_close(struct thread_data *td, struct fio_file *f)
 /*
  * Hook for getting the zoned model of a zoned block device for zonemode=zbd.
  * The zoned model can be one of (see zbd_types.h):
- * - ZBD_IGNORE: skip regular files
  * - ZBD_NONE: regular block device (zone emulation will be used)
  * - ZBD_HOST_AWARE: host aware zoned block device
  * - ZBD_HOST_MANAGED: host managed zoned block device
index 6f89ec6f414e63c6a9bf6691a10dfc6723a29451..4e441d29b8de2b4173684f8f5d79744192dd0bff 100644 (file)
@@ -140,10 +140,8 @@ int blkzoned_get_zoned_model(struct thread_data *td, struct fio_file *f,
 {
        char *model_str = NULL;
 
-       if (f->filetype != FIO_TYPE_BLOCK) {
-               *model = ZBD_IGNORE;
-               return 0;
-       }
+       if (f->filetype != FIO_TYPE_BLOCK)
+               return -EINVAL;
 
        *model = ZBD_NONE;
 
diff --git a/zbd.c b/zbd.c
index d1db9adc296a74a1bcd53203b7370eb767246406..aab4d741365b952743422a9c1b16fad6716f6aab 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -661,8 +661,6 @@ static int zbd_create_zone_info(struct thread_data *td, struct fio_file *f)
                return ret;
 
        switch (zbd_model) {
-       case ZBD_IGNORE:
-               return 0;
        case ZBD_HOST_AWARE:
        case ZBD_HOST_MANAGED:
                ret = parse_zone_info(td, f);
@@ -680,6 +678,7 @@ static int zbd_create_zone_info(struct thread_data *td, struct fio_file *f)
                return -EINVAL;
        }
 
+       assert(f->zbd_info);
        f->zbd_info->model = zbd_model;
 
        ret = zbd_set_max_open_zones(td, f);
index d0f4c44e23d1abd7a5289f1fb2770e3a9254a6a2..0a8630cb71adf6dc596e579b577ae8da6b03c9d5 100644 (file)
  * Zoned block device models.
  */
 enum zbd_zoned_model {
-       ZBD_IGNORE,             /* Ignore file */
-       ZBD_NONE,               /* No zone support. Emulate zones. */
-       ZBD_HOST_AWARE,         /* Host-aware zoned block device */
-       ZBD_HOST_MANAGED,       /* Host-managed zoned block device */
+       ZBD_NONE                = 0x1,  /* No zone support. Emulate zones. */
+       ZBD_HOST_AWARE          = 0x2,  /* Host-aware zoned block device */
+       ZBD_HOST_MANAGED        = 0x3,  /* Host-managed zoned block device */
 };
 
 /*