Recent changes (master)
Subsystems (2)
The following changes since commit 89c176baca1170db809d4f46416e262851d00874:
Fio 2.2.7 (2015-04-14 18:08:59 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 4da24b69599f7f78dc1420345f91d90ec0cfe109:
Fix wrong index bug (2015-04-15 21:51:21 -0600)
----------------------------------------------------------------
Dan Ehrenberg (7):
Allow trim on any file type
Add new writetrim rw= mode for trims preceding writes Collect a block-wise histogram of trim and write errors
mtd: Add CONFIG_MTD to ./configure script
mtd: Import libmtd with modifications to make it compile
mtd: ioengine
mtd: example job file
Jens Axboe (2):
Change writetrim to trimwrite
Fix wrong index bug
HOWTO | 31 +- Makefile | 5 + backend.c | 5 + client.c | 4 + configure | 20 + engines/mtd.c | 209 ++++++++ examples/mtd.fio | 21 + filesetup.c | 26 +- fio.1 | 25 +- init.c | 7 + io_ddir.h | 3 + io_u.c | 25 +- iolog.c | 12 + lib/libmtd.c | 1424 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/libmtd.h | 354 +++++++++++++ lib/libmtd_common.h | 223 ++++++++ lib/libmtd_int.h | 109 ++++ lib/libmtd_legacy.c | 384 ++++++++++++++ lib/libmtd_xalloc.h | 106 ++++ options.c | 34 +- options.h | 2 + server.c | 4 + stat.c | 201 +++++++- stat.h | 27 + thread_options.h | 6 + 25 files changed, 3248 insertions(+), 19 deletions(-) create mode 100644 engines/mtd.c create mode 100644 examples/mtd.fio create mode 100644 lib/libmtd.c create mode 100644 lib/libmtd.h create mode 100644 lib/libmtd_common.h create mode 100644 lib/libmtd_int.h create mode 100644 lib/libmtd_legacy.c create mode 100644 lib/libmtd_xalloc.h
---
Diff of recent changes:
HOWTO +24 -7
@@ -387,6 +387,8 @@ rw=str Type of io pattern. Accepted values are: randread Random reads rw,readwrite Sequential mixed reads and writes randrw Random mixed reads and writes + trimwrite Mixed trims and writes. Blocks will be + trimmed first, then written to. For the mixed io types, the default is to split them 50/50. For certain types of io the result may still be skewed a bit,
@@ -770,6 +772,15 @@ ioengine=str Defines how the job issues io to the file. The following necessary environment variables to work with hdfs/libhdfs properly. + mtd Read, write and erase an MTD character device + (e.g., /dev/mtd0). Discards are treated as + erases. Depending on the underlying device + type, the I/O may have to go in a certain + pattern, e.g., on NAND, writing sequentially + to erase blocks and discarding before + overwriting. The writetrim mode works well + for this constraint. + external Prefix to specify loading an external IO engine object file. Append the engine filename, eg ioengine=external:/tmp/foo.o
@@ -1468,6 +1479,11 @@ log_store_compressed=bool If set, and log_compression is also set, command line parameter. The files will be stored with a .fz suffix. +block_error_percentiles=bool If set, record errors in trim block-sized + units from writes and trims and output a histogram of + how many trims it took to get to errors, and what kind + of error was encountered. + lockmem=int Pin down the specified amount of memory with mlock(2). Can potentially be used instead of removing memory or booting with less memory to simulate a smaller amount of memory.
@@ -1507,13 +1523,13 @@ clat_percentiles=bool Enable the reporting of percentiles of completion latencies. percentile_list=float_list Overwrite the default list of percentiles - for completion latencies. Each number is a floating - number in the range (0,100], and the maximum length of - the list is 20. Use ':' to separate the numbers, and - list the numbers in ascending order. For example, - --percentile_list=99.5:99.9 will cause fio to report - the values of completion latency below which 99.5% and - 99.9% of the observed latencies fell, respectively. + for completion latencies and the block error histogram. + Each number is a floating number in the range (0,100], + and the maximum length of the list is 20. Use ':' + to separate the numbers, and list the numbers in ascending + order. For example, --percentile_list=99.5:99.9 will cause + fio to report the values of completion latency below which + 99.5% and 99.9% of the observed latencies fell, respectively. clocksource=str Use the given clocksource as the base of timing. The supported options are:
@@ -1716,6 +1732,7 @@ be the starting port number since fio will use a range of ports. 1 : allocate space immidietly inside defragment event, and free right after event +[mtd] skip_bad=bool Skip operations against known bad blocks. 6.0 Interpreting the output
Makefile +5 -0
@@ -107,6 +107,11 @@ ifdef CONFIG_GFAPI CFLAGS += "-DGFAPI_USE_FADVISE" endif endif +ifdef CONFIG_MTD + SOURCE += engines/mtd.c + SOURCE += lib/libmtd.c + SOURCE += lib/libmtd_legacy.c +endif ifeq ($(CONFIG_TARGET_OS), Linux) SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
backend.c +5 -0
@@ -744,6 +744,11 @@ static uint64_t do_io(struct thread_data *td) (td_write(td) && td->o.verify_backlog)) total_bytes += td->o.size; +/* In trimwrite mode, each byte is trimmed and then written, so +* allow total_bytes to be twice as big */ +if (td_trimwrite (td)) + total_bytes += td->total_io_size; +while ((td->o.read_iolog_file && !flist_empty (&td->io_log_list)) || (!flist_empty (&td->trim_list)) || !io_issue_bytes_exceeded (td) || td->o.time_based) {
client.c +4 -0
@@ -891,6 +891,10 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src) dst->latency_target =le64_to_cpu (src->latency_target); dst->latency_window =le64_to_cpu (src->latency_window); dst->latency_percentile.u.f =fio_uint64_to_double (le64_to_cpu (src->latency_percentile.u.i)); + + dst->nr_block_infos =le64_to_cpu (src->nr_block_infos); +for (i =0 ; i < dst->nr_block_infos; i++) + dst->block_infos[i] =le32_to_cpu (src->block_infos[i]); }static void convert_gs (struct group_run_stats *dst,struct group_run_stats *src)
configure +20 -0
@@ -1369,6 +1369,23 @@ if test "$libhdfs" = "yes" ; then fi echo "HDFS engine $libhdfs" +########################################## +# Check whether we have MTD +mtd="no" +cat > $TMPC << EOF +#include <mtd/mtd-user.h> +#include <sys/ioctl.h> +int main(int argc, char **argv) +{ + struct mtd_info_user info; + return ioctl(0, MEMGETINFO, &info); +} +EOF +if compile_prog "" "" "mtd"; then + mtd="yes" +fi +echo "MTD $mtd" + # Check if we have lex/yacc available yacc="no" yacc_is_bison="no"
@@ -1572,6 +1589,9 @@ if test "$libhdfs" = "yes" ; then echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak fi +if test "$mtd" = "yes" ; then + output_sym "CONFIG_MTD" +fi if test "$arith" = "yes" ; then output_sym "CONFIG_ARITHMETIC" if test "$yacc_is_bison" = "yes" ; then
engines/mtd.c new file +209 -0
209 lines not on this page · raw message
examples/mtd.fio new file +21 -0
@@ -0,0 +1,21 @@ +[global] +gtod_reduce=1 +filename=/dev/mtd0 +ioengine=mtd +ignore_error=,EIO +blocksize=512,512,16384 +skip_bad=1 + +[write] +stonewall +rw=trim + +[write] +stonewall +rw=write + +[write] +stonewall +block_error_percentiles=1 +rw=writetrim +loops=4
filesetup.c +21 -5
@@ -512,11 +512,6 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)dprint (FD_FILE ,"fd open %s\n" , f->file_name); -if (td_trim (td) && f->filetype !=FIO_TYPE_BD ) { -log_err ("fio: trim only applies to block device\n" ); -return 1 ; - } -if (!strcmp (f->file_name,"-" )) {if (td_rw (td)) {log_err ("fio: can't read/write to stdin/out\n" );
@@ -885,6 +880,27 @@ int setup_files(struct thread_data *td) } } +if (td->o.block_error_hist) { +int len; + +assert (td->o.nr_files ==1 );/* checked in fixup_options */ + f = td->files[0 ]; + len = f->io_size / td->o.bs[DDIR_TRIM ]; +if (len >MAX_NR_BLOCK_INFOS || len <=0 ) { +log_err ("fio: cannot calculate block histogram with " +"%d trim blocks, maximum %d\n" , + len,MAX_NR_BLOCK_INFOS ); +td_verror (td,EINVAL ,"block_error_hist" ); + goto err_out; + } + + td->ts.nr_block_infos = len; +for (int i =0 ; i < len; i++) + td->ts.block_infos[i] = +BLOCK_INFO (0 ,BLOCK_STATE_UNINIT ); + }else + td->ts.nr_block_infos =0 ; +if (!o->size || (total_size && o->size > total_size)) o->size = total_size;
fio.1 +22 -3
@@ -286,6 +286,10 @@ Mixed sequential reads and writes. .TP .B randrw Mixed random reads and writes. +.TP +.B trimwrite +Trim and write mixed workload. Blocks will be trimmed first, then the same +blocks will be written to. .RE .P For mixed I/O, the default split is 50/50. For certain types of io the result
@@ -655,6 +659,13 @@ file out of those files based on the offset generated by fio backend. (see the example job file to create such files, use rw=write option). Please note, you might want to set necessary environment variables to work with hdfs/libhdfs properly. +.TP +.B mtd +Read, write and erase an MTD character device (e.g., /dev/mtd0). Discards are +treated as erases. Depending on the underlying device type, the I/O may have +to go in a certain pattern, e.g., on NAND, writing sequentially to erase blocks +and discarding before overwriting. The writetrim mode works well for this +constraint. .RE .P .RE
@@ -1292,6 +1303,11 @@ a compressed format. They can be decompressed with fio, using the \fB\-\-inflate-log\fR command line parameter. The files will be stored with a \fB\.fz\fR suffix. .TP +.BI block_error_percentiles \fR=\fPbool +If set, record errors in trim block-sized units from writes and trims and output +a histogram of how many trims it took to get to errors, and what kind of error +was encountered. +.TP .BI disable_lat \fR=\fPbool Disable measurements of total latency numbers. Useful only for cutting back the number of calls to \fBgettimeofday\fR\|(2), as that does impact performance at
@@ -1450,9 +1466,9 @@ exceeded before retrying operations Enable the reporting of percentiles of completion latencies. .TP .BI percentile_list \fR=\fPfloat_list -Overwrite the default list of percentiles for completion -latencies. Each number is a floating number in the range (0,100], and -the maximum length of the list is 20. Use ':' to separate the +Overwrite the default list of percentiles for completion latencies and the +block error histogram. Each number is a floating number in the range (0,100], +and the maximum length of the list is 20. Use ':' to separate the numbers. For example, \-\-percentile_list=99.5:99.9 will cause fio to report the values of completion latency below which 99.5% and 99.9% of the observed latencies fell, respectively.
@@ -1567,6 +1583,9 @@ Specifies the name of the Ceph pool containing the RBD. .TP .BI (rbd)clientname \fR=\fPstr Specifies the username (without the 'client.' prefix) used to access the Ceph cluster. +.TP +.BI (mtd)skipbad \fR=\fPbool +Skip operations against known bad blocks. .SH OUTPUT While running, \fBfio\fR will display the status of the created jobs. For example:
init.c +7 -0
@@ -767,6 +767,13 @@ static int fixup_options(struct thread_data *td)if (!td->loops) td->loops =1 ; +if (td->o.block_error_hist && td->o.nr_files !=1 ) { +log_err ("fio: block error histogram only available with " +"with a single file per job, but %d files " +"provided\n" , td->o.nr_files); + ret =1 ; + } +return ret; }
io_ddir.h +3 -0
@@ -35,6 +35,7 @@ enum td_ddir {TD_DDIR_RANDWRITE =TD_DDIR_WRITE |TD_DDIR_RAND ,TD_DDIR_RANDRW =TD_DDIR_RW |TD_DDIR_RAND ,TD_DDIR_RANDTRIM =TD_DDIR_TRIM |TD_DDIR_RAND , + TD_DDIR_TRIMWRITE = TD_DDIR_TRIM | TD_DDIR_WRITE, };#define td_read (td) ((td)->o.td_ddir & TD_DDIR_READ)
@@ -43,6 +44,8 @@ enum td_ddir {#define td_rw (td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)#define td_random (td) ((td)->o.td_ddir & TD_DDIR_RAND)#define file_randommap (td, f) (!(td)->o.norandommap && fio_file_axmap((f))) +#define td_trimwrite (td) (((td)->o.td_ddir & TD_DDIR_TRIMWRITE) \ + == TD_DDIR_TRIMWRITE)static inline int ddir_sync (enum fio_ddir ddir) {
io_u.c +24 -1
@@ -668,7 +668,17 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td)static void set_rw_ddir (struct thread_data *td,struct io_u *io_u) { - io_u->ddir = io_u->acct_ddir =get_rw_ddir (td); +enum fio_ddir ddir =get_rw_ddir (td); + +if (td_trimwrite (td)) { +struct fio_file *f = io_u->file; +if (f->last_pos[DDIR_WRITE ] == f->last_pos[DDIR_TRIM ]) + ddir =DDIR_TRIM ; +else + ddir =DDIR_WRITE ; + } + + io_u->ddir = io_u->acct_ddir = ddir; if (io_u->ddir == DDIR_WRITE && (td->io_ops->flags & FIO_BARRIER) && td->o.barrier_blocks &&
@@ -1596,6 +1606,19 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,if (!gtod_reduce (td))add_iops_sample (td, idx, bytes, &icd->time); + +if (td->ts.nr_block_infos && io_u->ddir ==DDIR_TRIM ) { +uint32_t *info =io_u_block_info (td, io_u); +if (BLOCK_INFO_STATE (*info) <BLOCK_STATE_TRIM_FAILURE ) { +if (io_u->ddir ==DDIR_TRIM ) { + *info =BLOCK_INFO (BLOCK_STATE_TRIMMED , +BLOCK_INFO_TRIMS (*info) +1 ); + }else if (io_u->ddir ==DDIR_WRITE ) { + *info =BLOCK_INFO_SET_STATE (BLOCK_STATE_WRITTEN , + *info); + } + } + } }static long long usec_for_io (struct thread_data *td,enum fio_ddir ddir)
iolog.c +12 -0
@@ -291,6 +291,18 @@ void unlog_io_piece(struct thread_data *td, struct io_u *io_u) {struct io_piece *ipo = io_u->ipo; +if (td->ts.nr_block_infos) { +uint32_t *info =io_u_block_info (td, io_u); +if (BLOCK_INFO_STATE (*info) <BLOCK_STATE_TRIM_FAILURE ) { +if (io_u->ddir ==DDIR_TRIM ) + *info =BLOCK_INFO_SET_STATE (*info, +BLOCK_STATE_TRIM_FAILURE ); +else if (io_u->ddir ==DDIR_WRITE ) + *info =BLOCK_INFO_SET_STATE (*info, +BLOCK_STATE_WRITE_FAILURE ); + } + } +if (!ipo)return ;
lib/libmtd.c new file +1424 -0
1,424 lines not on this page · raw message
lib/libmtd.h new file +354 -0
354 lines not on this page · raw message
lib/libmtd_common.h new file +223 -0
223 lines not on this page · raw message
lib/libmtd_int.h new file +109 -0
109 lines not on this page · raw message
lib/libmtd_legacy.c new file +384 -0
359 lines not on this page · raw message
lib/libmtd_xalloc.h new file +106 -0
106 lines not on this page · raw message
stat.c +200 -1
201 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.