RE: fio max blocksize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The above will overwrite nearby members.
Was thinking the member was allocated as 64 bits but may only use 32 bits, but agreed that's not true for other options that use FIO_OPT_INT (e.g. nr_files).  How about just breaking the ULL if/else out separately:

diff --git a/parse.c b/parse.c
index 6261fca..35ec362 100644
--- a/parse.c
+++ b/parse.c
@@ -32,6 +32,7 @@ static const char *opt_type_names[] = {
 	"OPT_STR_STORE",
 	"OPT_RANGE",
 	"OPT_INT",
+    "OPT_ULL",
 	"OPT_BOOL",
 	"OPT_FLOAT_LIST",
 	"OPT_STR_SET",
@@ -554,6 +555,7 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
 	}
 	case FIO_OPT_STR_VAL_TIME:
 		is_time = 1;
+    case FIO_OPT_ULL:
 	case FIO_OPT_INT:
 	case FIO_OPT_STR_VAL: {
 		fio_opt_str_val_fn *fn = o->cb;
@@ -584,7 +586,7 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
 
 		if (o->maxval && ull > o->maxval) {
 			log_err("max value out of range: %llu"
-					" (%u max)\n", ull, o->maxval);
+					" (%llu max)\n", ull, o->maxval);
 			return 1;
 		}
 		if (o->minval && ull < o->minval) {
@@ -636,6 +638,28 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
 							val_store(ilp, ull, o->off3, 0, data, o);
 					}
 				}
+            }
+            else if (o->type == FIO_OPT_ULL) {
+				if (first)
+					val_store(ullp, ull, o->off1, 0, data, o);
+				if (curr == 1) {
+					if (o->off2)
+						val_store(ullp, ull, o->off2, 0, data, o);
+				}
+				if (curr == 2) {
+					if (o->off3)
+						val_store(ullp, ull, o->off3, 0, data, o);
+				}
+				if (!more) {
+					if (curr < 1) {
+						if (o->off2)
+							val_store(ullp, ull, o->off2, 0, data, o);
+					}
+					if (curr < 2) {
+						if (o->off3)
+							val_store(ullp, ull, o->off3, 0, data, o);
+					}
+				}
 			} else {
 				if (first)
 					val_store(ullp, ull, o->off1, 0, data, o);
@@ -851,7 +875,7 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
 			break;
 
 		if (o->maxval && il > (int) o->maxval) {
-			log_err("max value out of range: %d (%d max)\n",
+			log_err("max value out of range: %d (%llu max)\n",
 								il, o->maxval);
 			return 1;
 		}
@@ -1325,6 +1349,10 @@ static void option_init(struct fio_option *o)
 		if (!o->maxval)
 			o->maxval = UINT_MAX;
 	}
+    if (o->type == FIO_OPT_ULL) {
+		if (!o->maxval)
+			o->maxval = ULLONG_MAX;
+	}
 	if (o->type == FIO_OPT_STR_SET && o->def && !o->no_warn_def) {
 		log_err("Option %s: string set option with"
 				" default will always be true\n", o->name);


Regards,
Jeff


��.n��������+%������w��{.n�������^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux