[PATCH] Change O_DIRECT vs buffered setup

Change the default from O_DIRECT IO to normal buffered IO. That makes
more sense, as O_DIRECT is a special case and should be manually
enabled as such.

Do this by adding a option negate switch, so we don't need two sets
of parameters to control these options.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/HOWTO b/HOWTO
index 57c0730..a9ee7ab 100644
--- a/HOWTO
+++ b/HOWTO
@@ -277,7 +277,10 @@
 		concurrency.
 
 direct=bool	If value is true, use non-buffered io. This is usually
-		O_DIRECT. Defaults to true.
+		O_DIRECT.
+
+buffered=bool	If value is true, use buffered io. This is the opposite
+		of the 'direct' option. Defaults to true.
 
 offset=siint	Start io at the given offset in the file. The data before
 		the given offset will not be touched. This effectively
diff --git a/init.c b/init.c
index c272526..5d6b0a9 100644
--- a/init.c
+++ b/init.c
@@ -151,7 +151,15 @@
 		.name	= "direct",
 		.type	= FIO_OPT_BOOL,
 		.off1	= td_var_offset(odirect),
-		.help	= "Use O_DIRECT IO",
+		.help	= "Use O_DIRECT IO (negates buffered)",
+		.def	= "0",
+	},
+	{
+		.name	= "buffered",
+		.type	= FIO_OPT_BOOL,
+		.off1	= td_var_offset(odirect),
+		.neg	= 1,
+		.help	= "Use buffered IO (negates direct)",
 		.def	= "1",
 	},
 	{
diff --git a/parse.c b/parse.c
index 886bde6..81ffb74 100644
--- a/parse.c
+++ b/parse.c
@@ -267,6 +267,9 @@
 			return 1;
 		}
 
+		if (o->neg)
+			il = !il;
+
 		if (fn)
 			ret = fn(data, &il);
 		else {
diff --git a/parse.h b/parse.h
index 4ddb76a..7374c25 100644
--- a/parse.h
+++ b/parse.h
@@ -29,6 +29,7 @@
 	unsigned int off4;
 	unsigned int maxval;		/* max and min value */
 	int minval;
+	int neg;			/* negate value stored */
 	void *cb;			/* callback */
 	const char *help;		/* help text for option */
 	const char *def;		/* default setting */