Recent changes (master)
The following changes since commit 04361e9a23d6e0448fd6fbbd4e14ecdfff60e314:
Merge branch 'patch-3' of https://github.com/yangjueji/fio (2023-07-15 09:57:43 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to caf7ac7ef000097765b1c56404adb5e68b227977:
t/zbd: add max_active configs to run-tests-against-nullb (2023-07-20 09:52:37 -0400)
----------------------------------------------------------------
Dmitry Fomichev (2):
t/zbd: fix null_blk configuration in run-tests-against-nullb t/zbd: add max_active configs to run-tests-against-nullb
Shin'ichiro Kawasaki (11):
zbd: get max_active_zones limit value from zoned devices
zbd: write to closed zones on the devices with max_active_zones limit
zbd: print max_active_zones limit error message
docs: modify max_open_zones option description
t/zbd: add close_zone helper function
t/zbd: add max_active_zone variable
t/zbd: add test case to check zones in closed condition t/zbd: add test case to check max_active_zones limit error message t/zbd: get max_open_zones from sysfs
t/zbd: fix fio failure check and SG node failure in test case 31 t/zbd: add missing prep_write for test cases with write workloads
HOWTO.rst | 44 +++++---- fio.1 | 36 +++++--- io_u.c | 2 + ioengines.h | 4 +- oslib/blkzoned.h | 9 ++ oslib/linux-blkzoned.c | 23 +++++ t/zbd/functions | 33 ++++++- t/zbd/run-tests-against-nullb | 203 ++++++++++++++++++++++++++++++++++++++++-- t/zbd/test-zbd-support | 91 ++++++++++++++++++- zbd.c | 47 +++++++++- zbd.h | 5 ++ 11 files changed, 457 insertions(+), 40 deletions(-)
---
Diff of recent changes:
HOWTO.rst +28 -16
@@ -1056,22 +1056,34 @@ Target file/device .. option:: max_open_zones=int - A zone of a zoned block device is in the open state when it is partially - written (i.e. not all sectors of the zone have been written). Zoned - block devices may have a limit on the total number of zones that can - be simultaneously in the open state, that is, the number of zones that - can be written to simultaneously. The :option:`max_open_zones` parameter - limits the number of zones to which write commands are issued by all fio - jobs, that is, limits the number of zones that will be in the open - state. This parameter is relevant only if the :option:`zonemode` =zbd is - used. The default value is always equal to maximum number of open zones - of the target zoned block device and a value higher than this limit - cannot be specified by users unless the option - :option:`ignore_zone_limits` is specified. When - :option:`ignore_zone_limits` is specified or the target device has no - limit on the number of zones that can be in an open state, - :option:`max_open_zones` can specify 0 to disable any limit on the - number of zones that can be simultaneously written to by all jobs. + When a zone of a zoned block device is partially written (i.e. not all + sectors of the zone have been written), the zone is in one of three + conditions: 'implicit open', 'explicit open' or 'closed'. Zoned block + devices may have a limit called 'max_open_zones' (same name as the + parameter) on the total number of zones that can simultaneously be in + the 'implicit open' or 'explicit open' conditions. Zoned block devices + may have another limit called 'max_active_zones', on the total number of + zones that can simultaneously be in the three conditions. The + :option:`max_open_zones` parameter limits the number of zones to which + write commands are issued by all fio jobs, that is, limits the number of + zones that will be in the conditions. When the device has the + max_open_zones limit and does not have the max_active_zones limit, the + :option:`max_open_zones` parameter limits the number of zones in the two + open conditions up to the limit. In this case, fio includes zones in the + two open conditions to the write target zones at fio start. When the + device has both the max_open_zones and the max_active_zones limits, the + :option:`max_open_zones` parameter limits the number of zones in the + three conditions up to the limit. In this case, fio includes zones in + the three conditions to the write target zones at fio start. + + This parameter is relevant only if the :option:`zonemode` =zbd is used. + The default value is always equal to the max_open_zones limit of the + target zoned block device and a value higher than this limit cannot be + specified by users unless the option :option:`ignore_zone_limits` is + specified. When :option:`ignore_zone_limits` is specified or the target + device does not have the max_open_zones limit, :option:`max_open_zones` + can specify 0 to disable any limit on the number of zones that can be + simultaneously written to by all jobs. .. option:: job_max_open_zones=int
fio.1 +24 -12
@@ -832,18 +832,30 @@ numbers fio only reads beyond the write pointer if explicitly told to do so. Default: false. .TP .BI max_open_zones \fR=\fPint -A zone of a zoned block device is in the open state when it is partially written -(i.e. not all sectors of the zone have been written). Zoned block devices may -have limit a on the total number of zones that can be simultaneously in the -open state, that is, the number of zones that can be written to simultaneously. -The \fBmax_open_zones\fR parameter limits the number of zones to which write -commands are issued by all fio jobs, that is, limits the number of zones that -will be in the open state. This parameter is relevant only if the -\fBzonemode=zbd\fR is used. The default value is always equal to maximum number -of open zones of the target zoned block device and a value higher than this -limit cannot be specified by users unless the option \fBignore_zone_limits\fR is -specified. When \fBignore_zone_limits\fR is specified or the target device has -no limit on the number of zones that can be in an open state, +When a zone of a zoned block device is partially written (i.e. not all sectors +of the zone have been written), the zone is in one of three +conditions: 'implicit open', 'explicit open' or 'closed'. Zoned block devices +may have a limit called 'max_open_zones' (same name as the parameter) on the +total number of zones that can simultaneously be in the 'implicit open' +or 'explicit open' conditions. Zoned block devices may have another limit +called 'max_active_zones', on the total number of zones that can simultaneously +be in the three conditions. The \fBmax_open_zones\fR parameter limits +the number of zones to which write commands are issued by all fio jobs, that is, +limits the number of zones that will be in the conditions. When the device has +the max_open_zones limit and does not have the max_active_zones limit, the +\fBmax_open_zones\fR parameter limits the number of zones in the two open +conditions up to the limit. In this case, fio includes zones in the two open +conditions to the write target zones at fio start. When the device has both the +max_open_zones and the max_active_zones limits, the \fBmax_open_zones\fR +parameter limits the number of zones in the three conditions up to the limit. +In this case, fio includes zones in the three conditions to the write target +zones at fio start. + +This parameter is relevant only if the \fBzonemode=zbd\fR is used. The default +value is always equal to the max_open_zones limit of the target zoned block +device and a value higher than this limit cannot be specified by users unless +the option \fBignore_zone_limits\fR is specified. When \fBignore_zone_limits\fR +is specified or the target device does not have the max_open_zones limit, \fBmax_open_zones\fR can specify 0 to disable any limit on the number of zones that can be simultaneously written to by all jobs. .TP
io_u.c +2 -0
@@ -1879,6 +1879,8 @@ static void __io_u_log_error(struct thread_data *td, struct io_u *io_u)io_ddir_name (io_u->ddir), io_u->offset, io_u->xfer_buflen); +zbd_log_err (td, io_u); +if (td->io_ops->errdetails) {char *err = td->io_ops->errdetails (io_u);
ioengines.h +3 -1
@@ -9,7 +9,7 @@#include "zbd_types.h" #include "fdp.h" -#define FIO_IOOPS_VERSION 32 +#define FIO_IOOPS_VERSION 33#ifndef CONFIG_DYNAMIC_ENGINES #define FIO_STATIC static
@@ -62,6 +62,8 @@ struct ioengine_ops { uint64_t, uint64_t);int (*get_max_open_zones)(struct thread_data *,struct fio_file *,unsigned int *); +int (*get_max_active_zones)(struct thread_data *,struct fio_file *, +unsigned int *);int (*finish_zone)(struct thread_data *,struct fio_file *,uint64_t ,uint64_t ); int (*fdp_fetch_ruhs)(struct thread_data *, struct fio_file *,
oslib/blkzoned.h +9 -0
@@ -18,6 +18,9 @@ extern int blkzoned_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, uint64_t length);extern int blkzoned_get_max_open_zones (struct thread_data *td,struct fio_file *f,unsigned int *max_open_zones); +extern int blkzoned_get_max_active_zones (struct thread_data *td, +struct fio_file *f, +unsigned int *max_active_zones);extern int blkzoned_finish_zone (struct thread_data *td,struct fio_file *f,uint64_t offset,uint64_t length);#else
@@ -53,6 +56,12 @@ static inline int blkzoned_get_max_open_zones(struct thread_data *td, struct fio {return -EIO ; } +static inline int blkzoned_get_max_active_zones (struct thread_data *td, +struct fio_file *f, +unsigned int *max_open_zones) +{ +return -EIO ; +}static inline int blkzoned_finish_zone (struct thread_data *td,struct fio_file *f,uint64_t offset,uint64_t length)
oslib/linux-blkzoned.c +23 -0
@@ -186,6 +186,29 @@ int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,return 0 ; } +int blkzoned_get_max_active_zones (struct thread_data *td,struct fio_file *f, +unsigned int *max_active_zones) +{ +char *max_active_str; + +if (f->filetype !=FIO_TYPE_BLOCK ) +return -EIO ; + + max_active_str =blkzoned_get_sysfs_attr (f->file_name,"queue/max_active_zones" ); +if (!max_active_str) { + *max_active_zones =0 ; +return 0 ; + } + +dprint (FD_ZBD ,"%s: max active zones supported by device: %s\n" , + f->file_name, max_active_str); + *max_active_zones =atoll (max_active_str); + +free (max_active_str); + +return 0 ; +} +static uint64_t zone_capacity (struct blk_zone_report *hdr,struct blk_zone *blkz) {
t/zbd/functions +32 -1
@@ -4,6 +4,7 @@ blkzone=$(type -p blkzone 2>/dev/null) sg_inq=$(type -p sg_inq 2>/dev/null) zbc_report_zones=$(type -p zbc_report_zones 2>/dev/null) zbc_reset_zone=$(type -p zbc_reset_zone 2>/dev/null) +zbc_close_zone=$(type -p zbc_close_zone 2>/dev/null) zbc_info=$(type -p zbc_info 2>/dev/null) if [ -z "${blkzone}" ] && { [ -z "${zbc_report_zones}" ] || [ -z "${zbc_reset_zone}" ]; }; then
@@ -211,8 +212,14 @@ last_online_zone() { # max_open_zones in sysfs, or which lacks zoned block device support completely. max_open_zones() { local dev=$1 + local realdev syspath - if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then + realdev=$(readlink -f "$dev") + syspath=/sys/block/${realdev##*/}/queue/max_open_zones + + if [ -b "${realdev}" ] && [ -r "${syspath}" ]; then + cat ${syspath} + elif [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" \ > /dev/null 2>&1; then # When sg_inq can not get max open zones, specify 0 which indicates
@@ -238,6 +245,18 @@ max_open_zones() { fi } +# If sysfs provides, get max_active_zones limit of the zoned block device. +max_active_zones() { + local dev=$1 + local sys_queue="/sys/block/${dev##*/}/queue/" + + if [[ -e "$sys_queue/max_active_zones" ]]; then + cat "$sys_queue/max_active_zones" + return + fi + echo 0 +} + # Get minimum block size to write to seq zones. Refer the sysfs attribute # zone_write_granularity which shows the valid minimum size regardless of zoned # block device type. If the sysfs attribute is not available, refer physical
@@ -304,6 +323,18 @@ reset_zone() { fi } +# Close the zone on device $1 at offset $2. The offset must be specified in +# units of 512 byte sectors. +close_zone() { + local dev=$1 offset=$2 + + if [ -n "${blkzone}" ] && [ -z "${use_libzbc}" ]; then + ${blkzone} close -o "${offset}" -c 1 "$dev" + else + ${zbc_close_zone} -sector "$dev" "${offset}" >/dev/null + fi +} + # Extract the number of bytes that have been transferred from a line like # READ: bw=6847KiB/s (7011kB/s), 6847KiB/s-6847KiB/s (7011kB/s-7011kB/s), io=257MiB (269MB), run=38406-38406msec fio_io() {
t/zbd/run-tests-against-nullb +196 -7
315 lines not on this page · raw message
t/zbd/test-zbd-support +89 -2
152 lines not on this page · raw message
zbd.c +46 -1
68 lines not on this page · raw message
zbd.h +5 -0
@@ -52,6 +52,9 @@ struct fio_zone_info {* are simultaneously written. A zero value means unlimited zones of * simultaneous writes and that write target zones will not be tracked in * the write_zones array. +* @max_active_zones: device side limit on the number of sequential write zones +* in open or closed conditions. A zero value means unlimited number of +* zones in the conditions. * @mutex: Protects the modifiable members in this structure (refcount and * num_open_zones). * @zone_size: size of a single zone in bytes.
@@ -75,6 +78,7 @@ struct fio_zone_info {struct zoned_block_device_info {enum zbd_zoned_model model;uint32_t max_write_zones; +uint32_t max_active_zones;pthread_mutex_t mutex;uint64_t zone_size;uint64_t wp_valid_data_bytes;
@@ -101,6 +105,7 @@ enum fio_ddir zbd_adjust_ddir(struct thread_data *td, struct io_u *io_u,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 (struct thread_data *td,struct io_u *io_u); +void zbd_log_err (const struct thread_data *td,const struct io_u *io_u);static inline void zbd_close_file (struct fio_file *f) {