From: Jens Axboe Date: Tue, 27 Mar 2007 08:59:49 +0000 (+0200) Subject: Improve random verify block sorting X-Git-Tag: fio-1.15~26 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=160b966d83adace2629de10f85ed269ab2e587f5 Improve random verify block sorting Add an option to control it and also check the nosort flag in file layout to further catch a case where sorting isn't needed. Signed-off-by: Jens Axboe --- diff --git a/HOWTO b/HOWTO index a5be9dbd..7cab0537 100644 --- a/HOWTO +++ b/HOWTO @@ -563,6 +563,14 @@ verify=str If writing to a file, fio can verify the file contents system to make sure that the written data is also correctly read back. +verifysort=bool If set, fio will sort written verify blocks when it deems + it faster to read them back in a sorted manner. This is + often the case when overwriting an existing file, since + the blocks are already laid out in the file system. You + can ignore this option unless doing huge amounts of really + fast IO where the red-black tree sorting CPU time becomes + significant. + stonewall Wait for preceeding jobs in the job file to exit, before starting this one. Can be used to insert serialization points in the job file. A stone wall also implies starting diff --git a/filesetup.c b/filesetup.c index d8b7401b..a059df66 100644 --- a/filesetup.c +++ b/filesetup.c @@ -249,6 +249,7 @@ static int create_files(struct thread_data *td) if (td->o.unlink) f->flags |= FIO_FILE_UNLINK; + f->flags |= FIO_FILE_NOSORT; err = create_file(td, f); if (err) break; diff --git a/fio.h b/fio.h index ec08e423..ddc7e239 100644 --- a/fio.h +++ b/fio.h @@ -238,6 +238,7 @@ enum fio_file_flags { FIO_FILE_UNLINK = 1 << 1, /* unlink on close */ FIO_FILE_CLOSING = 1 << 2, /* file being closed */ FIO_FILE_EXISTS = 1 << 3, /* no need to create */ + FIO_FILE_NOSORT = 1 << 4, /* don't sort verify blocks */ }; /* @@ -356,6 +357,7 @@ struct thread_options { unsigned int end_fsync; unsigned int sync_io; unsigned int verify; + unsigned int verifysort; unsigned int use_thread; unsigned int unlink; unsigned int do_disk_util; diff --git a/log.c b/log.c index 6c7c4d6b..45be5fb6 100644 --- a/log.c +++ b/log.c @@ -60,7 +60,8 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u) * For both these cases, just reading back data in the order we * wrote it out is the fastest. */ - if (!td_random(td) || !td->o.overwrite) { + if (!td_random(td) || !td->o.overwrite || + (io_u->file->flags & FIO_FILE_NOSORT)) { INIT_LIST_HEAD(&ipo->list); list_add_tail(&ipo->list, &td->io_hist_list); return; diff --git a/options.c b/options.c index 5401f903..aeba5201 100644 --- a/options.c +++ b/options.c @@ -538,6 +538,13 @@ static struct fio_option options[] = { }, }, }, + { + .name = "verifysort", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(verifysort), + .help = "Sort written verify blocks for read back", + .def = "1", + }, { .name = "write_iolog", .type = FIO_OPT_STR_STORE,