Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Mar 29, 2017

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit f678f8d2aa7f6972b18e368fe42f7bc48134e66c:

configure: add a --disable-rdma flag to control rdma deps (2017-03-21 07:20:32 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 618ee94c319c46c670d29c7cf71538ca2ace13b7:

Separate io_u from ioengine [3/3] - rename ioengine.h to ioengines.h (2017-03-28 15:14:20 -0600)

----------------------------------------------------------------
Tomohiro Kusumi (12):
Fix return value of make_filename() when no filename_format Test malloc result when allocation size is tunable
Don't malloc more than necessary on extending/prereading file
HOWTO: Mention niche detail of range format options
Drop redundant "ignore invalidate option" message from 21c1b29e Ignore pre-read for FIO_NOIO td
Don't proceed with error set when failed to pre-read files/devices Ignore pre-read for character devices
Drop prototype of unused function td_io_sync()
Separate io_u from ioengine [1/3] - add io_u.h
Separate io_u from ioengine [2/3] - move io_u functions Separate io_u from ioengine [3/3] - rename ioengine.h to ioengines.h

 HOWTO                |  2 ++
 filesetup.c          | 35 +++++++++++++++-----
 fio.h                |  3 +-
 init.c               |  7 ++--
 io_u.c               | 58 +++++++++++++++++++++++++++++++++
 ioengine.h => io_u.h | 86 ++-----------------------------------------------
 ioengines.c          | 58 ---------------------------------
 ioengines.h          | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 iolog.h              |  2 +-
 rate-submit.c        |  2 +-
 10 files changed, 185 insertions(+), 158 deletions(-)
 rename ioengine.h => io_u.h (52%)
 create mode 100644 ioengines.h

---

Diff of recent changes:

HOWTO +2 -0
index cae95b7..80b9e75 100644
@@ -543,6 +543,8 @@ Parameter types
 
 	If the option accepts an upper and lower range, use a colon ':' or
 	minus '-' to separate such values. See :ref:`irange <irange>`.
+	If the lower value specified happens to be larger than the upper value,
+	two values are swapped.
 
 .. _bool:
 
filesetup.c +27 -8
index bcf95bd..612e794 100644
@@ -159,11 +159,18 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
 		}
 	}
 
-	b = malloc(td->o.max_bs[DDIR_WRITE]);
-
 	left = f->real_file_size;
+	bs = td->o.max_bs[DDIR_WRITE];
+	if (bs > left)
+		bs = left;
+
+	b = malloc(bs);
+	if (!b) {
+		td_verror(td, errno, "malloc");
+		goto err;
+	}
+
 	while (left && !td->terminate) {
-		bs = td->o.max_bs[DDIR_WRITE];
 		if (bs > left)
 			bs = left;
 
@@ -228,7 +235,11 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
 	unsigned int bs;
 	char *b;
 
-	if (td_ioengine_flagged(td, FIO_PIPEIO))
+	if (td_ioengine_flagged(td, FIO_PIPEIO) ||
+	    td_ioengine_flagged(td, FIO_NOIO))
+		return 0;
+
+	if (f->filetype == FIO_TYPE_CHAR)
 		return 0;
 
 	if (!fio_file_open(f)) {
@@ -241,8 +252,17 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
 
 	old_runstate = td_bump_runstate(td, TD_PRE_READING);
 
+	left = f->io_size;
 	bs = td->o.max_bs[DDIR_READ];
+	if (bs > left)
+		bs = left;
+
 	b = malloc(bs);
+	if (!b) {
+		td_verror(td, errno, "malloc");
+		ret = 1;
+		goto error;
+	}
 	memset(b, 0, bs);
 
 	if (lseek(f->fd, f->file_offset, SEEK_SET) < 0) {
@@ -252,8 +272,6 @@ static int pre_read_file(struct thread_data *td, struct fio_file *f)
 		goto error;
 	}
 
-	left = f->io_size;
-
 	while (left && !td->terminate) {
 		if (bs > left)
 			bs = left;
@@ -1104,10 +1122,11 @@ int pre_read_files(struct thread_data *td)
 	dprint(FD_FILE, "pre_read files\n");
 
 	for_each_file(td, f, i) {
-		pre_read_file(td, f);
+		if (pre_read_file(td, f))
+			return -1;
 	}
 
-	return 1;
+	return 0;
 }
 
 static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)
fio.h +2 -1
index 52a9b75..3955a81 100644
@@ -25,7 +25,7 @@
 #include "debug.h"
 #include "file.h"
 #include "io_ddir.h"
-#include "ioengine.h"
+#include "ioengines.h"
 #include "iolog.h"
 #include "helpers.h"
 #include "options.h"
@@ -39,6 +39,7 @@
 #include "server.h"
 #include "stat.h"
 #include "flow.h"
+#include "io_u.h"
 #include "io_u_queue.h"
 #include "workqueue.h"
 #include "steadystate.h"
init.c +2 -5
index 4a72255..2f9433b 100644
@@ -765,11 +765,8 @@ static int fixup_options(struct thread_data *td)
 	}
 
 	if (o->pre_read) {
-		if (o->invalidate_cache) {
-			log_info("fio: ignore invalidate option for %s\n",
-				 o->name);
+		if (o->invalidate_cache)
 			o->invalidate_cache = 0;
-		}
 		if (td_ioengine_flagged(td, FIO_PIPEIO)) {
 			log_info("fio: cannot pre-read files with an IO engine"
 				 " that isn't seekable. Pre-read disabled.\n");
@@ -1121,7 +1118,7 @@ static char *make_filename(char *buf, size_t buf_size,struct thread_options *o,
 
 	if (!o->filename_format || !strlen(o->filename_format)) {
 		sprintf(buf, "%s.%d.%d", jobname, jobnum, filenum);
-		return NULL;
+		return buf;
 	}
 
 	for (f = &fpre_keywords[0]; f->keyword; f++)
io_u.c +58 -0

61 lines not on this page · raw message

io_u.h new file +179 -0

179 lines not on this page · raw message

ioengine.h deleted +0 -261

261 lines not on this page · raw message

ioengines.c +0 -58

64 lines not on this page · raw message

ioengines.h new file +90 -0

90 lines not on this page · raw message

iolog.h +1 -1
index 37f27bc..0733ad3 100644
@@ -4,7 +4,7 @@
 #include "lib/rbtree.h"
 #include "lib/ieee754.h"
 #include "flist.h"
-#include "ioengine.h"
+#include "ioengines.h"
 
 /*
  * Use for maintaining statistics
rate-submit.c +1 -1
index 4738dc4..fdbece6 100644
@@ -5,7 +5,7 @@
  *
  */
 #include "fio.h"
-#include "ioengine.h"
+#include "ioengines.h"
 #include "lib/getrusage.h"
 #include "rate-submit.h"