Recent changes (master)
The following changes since commit 8e2b81b854286f32eae7951a434dddebd968f9d5:
zbd: Support finishing zones on Android (2023-07-05 15:48:11 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 270316dd2566346a12cfdf3cbe9996a88307f87d:
Merge branch 'master' of https://github.com/bvanassche/fio (2023-07-13 15:28:20 -0600)
----------------------------------------------------------------
Ankit Kumar (4):
fdp: use macros
fdp: fix placement id check
fdp: support random placement id selection
engines/xnvme: add support for fdp
Bart Van Assche (5):
diskutil: Improve disk utilization data structure documentation
diskutil: Remove casts from get_io_ticks()
diskutil: Simplify get_io_ticks()
diskutil: Fix a debug statement in get_io_ticks()
diskutil: Report how many sectors have been read and written
Jens Axboe (1):
Merge branch 'master' of https://github.com/bvanassche/fio
Vincent Fu (1):
options: add code for FDP pli selection use in client/server mode
HOWTO.rst | 23 +++++++++++++-- cconv.c | 2 ++ configure | 2 +- diskutil.c | 29 +++++++------------ diskutil.h | 12 +++++++- engines/io_uring.c | 2 +- engines/xnvme.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++- examples/xnvme-fdp.fio | 36 +++++++++++++++++++++++ fdp.c | 22 ++++++++------ fdp.h | 13 +++++++++ fio.1 | 22 ++++++++++++-- fio.h | 2 ++ init.c | 2 ++ options.c | 20 +++++++++++++ stat.c | 7 +++-- thread_options.h | 2 ++ 16 files changed, 236 insertions(+), 38 deletions(-) create mode 100644 examples/xnvme-fdp.fio
---
Diff of recent changes:
HOWTO.rst +20 -3
@@ -2431,11 +2431,26 @@ with the caveat that when used on the command line, they must come after the For direct I/O, requests will only succeed if cache invalidation isn't required, file blocks are fully allocated and the disk request could be issued immediately. -.. option:: fdp=bool : [io_uring_cmd] +.. option:: fdp=bool : [io_uring_cmd] [xnvme] Enable Flexible Data Placement mode for write commands. -.. option:: fdp_pli=str : [io_uring_cmd] +.. option:: fdp_pli_select=str : [io_uring_cmd] [xnvme] + + Defines how fio decides which placement ID to use next. The following + types are defined: + + **random** + Choose a placement ID at random (uniform). + + **roundrobin** + Round robin over available placement IDs. This is the + default. + + The available placement ID index/indices is defined by the option + :option:`fdp_pli`. + +.. option:: fdp_pli=str : [io_uring_cmd] [xnvme] Select which Placement ID Index/Indicies this job is allowed to use for writes. By default, the job will cycle through all available Placement
@@ -4513,13 +4528,15 @@ For each data direction it prints: And finally, the disk statistics are printed. This is Linux specific. They will look like this:: Disk stats (read/write): - sda: ios=16398/16511, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00% + sda: ios=16398/16511, sectors=32321/65472, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00% Each value is printed for both reads and writes, with reads first. The numbers denote: **ios** Number of I/Os performed by all groups. +**sectors** + Amount of data transferred in units of 512 bytes for all groups. **merge** Number of merges performed by the I/O scheduler. **ticks**
cconv.c +2 -0
@@ -351,6 +351,7 @@ int convert_thread_options_to_cpu(struct thread_options *o, o->merge_blktrace_iters[i].u.f =fio_uint64_to_double (le64_to_cpu (top->merge_blktrace_iters[i].u.i)); o->fdp =le32_to_cpu (top->fdp); + o->fdp_pli_select =le32_to_cpu (top->fdp_pli_select); o->fdp_nrpli =le32_to_cpu (top->fdp_nrpli);for (i =0 ; i < o->fdp_nrpli; i++) o->fdp_plis[i] =le32_to_cpu (top->fdp_plis[i]);
@@ -645,6 +646,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->merge_blktrace_iters[i].u.i =__cpu_to_le64 (fio_double_to_uint64 (o->merge_blktrace_iters[i].u.f)); top->fdp =cpu_to_le32 (o->fdp); + top->fdp_pli_select =cpu_to_le32 (o->fdp_pli_select); top->fdp_nrpli =cpu_to_le32 (o->fdp_nrpli);for (i =0 ; i < o->fdp_nrpli; i++) top->fdp_plis[i] =cpu_to_le32 (o->fdp_plis[i]);
configure +1 -1
@@ -2651,7 +2651,7 @@ fi ########################################## # Check if we have xnvme if test "$xnvme" != "no" ; then - if check_min_lib_version xnvme 0.2.0; then + if check_min_lib_version xnvme 0.7.0; then xnvme="yes" xnvme_cflags=$(pkg-config --cflags xnvme) xnvme_libs=$(pkg-config --libs xnvme)
diskutil.c +11 -18
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <string.h> #include <sys/types.h>
@@ -44,8 +45,6 @@ static void disk_util_free(struct disk_util *du)static int get_io_ticks (struct disk_util *du,struct disk_util_stat *dus) { -unsigned in_flight; -unsigned long long sectors[2 ];char line[256 ];FILE *f;char *p;
@@ -65,23 +64,17 @@ static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus)dprint (FD_DISKUTIL ,"%s: %s" , du->path, p); - ret =sscanf (p,"%llu %llu %llu %llu %llu %llu %llu %llu %u %llu %llu\n" , - (unsigned long long *) &dus->s.ios[0 ], - (unsigned long long *) &dus->s.merges[0 ], - §ors[0 ], - (unsigned long long *) &dus->s.ticks[0 ], - (unsigned long long *) &dus->s.ios[1 ], - (unsigned long long *) &dus->s.merges[1 ], - §ors[1 ], - (unsigned long long *) &dus->s.ticks[1 ], - &in_flight, - (unsigned long long *) &dus->s.io_ticks, - (unsigned long long *) &dus->s.time_in_queue); + ret =sscanf (p,"%" SCNu64" %" SCNu64" %" SCNu64" %" SCNu64" " +"%" SCNu64" %" SCNu64" %" SCNu64" %" SCNu64" " +"%*u %" SCNu64" %" SCNu64"\n" , + &dus->s.ios[0 ], &dus->s.merges[0 ], &dus->s.sectors[0 ], + &dus->s.ticks[0 ], + &dus->s.ios[1 ], &dus->s.merges[1 ], &dus->s.sectors[1 ], + &dus->s.ticks[1 ], + &dus->s.io_ticks, &dus->s.time_in_queue);fclose (f); -dprint (FD_DISKUTIL ,"%s: stat read ok? %d\n" , du->path, ret ==1 ); - dus->s.sectors[0 ] = sectors[0 ]; - dus->s.sectors[1 ] = sectors[1 ]; -return ret !=11 ; +dprint (FD_DISKUTIL ,"%s: stat read ok? %d\n" , du->path, ret ==10 ); +return ret !=10 ; }static void update_io_tick_disk (struct disk_util *du)
diskutil.h +11 -1
@@ -7,6 +7,16 @@#include "helper_thread.h" #include "fio_sem.h" +/** +* @ios: Number of I/O operations that have been completed successfully. +* @merges: Number of I/O operations that have been merged. +* @sectors: I/O size in 512-byte units. +* @ticks: Time spent on I/O in milliseconds. +* @io_ticks: CPU time spent on I/O in milliseconds. +* @time_in_queue: Weighted time spent doing I/O in milliseconds. +* +* For the array members, index 0 refers to reads and index 1 refers to writes. +*/ struct disk_util_stats {uint64_t ios[2 ];uint64_t merges[2 ];
@@ -18,7 +28,7 @@ struct disk_util_stats { };/* -* Disk utils as read in /sys/block/<dev>/stat +* Disk utilization as read from /sys/block/<dev>/stat */ struct disk_util_stat {uint8_t name[FIO_DU_NAME_SZ ];
engines/io_uring.c +1 -1
@@ -1310,7 +1310,7 @@ static int fio_ioring_cmd_fetch_ruhs(struct thread_data *td, struct fio_file *f,struct nvme_fdp_ruh_status *ruhs;int bytes, ret, i; - bytes =sizeof (*ruhs) +128 *sizeof (struct nvme_fdp_ruh_status_desc ); + bytes =sizeof (*ruhs) +FDP_MAX_RUHS *sizeof (struct nvme_fdp_ruh_status_desc ); ruhs =scalloc (1 , bytes);if (!ruhs)return -ENOMEM ;
engines/xnvme.c +77 -1
114 lines not on this page · raw message
examples/xnvme-fdp.fio new file +36 -0
@@ -0,0 +1,36 @@ +; README +; +; This job-file is intended to be used either as: +; +; # Use the xNVMe io-engine engine io_uring_cmd async. impl. +; fio examples/xnvme-fdp.fio \ +; --section=default \ +; --ioengine=xnvme \ +; --xnvme_async=io_uring_cmd \ +; --filename=/dev/ng0n1 +; +; # Use the xNVMe io-engine engine with nvme sync. impl. +; fio examples/xnvme-fdp.fio \ +; --section=default \ +; --ioengine=xnvme \ +; --xnvme_sync=nvme \ +; --filename=/dev/ng0n1 +; +; FIO_BS="512" FIO_RW="read" FIO_IODEPTH=16 fio examples/xnvme-fdp.fio \ +; --section=override --ioengine=xnvme --xnvme_sync=nvme --filename=/dev/ng0n1 +; +[global] +rw=randwrite +size=2M +iodepth=1 +bs=4K +thread=1 +fdp=1 +fdp_pli=4,5 + +[default] + +[override] +rw=${FIO_RW} +iodepth=${FIO_IODEPTH} +bs=${FIO_BS}
fdp.c +14 -8
@@ -45,7 +45,7 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f)struct fio_ruhs_info *ruhs, *tmp;int i, ret; - ruhs =scalloc (1 ,sizeof (*ruhs) +128 *sizeof (*ruhs->plis)); + ruhs =scalloc (1 ,sizeof (*ruhs) +FDP_MAX_RUHS *sizeof (*ruhs->plis));if (!ruhs)return -ENOMEM ;
@@ -56,8 +56,8 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) goto out; } -if (ruhs->nr_ruhs >128 ) - ruhs->nr_ruhs =128 ; +if (ruhs->nr_ruhs >FDP_MAX_RUHS ) + ruhs->nr_ruhs =FDP_MAX_RUHS ;if (td->o.fdp_nrpli ==0 ) { f->ruhs_info = ruhs;
@@ -65,7 +65,7 @@ static int init_ruh_info(struct thread_data *td, struct fio_file *f) }for (i =0 ; i < td->o.fdp_nrpli; i++) { -if (td->o.fdp_plis[i] > ruhs->nr_ruhs) { +if (td->o.fdp_plis[i] >= ruhs->nr_ruhs) { ret = -EINVAL ; goto out; }
@@ -119,10 +119,16 @@ void fdp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)return ; } -if (ruhs->pli_loc >= ruhs->nr_ruhs) - ruhs->pli_loc =0 ; +if (td->o.fdp_pli_select ==FIO_FDP_RR ) { +if (ruhs->pli_loc >= ruhs->nr_ruhs) + ruhs->pli_loc =0 ; - dspec = ruhs->plis[ruhs->pli_loc++]; - io_u->dtype =2 ; + dspec = ruhs->plis[ruhs->pli_loc++]; + }else { + ruhs->pli_loc =rand_between (&td->fdp_state,0 , ruhs->nr_ruhs -1 ); + dspec = ruhs->plis[ruhs->pli_loc]; + } + + io_u->dtype =FDP_DIR_DTYPE ; io_u->dspec = dspec; }
fdp.h +13 -0
@@ -3,6 +3,19 @@#include "io_u.h" +#define FDP_DIR_DTYPE 2 +#define FDP_MAX_RUHS 128 + +/* +* How fio chooses what placement identifier to use next. Choice of +* uniformly random, or roundrobin. +*/ + +enum { +FIO_FDP_RANDOM =0x1 , +FIO_FDP_RR =0x2 , +}; +struct fio_ruhs_info {uint32_t nr_ruhs;uint32_t pli_loc;
fio.1 +19 -3
@@ -2192,10 +2192,26 @@ cached data. Currently the RWF_NOWAIT flag does not supported for cached write. For direct I/O, requests will only succeed if cache invalidation isn't required, file blocks are fully allocated and the disk request could be issued immediately. .TP -.BI (io_uring_cmd)fdp \fR=\fPbool +.BI (io_uring_cmd,xnvme)fdp \fR=\fPbool Enable Flexible Data Placement mode for write commands. .TP -.BI (io_uring_cmd)fdp_pli \fR=\fPstr +.BI (io_uring_cmd,xnvme)fdp_pli_select \fR=\fPstr +Defines how fio decides which placement ID to use next. The following types +are defined: +.RS +.RS +.TP +.B random +Choose a placement ID at random (uniform). +.TP +.B roundrobin +Round robin over available placement IDs. This is the default. +.RE +.P +The available placement ID index/indices is defined by \fBfdp_pli\fR option. +.RE +.TP +.BI (io_uring_cmd,xnvme)fdp_pli \fR=\fPstr Select which Placement ID Index/Indicies this job is allowed to use for writes. By default, the job will cycle through all available Placement IDs, so use this to isolate these identifiers to specific jobs. If you want fio to use placement
@@ -4168,7 +4184,7 @@ They will look like this: .P .nf Disk stats (read/write): - sda: ios=16398/16511, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00% + sda: ios=16398/16511, sectors=32321/65472, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00% .fi .P Each value is printed for both reads and writes, with reads first. The
fio.h +2 -0
@@ -144,6 +144,7 @@ enum {FIO_RAND_POISSON3_OFF ,FIO_RAND_PRIO_CMDS ,FIO_RAND_DEDUPE_WORKING_SET_IX , +FIO_RAND_FDP_OFF , FIO_RAND_NR_OFFS, };
@@ -262,6 +263,7 @@ struct thread_data {struct frand_state verify_state_last_do_io;struct frand_state trim_state;struct frand_state delay_state; +struct frand_state fdp_state;struct frand_state buf_state;struct frand_state buf_state_prev;
init.c +2 -0
@@ -1082,6 +1082,8 @@ void td_fill_rand_seeds(struct thread_data *td)init_rand_seed (&td->buf_state, td->rand_seeds[FIO_RAND_BUF_OFF ], use64);frand_copy (&td->buf_state_prev, &td->buf_state); + +init_rand_seed (&td->fdp_state, td->rand_seeds[FIO_RAND_FDP_OFF ], use64); }static int setup_random_seeds (struct thread_data *td)
options.c +20 -0
@@ -3679,6 +3679,26 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_IO, .group = FIO_OPT_G_INVALID, }, + { + .name = "fdp_pli_select", + .lname = "FDP Placement ID select", + .type = FIO_OPT_STR, + .off1 = offsetof(struct thread_options, fdp_pli_select), + .help = "Select which FDP placement ID to use next", + .def = "roundrobin", + .category = FIO_OPT_C_IO, + .group = FIO_OPT_G_INVALID, + .posval = { + { .ival = "random", + .oval = FIO_FDP_RANDOM, + .help = "Choose a Placement ID at random (uniform)", + }, + { .ival = "roundrobin", + .oval = FIO_FDP_RR, + .help = "Round robin select Placement IDs", + }, + }, + }, { .name = "fdp_pli", .lname = "FDP Placement ID indicies",
stat.c +5 -2
@@ -1030,11 +1030,14 @@ void print_disk_util(struct disk_util_stat *dus, struct disk_util_agg *agg,if (agg->slavecount)log_buf (out," " ); - log_buf(out, " %s: ios=%llu/%llu, merge=%llu/%llu, " - "ticks=%llu/%llu, in_queue=%llu, util=%3.2f%%", + log_buf(out, " %s: ios=%llu/%llu, sectors=%llu/%llu, " + "merge=%llu/%llu, ticks=%llu/%llu, in_queue=%llu, " + "util=%3.2f%%", dus->name, (unsigned long long) dus->s.ios[0], (unsigned long long) dus->s.ios[1], + (unsigned long long) dus->s.sectors[0], + (unsigned long long) dus->s.sectors[1], (unsigned long long) dus->s.merges[0], (unsigned long long) dus->s.merges[1], (unsigned long long) dus->s.ticks[0],
thread_options.h +2 -0
@@ -388,6 +388,7 @@ struct thread_options {#define FIO_MAX_PLIS 16unsigned int fdp; +unsigned int fdp_pli_select;unsigned int fdp_plis[FIO_MAX_PLIS ];unsigned int fdp_nrpli;
@@ -703,6 +704,7 @@ struct thread_options_pack {uint32_t log_prio;uint32_t fdp; +uint32_t fdp_pli_select;uint32_t fdp_plis[FIO_MAX_PLIS ];uint32_t fdp_nrpli;