Allow percentage setting for size=

Sometimes it's useful to set this to a particular size of a device.
Allowing percentages makes this more easy, as one does not have to
do the math outside of fio and pass in as environment variables
or custom job files.

To use, simply add a

	size=15%

or whatever is needed, then fio will use 15% of the total size of
the device(s) or file(s) given. Percentage can be from 1 to 100.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/options.c b/options.c
index b4456a4..74c6478 100644
--- a/options.c
+++ b/options.c
@@ -744,6 +744,20 @@
 	return 0;
 }
 
+static int str_size_cb(void *data, unsigned long long *__val)
+{
+	struct thread_data *td = data;
+	unsigned long long v = *__val;
+
+	if (parse_is_percent(v)) {
+		td->o.size = 0;
+		td->o.size_percent = -1ULL - v;
+	} else
+		td->o.size = v;
+
+	return 0;
+}
+
 static int rw_verify(struct fio_option *o, void *data)
 {
 	struct thread_data *td = data;
@@ -1031,8 +1045,7 @@
 	{
 		.name	= "size",
 		.type	= FIO_OPT_STR_VAL,
-		.off1	= td_var_offset(size),
-		.minval = 1,
+		.cb	= str_size_cb,
 		.help	= "Total size of device or files",
 	},
 	{