* [PATCH 0/4] improve zbd initialization
@ 2021-06-04 12:18 Niklas Cassel
2021-06-04 12:18 ` [PATCH 1/4] zbd: disallow pipes for zonemode=zbd Niklas Cassel
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Niklas Cassel @ 2021-06-04 12:18 UTC (permalink / raw)
To: axboe@kernel.dk; +Cc: fio@vger.kernel.org, Damien Le Moal, Niklas Cassel
From: Niklas Cassel <niklas.cassel@wdc.com>
Hello there,
This series improves zbd initialization, by making it more robust.
Previously, zbd_create_zone_info() could return success at the same
time as f->zbd_info was never uninitialized.. Remove ZBD_IGNORE to
avoid this combination from being possible.
Also, zonemode=zbd can now be used with regular files by emulating
zones inside the file. (Just like how we already support emulating
zones inside a regular block device).
Kind regards,
Niklas
Niklas Cassel (4):
zbd: disallow pipes for zonemode=zbd
zbd: allow zonemode=zbd with regular files by emulating zones
zbd: remove zbd_zoned_model ZBD_IGNORE
zbd: change some f->zbd_info conditionals to asserts
engines/libzbc.c | 3 +--
engines/skeleton_external.c | 1 -
oslib/linux-blkzoned.c | 3 +--
zbd.c | 37 +++++++++++++++++++++++++------------
zbd_types.h | 7 +++----
5 files changed, 30 insertions(+), 21 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] zbd: disallow pipes for zonemode=zbd
2021-06-04 12:18 [PATCH 0/4] improve zbd initialization Niklas Cassel
@ 2021-06-04 12:18 ` Niklas Cassel
2021-06-05 0:33 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE Niklas Cassel
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Niklas Cassel @ 2021-06-04 12:18 UTC (permalink / raw)
To: axboe@kernel.dk; +Cc: fio@vger.kernel.org, Damien Le Moal, Niklas Cassel
From: Niklas Cassel <niklas.cassel@wdc.com>
zoned block device support in fio cannot handle pipes,
so simply reject them and give a clear error message.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
zbd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/zbd.c b/zbd.c
index 5d9e331a..60325d28 100644
--- a/zbd.c
+++ b/zbd.c
@@ -32,6 +32,11 @@ int zbd_get_zoned_model(struct thread_data *td, struct fio_file *f,
{
int ret;
+ if (f->filetype == FIO_TYPE_PIPE) {
+ log_err("zonemode=zbd does not support pipes\n");
+ return -EINVAL;
+ }
+
if (td->io_ops && td->io_ops->get_zoned_model)
ret = td->io_ops->get_zoned_model(td, f, model);
else
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-04 12:18 [PATCH 0/4] improve zbd initialization Niklas Cassel
2021-06-04 12:18 ` [PATCH 1/4] zbd: disallow pipes for zonemode=zbd Niklas Cassel
@ 2021-06-04 12:18 ` Niklas Cassel
2021-06-05 0:42 ` Damien Le Moal
2021-06-05 0:48 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones Niklas Cassel
2021-06-04 12:18 ` [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts Niklas Cassel
3 siblings, 2 replies; 13+ messages in thread
From: Niklas Cassel @ 2021-06-04 12:18 UTC (permalink / raw)
To: axboe@kernel.dk; +Cc: fio@vger.kernel.org, Damien Le Moal, Niklas Cassel
From: Niklas Cassel <niklas.cassel@wdc.com>
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>
---
engines/libzbc.c | 3 +--
engines/skeleton_external.c | 1 -
oslib/linux-blkzoned.c | 3 +--
zbd.c | 3 +--
zbd_types.h | 7 +++----
5 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/engines/libzbc.c b/engines/libzbc.c
index 3dde93db..c3551bec 100644
--- a/engines/libzbc.c
+++ b/engines/libzbc.c
@@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
int ret;
if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
- *model = ZBD_IGNORE;
- return 0;
+ return -EINVAL;
}
ret = libzbc_open_dev(td, f, &ld);
diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
index c79b6f11..cff83a10 100644
--- a/engines/skeleton_external.c
+++ b/engines/skeleton_external.c
@@ -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
diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
index 6f89ec6f..8cb9c53a 100644
--- a/oslib/linux-blkzoned.c
+++ b/oslib/linux-blkzoned.c
@@ -141,8 +141,7 @@ 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;
+ return -EINVAL;
}
*model = ZBD_NONE;
diff --git a/zbd.c b/zbd.c
index fb20f6cc..7012cb93 100644
--- 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);
diff --git a/zbd_types.h b/zbd_types.h
index d0f4c44e..0a8630cb 100644
--- a/zbd_types.h
+++ b/zbd_types.h
@@ -14,10 +14,9 @@
* 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 */
};
/*
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones
2021-06-04 12:18 [PATCH 0/4] improve zbd initialization Niklas Cassel
2021-06-04 12:18 ` [PATCH 1/4] zbd: disallow pipes for zonemode=zbd Niklas Cassel
2021-06-04 12:18 ` [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE Niklas Cassel
@ 2021-06-04 12:18 ` Niklas Cassel
2021-06-05 0:40 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts Niklas Cassel
3 siblings, 1 reply; 13+ messages in thread
From: Niklas Cassel @ 2021-06-04 12:18 UTC (permalink / raw)
To: axboe@kernel.dk; +Cc: fio@vger.kernel.org, Damien Le Moal, Niklas Cassel
From: Niklas Cassel <niklas.cassel@wdc.com>
Currently when using zonemode=zbd and running against a regular file,
fio will fail with:
fio: file hash not empty on exit
Treat regular files just like how we treat regular (non-zoned) block
devices: return ZBD_NONE and let zbd.c emulate zones inside the regular
file/block device.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
zbd.c | 14 +++++++++++++-
zbd_types.h | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/zbd.c b/zbd.c
index 60325d28..fb20f6cc 100644
--- a/zbd.c
+++ b/zbd.c
@@ -37,6 +37,18 @@ int zbd_get_zoned_model(struct thread_data *td, struct fio_file *f,
return -EINVAL;
}
+ /* If regular file, always emulate zones inside the file. */
+ if (f->filetype == FIO_TYPE_FILE) {
+ if (!f->real_file_size) {
+ log_err("%s: file size cannot be zero\n",
+ f->file_name);
+ return -EINVAL;
+ }
+
+ *model = ZBD_NONE;
+ return 0;
+ }
+
if (td->io_ops && td->io_ops->get_zoned_model)
ret = td->io_ops->get_zoned_model(td, f, model);
else
@@ -414,7 +426,7 @@ static int init_zone_info(struct thread_data *td, struct fio_file *f)
int i;
if (zone_size == 0) {
- log_err("%s: Specifying the zone size is mandatory for regular block devices with --zonemode=zbd\n\n",
+ log_err("%s: Specifying the zone size is mandatory for regular file/block device with --zonemode=zbd\n\n",
f->file_name);
return 1;
}
diff --git a/zbd_types.h b/zbd_types.h
index 5ed41aa0..d0f4c44e 100644
--- a/zbd_types.h
+++ b/zbd_types.h
@@ -15,7 +15,7 @@
*/
enum zbd_zoned_model {
ZBD_IGNORE, /* Ignore file */
- ZBD_NONE, /* Regular block device */
+ ZBD_NONE, /* No zone support. Emulate zones. */
ZBD_HOST_AWARE, /* Host-aware zoned block device */
ZBD_HOST_MANAGED, /* Host-managed zoned block device */
};
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts
2021-06-04 12:18 [PATCH 0/4] improve zbd initialization Niklas Cassel
` (2 preceding siblings ...)
2021-06-04 12:18 ` [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones Niklas Cassel
@ 2021-06-04 12:18 ` Niklas Cassel
2021-06-05 0:50 ` Damien Le Moal
3 siblings, 1 reply; 13+ messages in thread
From: Niklas Cassel @ 2021-06-04 12:18 UTC (permalink / raw)
To: axboe@kernel.dk; +Cc: fio@vger.kernel.org, Damien Le Moal, Niklas Cassel
From: Niklas Cassel <niklas.cassel@wdc.com>
Unfortunately, generic fio code calls some zbd_* functions unconditionally.
These functions will be called regardless if zonemode == ZONE_MODE_NONE,
ZONE_MODE_STRIDED or ZONE_MODE_ZBD, and cannot be optimized.
However, some functions are only called when zonemode == ZONE_MODE_ZBD.
Since f->zbd_info will always be non-NULL for a job with zonemode=zbd,
these functions can be optimized to not check if f->zbd_info is set.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
zbd.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/zbd.c b/zbd.c
index 7012cb93..0a48653c 100644
--- a/zbd.c
+++ b/zbd.c
@@ -808,8 +808,7 @@ int zbd_setup_files(struct thread_data *td)
struct fio_zone_info *z;
int zi;
- if (!zbd)
- continue;
+ assert(zbd);
f->min_zone = zbd_zone_idx(f, f->file_offset);
f->max_zone = zbd_zone_idx(f, f->file_offset + f->io_size);
@@ -1470,8 +1469,7 @@ static void zbd_queue_io(struct thread_data *td, struct io_u *io_u, int q,
uint32_t zone_idx;
uint64_t zone_end;
- if (!zbd_info)
- return;
+ assert(zbd_info);
zone_idx = zbd_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
@@ -1531,8 +1529,7 @@ static void zbd_put_io(struct thread_data *td, const struct io_u *io_u)
struct fio_zone_info *z;
uint32_t zone_idx;
- if (!zbd_info)
- return;
+ assert(zbd_info);
zone_idx = zbd_zone_idx(f, io_u->offset);
assert(zone_idx < zbd_info->nr_zones);
@@ -1588,6 +1585,7 @@ void setup_zbd_zone_mode(struct thread_data *td, struct io_u *io_u)
assert(td->o.zone_mode == ZONE_MODE_ZBD);
assert(td->o.zone_size);
+ assert(f->zbd_info);
zone_idx = zbd_zone_idx(f, f->last_pos[ddir]);
z = get_zone(f, zone_idx);
@@ -1662,6 +1660,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u,
* devices with all empty zones. Overwrite the first I/O direction as
* write to make sure data to read exists.
*/
+ assert(io_u->file->zbd_info);
if (ddir != DDIR_READ || !td_rw(td))
return ddir;
@@ -1691,9 +1690,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
uint64_t new_len;
int64_t range;
- if (!f->zbd_info)
- return io_u_accept;
-
+ assert(f->zbd_info);
assert(min_bs);
assert(is_valid_offset(f, io_u->offset));
assert(io_u->buflen);
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] zbd: disallow pipes for zonemode=zbd
2021-06-04 12:18 ` [PATCH 1/4] zbd: disallow pipes for zonemode=zbd Niklas Cassel
@ 2021-06-05 0:33 ` Damien Le Moal
0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:33 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/04 21:18, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> zoned block device support in fio cannot handle pipes,
> so simply reject them and give a clear error message.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> zbd.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/zbd.c b/zbd.c
> index 5d9e331a..60325d28 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -32,6 +32,11 @@ int zbd_get_zoned_model(struct thread_data *td, struct fio_file *f,
> {
> int ret;
>
> + if (f->filetype == FIO_TYPE_PIPE) {
> + log_err("zonemode=zbd does not support pipes\n");
> + return -EINVAL;
> + }
> +
> if (td->io_ops && td->io_ops->get_zoned_model)
> ret = td->io_ops->get_zoned_model(td, f, model);
> else
>
Looks good.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones
2021-06-04 12:18 ` [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones Niklas Cassel
@ 2021-06-05 0:40 ` Damien Le Moal
0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:40 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/04 21:18, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> Currently when using zonemode=zbd and running against a regular file,
> fio will fail with:
> fio: file hash not empty on exit
>
> Treat regular files just like how we treat regular (non-zoned) block
> devices: return ZBD_NONE and let zbd.c emulate zones inside the regular
> file/block device.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> zbd.c | 14 +++++++++++++-
> zbd_types.h | 2 +-
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/zbd.c b/zbd.c
> index 60325d28..fb20f6cc 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -37,6 +37,18 @@ int zbd_get_zoned_model(struct thread_data *td, struct fio_file *f,
> return -EINVAL;
> }
>
> + /* If regular file, always emulate zones inside the file. */
> + if (f->filetype == FIO_TYPE_FILE) {
> + if (!f->real_file_size) {
> + log_err("%s: file size cannot be zero\n",
> + f->file_name);
> + return -EINVAL;
> + }
This check is not strong enough. The file size must be at least equal to the
zone size. I think this check should go into init_zone_info(). In that function,
the number of zones is calculated as:
nr_zones = (f->real_file_size + zone_size - 1) / zone_size;
And followed with:
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
if (!zbd_info)
return -ENOMEM;
So even if nr_zones is 0 (i.e. f->real_file_size < zone_size), there will be no
errors. We need to check that nr_zones > 0, or that f->real_file_size >=
zone_size, whichever.
> +
> + *model = ZBD_NONE;
> + return 0;
> + }
> +
> if (td->io_ops && td->io_ops->get_zoned_model)
> ret = td->io_ops->get_zoned_model(td, f, model);
> else
> @@ -414,7 +426,7 @@ static int init_zone_info(struct thread_data *td, struct fio_file *f)
> int i;
>
> if (zone_size == 0) {
> - log_err("%s: Specifying the zone size is mandatory for regular block devices with --zonemode=zbd\n\n",
> + log_err("%s: Specifying the zone size is mandatory for regular file/block device with --zonemode=zbd\n\n",
> f->file_name);
> return 1;
> }
> diff --git a/zbd_types.h b/zbd_types.h
> index 5ed41aa0..d0f4c44e 100644
> --- a/zbd_types.h
> +++ b/zbd_types.h
> @@ -15,7 +15,7 @@
> */
> enum zbd_zoned_model {
> ZBD_IGNORE, /* Ignore file */
> - ZBD_NONE, /* Regular block device */
> + ZBD_NONE, /* No zone support. Emulate zones. */
> ZBD_HOST_AWARE, /* Host-aware zoned block device */
> ZBD_HOST_MANAGED, /* Host-managed zoned block device */
> };
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-04 12:18 ` [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE Niklas Cassel
@ 2021-06-05 0:42 ` Damien Le Moal
2021-06-05 0:47 ` Damien Le Moal
2021-06-05 0:48 ` Damien Le Moal
1 sibling, 1 reply; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:42 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/04 21:18, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> 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>
> ---
> engines/libzbc.c | 3 +--
> engines/skeleton_external.c | 1 -
> oslib/linux-blkzoned.c | 3 +--
> zbd.c | 3 +--
> zbd_types.h | 7 +++----
> 5 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/engines/libzbc.c b/engines/libzbc.c
> index 3dde93db..c3551bec 100644
> --- a/engines/libzbc.c
> +++ b/engines/libzbc.c
> @@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
> int ret;
>
> if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
> - *model = ZBD_IGNORE;
> - return 0;
> + return -EINVAL;
> }
>
> ret = libzbc_open_dev(td, f, &ld);
> diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
> index c79b6f11..cff83a10 100644
> --- a/engines/skeleton_external.c
> +++ b/engines/skeleton_external.c
> @@ -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
> diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
> index 6f89ec6f..8cb9c53a 100644
> --- a/oslib/linux-blkzoned.c
> +++ b/oslib/linux-blkzoned.c
> @@ -141,8 +141,7 @@ 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;
> + return -EINVAL;
> }
>
> *model = ZBD_NONE;
> diff --git a/zbd.c b/zbd.c
> index fb20f6cc..7012cb93 100644
> --- 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);
> diff --git a/zbd_types.h b/zbd_types.h
> index d0f4c44e..0a8630cb 100644
> --- a/zbd_types.h
> +++ b/zbd_types.h
> @@ -14,10 +14,9 @@
> * 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 */
> };
>
> /*
>
Looks good.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-05 0:42 ` Damien Le Moal
@ 2021-06-05 0:47 ` Damien Le Moal
0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:47 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/05 9:42, Damien Le Moal wrote:
> On 2021/06/04 21:18, Niklas Cassel wrote:
>> From: Niklas Cassel <niklas.cassel@wdc.com>
>>
>> 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>
>> ---
>> engines/libzbc.c | 3 +--
>> engines/skeleton_external.c | 1 -
>> oslib/linux-blkzoned.c | 3 +--
>> zbd.c | 3 +--
>> zbd_types.h | 7 +++----
>> 5 files changed, 6 insertions(+), 11 deletions(-)
>>
>> diff --git a/engines/libzbc.c b/engines/libzbc.c
>> index 3dde93db..c3551bec 100644
>> --- a/engines/libzbc.c
>> +++ b/engines/libzbc.c
>> @@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
>> int ret;
>>
>> if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
>> - *model = ZBD_IGNORE;
>> - return 0;
>> + return -EINVAL;
>> }
>>
>> ret = libzbc_open_dev(td, f, &ld);
>> diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
>> index c79b6f11..cff83a10 100644
>> --- a/engines/skeleton_external.c
>> +++ b/engines/skeleton_external.c
>> @@ -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
>> diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
>> index 6f89ec6f..8cb9c53a 100644
>> --- a/oslib/linux-blkzoned.c
>> +++ b/oslib/linux-blkzoned.c
>> @@ -141,8 +141,7 @@ 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;
>> + return -EINVAL;
>> }
>>
>> *model = ZBD_NONE;
>> diff --git a/zbd.c b/zbd.c
>> index fb20f6cc..7012cb93 100644
>> --- 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);
>> diff --git a/zbd_types.h b/zbd_types.h
>> index d0f4c44e..0a8630cb 100644
>> --- a/zbd_types.h
>> +++ b/zbd_types.h
>> @@ -14,10 +14,9 @@
>> * 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 */
>> };
>>
>> /*
>>
>
> Looks good.
>
> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Scrap this. Rereading the patch and code, I have comments.
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-04 12:18 ` [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE Niklas Cassel
2021-06-05 0:42 ` Damien Le Moal
@ 2021-06-05 0:48 ` Damien Le Moal
2021-06-07 9:08 ` Niklas Cassel
1 sibling, 1 reply; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:48 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/04 21:18, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> 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>
> ---
> engines/libzbc.c | 3 +--
> engines/skeleton_external.c | 1 -
> oslib/linux-blkzoned.c | 3 +--
> zbd.c | 3 +--
> zbd_types.h | 7 +++----
> 5 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/engines/libzbc.c b/engines/libzbc.c
> index 3dde93db..c3551bec 100644
> --- a/engines/libzbc.c
> +++ b/engines/libzbc.c
> @@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
> int ret;
>
> if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
> - *model = ZBD_IGNORE;
> - return 0;
> + return -EINVAL;
> }
Please drop the curly brackets.
>
> ret = libzbc_open_dev(td, f, &ld);
> diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
> index c79b6f11..cff83a10 100644
> --- a/engines/skeleton_external.c
> +++ b/engines/skeleton_external.c
> @@ -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
> diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
> index 6f89ec6f..8cb9c53a 100644
> --- a/oslib/linux-blkzoned.c
> +++ b/oslib/linux-blkzoned.c
> @@ -141,8 +141,7 @@ 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;
> + return -EINVAL;
> }
Please drop the curly brackets.
Also, missing in this patch: zbd_verify_sizes() has a "if (!f->zbd_info)" check
which I think should be changed into an assert.
>
> *model = ZBD_NONE;
> diff --git a/zbd.c b/zbd.c
> index fb20f6cc..7012cb93 100644
> --- 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);
> diff --git a/zbd_types.h b/zbd_types.h
> index d0f4c44e..0a8630cb 100644
> --- a/zbd_types.h
> +++ b/zbd_types.h
> @@ -14,10 +14,9 @@
> * 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 */
> };
>
> /*
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts
2021-06-04 12:18 ` [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts Niklas Cassel
@ 2021-06-05 0:50 ` Damien Le Moal
0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2021-06-05 0:50 UTC (permalink / raw)
To: Niklas Cassel, axboe@kernel.dk; +Cc: fio@vger.kernel.org
On 2021/06/04 21:18, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> Unfortunately, generic fio code calls some zbd_* functions unconditionally.
> These functions will be called regardless if zonemode == ZONE_MODE_NONE,
> ZONE_MODE_STRIDED or ZONE_MODE_ZBD, and cannot be optimized.
>
> However, some functions are only called when zonemode == ZONE_MODE_ZBD.
> Since f->zbd_info will always be non-NULL for a job with zonemode=zbd,
> these functions can be optimized to not check if f->zbd_info is set.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> zbd.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/zbd.c b/zbd.c
> index 7012cb93..0a48653c 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -808,8 +808,7 @@ int zbd_setup_files(struct thread_data *td)
> struct fio_zone_info *z;
> int zi;
>
> - if (!zbd)
> - continue;
> + assert(zbd);
>
> f->min_zone = zbd_zone_idx(f, f->file_offset);
> f->max_zone = zbd_zone_idx(f, f->file_offset + f->io_size);
> @@ -1470,8 +1469,7 @@ static void zbd_queue_io(struct thread_data *td, struct io_u *io_u, int q,
> uint32_t zone_idx;
> uint64_t zone_end;
>
> - if (!zbd_info)
> - return;
> + assert(zbd_info);
>
> zone_idx = zbd_zone_idx(f, io_u->offset);
> assert(zone_idx < zbd_info->nr_zones);
> @@ -1531,8 +1529,7 @@ static void zbd_put_io(struct thread_data *td, const struct io_u *io_u)
> struct fio_zone_info *z;
> uint32_t zone_idx;
>
> - if (!zbd_info)
> - return;
> + assert(zbd_info);
>
> zone_idx = zbd_zone_idx(f, io_u->offset);
> assert(zone_idx < zbd_info->nr_zones);
> @@ -1588,6 +1585,7 @@ void setup_zbd_zone_mode(struct thread_data *td, struct io_u *io_u)
>
> assert(td->o.zone_mode == ZONE_MODE_ZBD);
> assert(td->o.zone_size);
> + assert(f->zbd_info);
>
> zone_idx = zbd_zone_idx(f, f->last_pos[ddir]);
> z = get_zone(f, zone_idx);
> @@ -1662,6 +1660,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u,
> * devices with all empty zones. Overwrite the first I/O direction as
> * write to make sure data to read exists.
> */
> + assert(io_u->file->zbd_info);
> if (ddir != DDIR_READ || !td_rw(td))
> return ddir;
>
> @@ -1691,9 +1690,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
> uint64_t new_len;
> int64_t range;
>
> - if (!f->zbd_info)
> - return io_u_accept;
> -
> + assert(f->zbd_info);
> assert(min_bs);
> assert(is_valid_offset(f, io_u->offset));
> assert(io_u->buflen);
>
Looks good.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-05 0:48 ` Damien Le Moal
@ 2021-06-07 9:08 ` Niklas Cassel
2021-06-07 9:18 ` Damien Le Moal
0 siblings, 1 reply; 13+ messages in thread
From: Niklas Cassel @ 2021-06-07 9:08 UTC (permalink / raw)
To: Damien Le Moal; +Cc: axboe@kernel.dk, fio@vger.kernel.org
On Sat, Jun 05, 2021 at 12:48:31AM +0000, Damien Le Moal wrote:
> On 2021/06/04 21:18, Niklas Cassel wrote:
> > From: Niklas Cassel <niklas.cassel@wdc.com>
> >
> > 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>
> > ---
> > engines/libzbc.c | 3 +--
> > engines/skeleton_external.c | 1 -
> > oslib/linux-blkzoned.c | 3 +--
> > zbd.c | 3 +--
> > zbd_types.h | 7 +++----
> > 5 files changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/engines/libzbc.c b/engines/libzbc.c
> > index 3dde93db..c3551bec 100644
> > --- a/engines/libzbc.c
> > +++ b/engines/libzbc.c
> > @@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
> > int ret;
> >
> > if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
> > - *model = ZBD_IGNORE;
> > - return 0;
> > + return -EINVAL;
> > }
>
> Please drop the curly brackets.
>
> >
> > ret = libzbc_open_dev(td, f, &ld);
> > diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
> > index c79b6f11..cff83a10 100644
> > --- a/engines/skeleton_external.c
> > +++ b/engines/skeleton_external.c
> > @@ -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
> > diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
> > index 6f89ec6f..8cb9c53a 100644
> > --- a/oslib/linux-blkzoned.c
> > +++ b/oslib/linux-blkzoned.c
> > @@ -141,8 +141,7 @@ 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;
> > + return -EINVAL;
> > }
>
> Please drop the curly brackets.
>
> Also, missing in this patch: zbd_verify_sizes() has a "if (!f->zbd_info)" check
> which I think should be changed into an assert.
Hello Damien,
zbd_verify_sizes()
does a:
for_each_td() {
for_each_file() {
if (!f->zbd_info)
continue;
}
}
Considering that this is a for_each_td(), which will iterate over all
threads in the job file, I disagree with this comment.
A job file can have one job with
zonemode=zbd
and in the same job file, another job without zonemode=zbd, which targets
a completely different device, so I do think that we need to keep the
continue here.
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE
2021-06-07 9:08 ` Niklas Cassel
@ 2021-06-07 9:18 ` Damien Le Moal
0 siblings, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2021-06-07 9:18 UTC (permalink / raw)
To: Niklas Cassel; +Cc: axboe@kernel.dk, fio@vger.kernel.org
On 2021/06/07 18:08, Niklas Cassel wrote:
> On Sat, Jun 05, 2021 at 12:48:31AM +0000, Damien Le Moal wrote:
>> On 2021/06/04 21:18, Niklas Cassel wrote:
>>> From: Niklas Cassel <niklas.cassel@wdc.com>
>>>
>>> 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>
>>> ---
>>> engines/libzbc.c | 3 +--
>>> engines/skeleton_external.c | 1 -
>>> oslib/linux-blkzoned.c | 3 +--
>>> zbd.c | 3 +--
>>> zbd_types.h | 7 +++----
>>> 5 files changed, 6 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/engines/libzbc.c b/engines/libzbc.c
>>> index 3dde93db..c3551bec 100644
>>> --- a/engines/libzbc.c
>>> +++ b/engines/libzbc.c
>>> @@ -181,8 +181,7 @@ static int libzbc_get_zoned_model(struct thread_data *td, struct fio_file *f,
>>> int ret;
>>>
>>> if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
>>> - *model = ZBD_IGNORE;
>>> - return 0;
>>> + return -EINVAL;
>>> }
>>
>> Please drop the curly brackets.
>>
>>>
>>> ret = libzbc_open_dev(td, f, &ld);
>>> diff --git a/engines/skeleton_external.c b/engines/skeleton_external.c
>>> index c79b6f11..cff83a10 100644
>>> --- a/engines/skeleton_external.c
>>> +++ b/engines/skeleton_external.c
>>> @@ -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
>>> diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
>>> index 6f89ec6f..8cb9c53a 100644
>>> --- a/oslib/linux-blkzoned.c
>>> +++ b/oslib/linux-blkzoned.c
>>> @@ -141,8 +141,7 @@ 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;
>>> + return -EINVAL;
>>> }
>>
>> Please drop the curly brackets.
>>
>> Also, missing in this patch: zbd_verify_sizes() has a "if (!f->zbd_info)" check
>> which I think should be changed into an assert.
>
> Hello Damien,
>
> zbd_verify_sizes()
> does a:
>
> for_each_td() {
> for_each_file() {
> if (!f->zbd_info)
> continue;
> }
> }
>
> Considering that this is a for_each_td(), which will iterate over all
> threads in the job file, I disagree with this comment.
>
> A job file can have one job with
> zonemode=zbd
>
> and in the same job file, another job without zonemode=zbd, which targets
> a completely different device, so I do think that we need to keep the
> continue here.
Indeed. You are right.
>
>
> Kind regards,
> Niklas
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-06-07 9:18 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-04 12:18 [PATCH 0/4] improve zbd initialization Niklas Cassel
2021-06-04 12:18 ` [PATCH 1/4] zbd: disallow pipes for zonemode=zbd Niklas Cassel
2021-06-05 0:33 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 3/4] zbd: remove zbd_zoned_model ZBD_IGNORE Niklas Cassel
2021-06-05 0:42 ` Damien Le Moal
2021-06-05 0:47 ` Damien Le Moal
2021-06-05 0:48 ` Damien Le Moal
2021-06-07 9:08 ` Niklas Cassel
2021-06-07 9:18 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 2/4] zbd: allow zonemode=zbd with regular files by emulating zones Niklas Cassel
2021-06-05 0:40 ` Damien Le Moal
2021-06-04 12:18 ` [PATCH 4/4] zbd: change some f->zbd_info conditionals to asserts Niklas Cassel
2021-06-05 0:50 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox