blob: e30aacc939d7e0fb0ecb001e91b07a4ab093dd87 [file] [log] [blame]
Jens Axboe214e1ec2007-03-15 10:48:13 +01001#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <ctype.h>
5#include <string.h>
Jens Axboe214e1ec2007-03-15 10:48:13 +01006#include <assert.h>
Jens Axboe921c7662008-03-26 09:17:55 +01007#include <libgen.h>
Jens Axboe5921e802008-05-30 15:02:38 +02008#include <fcntl.h>
9#include <sys/types.h>
10#include <sys/stat.h>
Jens Axboe214e1ec2007-03-15 10:48:13 +010011
12#include "fio.h"
Jens Axboe4f5af7b2009-06-03 08:45:40 +020013#include "verify.h"
Jens Axboe214e1ec2007-03-15 10:48:13 +010014#include "parse.h"
Jens Axboeeef32352008-06-02 13:31:26 +020015#include "lib/fls.h"
Jens Axboe9f988e22010-03-04 10:42:38 +010016#include "options.h"
Jens Axboe214e1ec2007-03-15 10:48:13 +010017
Jens Axboe5d7c5d32010-06-21 15:08:17 +020018#include "crc/crc32c.h"
19
Jens Axboe214e1ec2007-03-15 10:48:13 +010020/*
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
22 */
23static char *get_opt_postfix(const char *str)
24{
25 char *p = strstr(str, ":");
26
27 if (!p)
28 return NULL;
29
30 p++;
31 strip_blank_front(&p);
32 strip_blank_end(p);
33 return strdup(p);
34}
35
Radha Ramachandran0e92f872009-10-27 20:14:27 +010036static int converthexchartoint(char a)
37{
38 int base;
39
40 switch(a) {
41 case '0'...'9':
42 base = '0';
43 break;
44 case 'A'...'F':
45 base = 'A' - 10;
46 break;
47 case 'a'...'f':
48 base = 'a' - 10;
49 break;
50 default:
51 base = 0;
52 }
53 return (a - base);
54}
55
Jens Axboe564ca972007-12-14 12:21:19 +010056static int bs_cmp(const void *p1, const void *p2)
57{
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
60
61 return bsp1->perc < bsp2->perc;
62}
63
Jens Axboe720e84a2009-04-21 08:29:55 +020064static int bssplit_ddir(struct thread_data *td, int ddir, char *str)
Jens Axboe564ca972007-12-14 12:21:19 +010065{
Jens Axboe720e84a2009-04-21 08:29:55 +020066 struct bssplit *bssplit;
Jens Axboe564ca972007-12-14 12:21:19 +010067 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
69 long long val;
Jens Axboe720e84a2009-04-21 08:29:55 +020070 char *fname;
Jens Axboe564ca972007-12-14 12:21:19 +010071
Jens Axboe720e84a2009-04-21 08:29:55 +020072 td->o.bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
Jens Axboe564ca972007-12-14 12:21:19 +010074
75 i = 0;
76 max_bs = 0;
77 min_bs = -1;
78 while ((fname = strsep(&str, ":")) != NULL) {
79 char *perc_str;
80
81 if (!strlen(fname))
82 break;
83
84 /*
85 * grow struct buffer, if needed
86 */
Jens Axboe720e84a2009-04-21 08:29:55 +020087 if (i == td->o.bssplit_nr[ddir]) {
88 td->o.bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, td->o.bssplit_nr[ddir]
Jens Axboe5ec10ea2008-03-06 15:42:00 +010090 * sizeof(struct bssplit));
Jens Axboe564ca972007-12-14 12:21:19 +010091 }
92
93 perc_str = strstr(fname, "/");
94 if (perc_str) {
95 *perc_str = '\0';
96 perc_str++;
97 perc = atoi(perc_str);
98 if (perc > 100)
99 perc = 100;
100 else if (!perc)
101 perc = -1;
102 } else
103 perc = -1;
104
Jens Axboe6925dd32011-09-07 22:10:11 +0200105 if (str_to_decimal(fname, &val, 1, td)) {
Jens Axboe564ca972007-12-14 12:21:19 +0100106 log_err("fio: bssplit conversion failed\n");
107 free(td->o.bssplit);
108 return 1;
109 }
110
111 if (val > max_bs)
112 max_bs = val;
113 if (val < min_bs)
114 min_bs = val;
115
Jens Axboe720e84a2009-04-21 08:29:55 +0200116 bssplit[i].bs = val;
117 bssplit[i].perc = perc;
Jens Axboe564ca972007-12-14 12:21:19 +0100118 i++;
119 }
120
Jens Axboe720e84a2009-04-21 08:29:55 +0200121 td->o.bssplit_nr[ddir] = i;
Jens Axboe564ca972007-12-14 12:21:19 +0100122
123 /*
124 * Now check if the percentages add up, and how much is missing
125 */
126 perc = perc_missing = 0;
Jens Axboe720e84a2009-04-21 08:29:55 +0200127 for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100129
130 if (bsp->perc == (unsigned char) -1)
131 perc_missing++;
132 else
133 perc += bsp->perc;
134 }
135
136 if (perc > 100) {
137 log_err("fio: bssplit percentages add to more than 100%%\n");
Jens Axboe720e84a2009-04-21 08:29:55 +0200138 free(bssplit);
Jens Axboe564ca972007-12-14 12:21:19 +0100139 return 1;
140 }
141 /*
142 * If values didn't have a percentage set, divide the remains between
143 * them.
144 */
145 if (perc_missing) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200146 for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100148
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
151 }
152 }
153
Jens Axboe720e84a2009-04-21 08:29:55 +0200154 td->o.min_bs[ddir] = min_bs;
155 td->o.max_bs[ddir] = max_bs;
Jens Axboe564ca972007-12-14 12:21:19 +0100156
157 /*
158 * now sort based on percentages, for ease of lookup
159 */
Jens Axboe720e84a2009-04-21 08:29:55 +0200160 qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 td->o.bssplit[ddir] = bssplit;
162 return 0;
163
164}
165
166static int str_bssplit_cb(void *data, const char *input)
167{
168 struct thread_data *td = data;
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200169 char *str, *p, *odir, *ddir;
Jens Axboe720e84a2009-04-21 08:29:55 +0200170 int ret = 0;
171
172 p = str = strdup(input);
173
174 strip_blank_front(&str);
175 strip_blank_end(str);
176
177 odir = strchr(str, ',');
178 if (odir) {
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200179 ddir = strchr(odir + 1, ',');
180 if (ddir) {
181 ret = bssplit_ddir(td, DDIR_TRIM, ddir + 1);
182 if (!ret)
183 *ddir = '\0';
184 } else {
185 char *op;
186
187 op = strdup(odir + 1);
188 ret = bssplit_ddir(td, DDIR_TRIM, op);
189
190 free(op);
191 }
192 if (!ret)
193 ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
Jens Axboe720e84a2009-04-21 08:29:55 +0200194 if (!ret) {
195 *odir = '\0';
196 ret = bssplit_ddir(td, DDIR_READ, str);
197 }
198 } else {
199 char *op;
200
201 op = strdup(str);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200202 ret = bssplit_ddir(td, DDIR_WRITE, op);
Jens Axboe720e84a2009-04-21 08:29:55 +0200203 free(op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200204
205 if (!ret) {
206 op = strdup(str);
207 ret = bssplit_ddir(td, DDIR_TRIM, op);
208 free(op);
209 }
210 ret = bssplit_ddir(td, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200211 }
Jens Axboe564ca972007-12-14 12:21:19 +0100212
213 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200214 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100215}
216
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400217static int str2error(char *str)
218{
219 const char * err[] = {"EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
220 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
221 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
222 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
223 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
224 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
225 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
226 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE"};
227 int i = 0, num = sizeof(err) / sizeof(void *);
228
229 while( i < num) {
230 if (!strcmp(err[i], str))
231 return i + 1;
232 i++;
233 }
234 return 0;
235}
236
237static int ignore_error_type(struct thread_data *td, int etype, char *str)
238{
239 unsigned int i;
240 int *error;
241 char *fname;
242
243 if (etype >= ERROR_TYPE_CNT) {
244 log_err("Illegal error type\n");
245 return 1;
246 }
247
248 td->o.ignore_error_nr[etype] = 4;
249 error = malloc(4 * sizeof(struct bssplit));
250
251 i = 0;
252 while ((fname = strsep(&str, ":")) != NULL) {
253
254 if (!strlen(fname))
255 break;
256
257 /*
258 * grow struct buffer, if needed
259 */
260 if (i == td->o.ignore_error_nr[etype]) {
261 td->o.ignore_error_nr[etype] <<= 1;
262 error = realloc(error, td->o.ignore_error_nr[etype]
263 * sizeof(int));
264 }
265 if (fname[0] == 'E') {
266 error[i] = str2error(fname);
267 } else {
268 error[i] = atoi(fname);
269 if (error[i] < 0)
270 error[i] = error[i];
271 }
272 if (!error[i]) {
273 log_err("Unknown error %s, please use number value \n",
274 fname);
275 return 1;
276 }
277 i++;
278 }
279 if (i) {
280 td->o.continue_on_error |= 1 << etype;
281 td->o.ignore_error_nr[etype] = i;
282 td->o.ignore_error[etype] = error;
283 }
284 return 0;
285
286}
287
288static int str_ignore_error_cb(void *data, const char *input)
289{
290 struct thread_data *td = data;
291 char *str, *p, *n;
292 int type = 0, ret = 1;
293 p = str = strdup(input);
294
295 strip_blank_front(&str);
296 strip_blank_end(str);
297
298 while (p) {
299 n = strchr(p, ',');
300 if (n)
301 *n++ = '\0';
302 ret = ignore_error_type(td, type, p);
303 if (ret)
304 break;
305 p = n;
306 type++;
307 }
308 free(str);
309 return ret;
310}
311
Jens Axboe211097b2007-03-22 18:56:45 +0100312static int str_rw_cb(void *data, const char *str)
313{
314 struct thread_data *td = data;
315 char *nr = get_opt_postfix(str);
316
Jens Axboe5736c102010-07-20 12:03:25 -0600317 td->o.ddir_seq_nr = 1;
Jens Axboe059b0802011-08-25 09:09:37 +0200318 td->o.ddir_seq_add = 0;
319
320 if (!nr)
321 return 0;
322
323 if (td_random(td))
Jens Axboe5736c102010-07-20 12:03:25 -0600324 td->o.ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200325 else {
326 long long val;
327
Jens Axboe6925dd32011-09-07 22:10:11 +0200328 if (str_to_decimal(nr, &val, 1, td)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200329 log_err("fio: rw postfix parsing failed\n");
330 free(nr);
331 return 1;
332 }
333
334 td->o.ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100335 }
Jens Axboe211097b2007-03-22 18:56:45 +0100336
Jens Axboe059b0802011-08-25 09:09:37 +0200337 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100338 return 0;
339}
340
Jens Axboe214e1ec2007-03-15 10:48:13 +0100341static int str_mem_cb(void *data, const char *mem)
342{
343 struct thread_data *td = data;
344
Shaohua Lid9759b12013-01-17 13:28:15 +0100345 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100346 td->mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100347
348 return 0;
349}
350
Jens Axboe5d7c5d32010-06-21 15:08:17 +0200351static int str_verify_cb(void *data, const char *mem)
352{
353 struct thread_data *td = data;
354
Jens Axboee3aaafc2012-02-22 20:28:17 +0100355 if (td->o.verify == VERIFY_CRC32C_INTEL ||
356 td->o.verify == VERIFY_CRC32C) {
357 crc32c_intel_probe();
Jens Axboe5d7c5d32010-06-21 15:08:17 +0200358 }
359
360 return 0;
361}
362
Jens Axboec223da82010-03-24 13:23:53 +0100363static int fio_clock_source_cb(void *data, const char *str)
364{
365 struct thread_data *td = data;
366
367 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100368 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100369 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100370 return 0;
371}
372
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400373static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200374{
375 struct thread_data *td = data;
376
377 td->o.rwmix[DDIR_READ] = *val;
378 td->o.rwmix[DDIR_WRITE] = 100 - *val;
379 return 0;
380}
381
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400382static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200383{
384 struct thread_data *td = data;
385
386 td->o.rwmix[DDIR_WRITE] = *val;
387 td->o.rwmix[DDIR_READ] = 100 - *val;
388 return 0;
389}
390
Jens Axboe214e1ec2007-03-15 10:48:13 +0100391#ifdef FIO_HAVE_IOPRIO
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400392static int str_prioclass_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100393{
394 struct thread_data *td = data;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200395 unsigned short mask;
396
397 /*
398 * mask off old class bits, str_prio_cb() may have set a default class
399 */
400 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
401 td->ioprio &= mask;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100402
403 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
Jens Axboeac684782007-11-08 08:29:07 +0100404 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100405 return 0;
406}
407
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400408static int str_prio_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100409{
410 struct thread_data *td = data;
411
412 td->ioprio |= *val;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200413
414 /*
415 * If no class is set, assume BE
416 */
417 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
418 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
419
Jens Axboeac684782007-11-08 08:29:07 +0100420 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100421 return 0;
422}
423#endif
424
425static int str_exitall_cb(void)
426{
427 exitall_on_terminate = 1;
428 return 0;
429}
430
Jens Axboe214e1ec2007-03-15 10:48:13 +0100431#ifdef FIO_HAVE_CPU_AFFINITY
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400432static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100433{
434 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200435 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100436 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100437 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100438
Jens Axboed2ce18b2008-12-12 20:51:40 +0100439 ret = fio_cpuset_init(&td->o.cpumask);
440 if (ret < 0) {
441 log_err("fio: cpuset_init failed\n");
442 td_verror(td, ret, "fio_cpuset_init");
443 return 1;
444 }
445
Jens Axboec00a2282011-07-08 20:56:06 +0200446 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200447
Jens Axboe62a72732008-12-08 11:37:01 +0100448 for (i = 0; i < sizeof(int) * 8; i++) {
449 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100450 if (i > max_cpu) {
451 log_err("fio: CPU %d too large (max=%ld)\n", i,
452 max_cpu);
453 return 1;
454 }
Jens Axboe62a72732008-12-08 11:37:01 +0100455 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100456 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100457 }
458 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200459
Jens Axboe375b2692007-05-22 09:13:02 +0200460 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100461 return 0;
462}
463
Jens Axboee8462bd2009-07-06 12:59:04 +0200464static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
465 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200466{
Jens Axboed2e268b2007-06-15 10:33:49 +0200467 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100468 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100469 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200470
Jens Axboee8462bd2009-07-06 12:59:04 +0200471 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100472 if (ret < 0) {
473 log_err("fio: cpuset_init failed\n");
474 td_verror(td, ret, "fio_cpuset_init");
475 return 1;
476 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200477
478 p = str = strdup(input);
479
480 strip_blank_front(&str);
481 strip_blank_end(str);
482
Jens Axboec00a2282011-07-08 20:56:06 +0200483 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100484
Jens Axboed2e268b2007-06-15 10:33:49 +0200485 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100486 char *str2, *cpu2;
487 int icpu, icpu2;
488
Jens Axboed2e268b2007-06-15 10:33:49 +0200489 if (!strlen(cpu))
490 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100491
492 str2 = cpu;
493 icpu2 = -1;
494 while ((cpu2 = strsep(&str2, "-")) != NULL) {
495 if (!strlen(cpu2))
496 break;
497
498 icpu2 = atoi(cpu2);
499 }
500
501 icpu = atoi(cpu);
502 if (icpu2 == -1)
503 icpu2 = icpu;
504 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100505 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100506 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100507 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100508 ret = 1;
509 break;
510 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100511 if (icpu > max_cpu) {
512 log_err("fio: CPU %d too large (max=%ld)\n",
513 icpu, max_cpu);
514 ret = 1;
515 break;
516 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200517
Jens Axboe62a72732008-12-08 11:37:01 +0100518 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200519 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100520 icpu++;
521 }
Jens Axboe19608d62008-12-08 15:03:12 +0100522 if (ret)
523 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200524 }
525
526 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100527 if (!ret)
528 td->o.cpumask_set = 1;
529 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200530}
Jens Axboee8462bd2009-07-06 12:59:04 +0200531
532static int str_cpus_allowed_cb(void *data, const char *input)
533{
534 struct thread_data *td = data;
535 int ret;
536
537 ret = set_cpus_allowed(td, &td->o.cpumask, input);
538 if (!ret)
539 td->o.cpumask_set = 1;
540
541 return ret;
542}
543
544static int str_verify_cpus_allowed_cb(void *data, const char *input)
545{
546 struct thread_data *td = data;
547 int ret;
548
549 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
550 if (!ret)
551 td->o.verify_cpumask_set = 1;
552
553 return ret;
554}
Jens Axboed2e268b2007-06-15 10:33:49 +0200555#endif
556
Jens Axboe67bf9822013-01-10 11:23:19 +0100557#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400558static int str_numa_cpunodes_cb(void *data, char *input)
559{
560 struct thread_data *td = data;
561
562 /* numa_parse_nodestring() parses a character string list
563 * of nodes into a bit mask. The bit mask is allocated by
564 * numa_allocate_nodemask(), so it should be freed by
565 * numa_free_nodemask().
566 */
567 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
568 if (td->o.numa_cpunodesmask == NULL) {
569 log_err("fio: numa_parse_nodestring failed\n");
570 td_verror(td, 1, "str_numa_cpunodes_cb");
571 return 1;
572 }
573
574 td->o.numa_cpumask_set = 1;
575 return 0;
576}
577
578static int str_numa_mpol_cb(void *data, char *input)
579{
580 struct thread_data *td = data;
581 const char * const policy_types[] =
582 { "default", "prefer", "bind", "interleave", "local" };
583 int i;
584
585 char *nodelist = strchr(input, ':');
586 if (nodelist) {
587 /* NUL-terminate mode */
588 *nodelist++ = '\0';
589 }
590
591 for (i = 0; i <= MPOL_LOCAL; i++) {
592 if (!strcmp(input, policy_types[i])) {
593 td->o.numa_mem_mode = i;
594 break;
595 }
596 }
597 if (i > MPOL_LOCAL) {
598 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
599 goto out;
600 }
601
602 switch (td->o.numa_mem_mode) {
603 case MPOL_PREFERRED:
604 /*
605 * Insist on a nodelist of one node only
606 */
607 if (nodelist) {
608 char *rest = nodelist;
609 while (isdigit(*rest))
610 rest++;
611 if (*rest) {
612 log_err("fio: one node only for \'prefer\'\n");
613 goto out;
614 }
615 } else {
616 log_err("fio: one node is needed for \'prefer\'\n");
617 goto out;
618 }
619 break;
620 case MPOL_INTERLEAVE:
621 /*
622 * Default to online nodes with memory if no nodelist
623 */
624 if (!nodelist)
625 nodelist = strdup("all");
626 break;
627 case MPOL_LOCAL:
628 case MPOL_DEFAULT:
629 /*
630 * Don't allow a nodelist
631 */
632 if (nodelist) {
633 log_err("fio: NO nodelist for \'local\'\n");
634 goto out;
635 }
636 break;
637 case MPOL_BIND:
638 /*
639 * Insist on a nodelist
640 */
641 if (!nodelist) {
642 log_err("fio: a nodelist is needed for \'bind\'\n");
643 goto out;
644 }
645 break;
646 }
647
648
649 /* numa_parse_nodestring() parses a character string list
650 * of nodes into a bit mask. The bit mask is allocated by
651 * numa_allocate_nodemask(), so it should be freed by
652 * numa_free_nodemask().
653 */
654 switch (td->o.numa_mem_mode) {
655 case MPOL_PREFERRED:
656 td->o.numa_mem_prefer_node = atoi(nodelist);
657 break;
658 case MPOL_INTERLEAVE:
659 case MPOL_BIND:
660 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
661 if (td->o.numa_memnodesmask == NULL) {
662 log_err("fio: numa_parse_nodestring failed\n");
663 td_verror(td, 1, "str_numa_memnodes_cb");
664 return 1;
665 }
666 break;
667 case MPOL_LOCAL:
668 case MPOL_DEFAULT:
669 default:
670 break;
671 }
672
673 td->o.numa_memmask_set = 1;
674 return 0;
675
676out:
677 return 1;
678}
679#endif
680
Jens Axboe214e1ec2007-03-15 10:48:13 +0100681static int str_fst_cb(void *data, const char *str)
682{
683 struct thread_data *td = data;
684 char *nr = get_opt_postfix(str);
685
686 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100687 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100688 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100689 free(nr);
690 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100691
692 return 0;
693}
694
Jens Axboe67bf9822013-01-10 11:23:19 +0100695#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100696static int str_sfr_cb(void *data, const char *str)
697{
698 struct thread_data *td = data;
699 char *nr = get_opt_postfix(str);
700
701 td->sync_file_range_nr = 1;
702 if (nr) {
703 td->sync_file_range_nr = atoi(nr);
704 free(nr);
705 }
706
707 return 0;
708}
Jens Axboe3ae06372010-03-19 19:17:15 +0100709#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100710
Jens Axboee25839d2012-11-06 10:49:42 +0100711static int str_random_distribution_cb(void *data, const char *str)
712{
713 struct thread_data *td = data;
714 double val;
715 char *nr;
716
Jens Axboe925fee32012-11-06 13:50:32 +0100717 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
718 val = 1.1;
719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
720 val = 0.2;
721 else
Jens Axboee25839d2012-11-06 10:49:42 +0100722 return 0;
723
724 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100725 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100726 log_err("fio: random postfix parsing failed\n");
727 free(nr);
728 return 1;
729 }
730
Jens Axboe078189c2012-11-07 13:47:22 +0100731 free(nr);
732
Jens Axboe18ded912012-11-08 08:36:00 +0100733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
734 if (val == 1.00) {
735 log_err("fio: zipf theta must different than 1.0\n");
736 return 1;
737 }
Jens Axboe888677a2013-04-10 22:19:46 +0200738 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100739 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100740 if (val <= 0.00 || val >= 1.00) {
741 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
742 return 1;
743 }
Jens Axboe888677a2013-04-10 22:19:46 +0200744 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100745 }
Jens Axboe925fee32012-11-06 13:50:32 +0100746
Jens Axboee25839d2012-11-06 10:49:42 +0100747 return 0;
748}
749
Jens Axboe921c7662008-03-26 09:17:55 +0100750static int check_dir(struct thread_data *td, char *fname)
751{
Jens Axboe3f0ca9b2011-05-24 21:36:24 +0200752#if 0
Jens Axboe921c7662008-03-26 09:17:55 +0100753 char file[PATH_MAX], *dir;
Jens Axboebc838912008-04-07 09:00:54 +0200754 int elen = 0;
Jens Axboe921c7662008-03-26 09:17:55 +0100755
Jens Axboebc838912008-04-07 09:00:54 +0200756 if (td->o.directory) {
757 strcpy(file, td->o.directory);
Jens Axboefcef0b32008-05-26 14:53:24 +0200758 strcat(file, "/");
Jens Axboebc838912008-04-07 09:00:54 +0200759 elen = strlen(file);
760 }
761
Jens Axboefcef0b32008-05-26 14:53:24 +0200762 sprintf(file + elen, "%s", fname);
Jens Axboe921c7662008-03-26 09:17:55 +0100763 dir = dirname(file);
764
Jens Axboefcef0b32008-05-26 14:53:24 +0200765 {
766 struct stat sb;
767 /*
768 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
769 * yet, so we can't do this check right here...
770 */
Jens Axboe921c7662008-03-26 09:17:55 +0100771 if (lstat(dir, &sb) < 0) {
772 int ret = errno;
773
774 log_err("fio: %s is not a directory\n", dir);
775 td_verror(td, ret, "lstat");
776 return 1;
777 }
778
779 if (!S_ISDIR(sb.st_mode)) {
780 log_err("fio: %s is not a directory\n", dir);
781 return 1;
782 }
Jens Axboefcef0b32008-05-26 14:53:24 +0200783 }
784#endif
Jens Axboe921c7662008-03-26 09:17:55 +0100785
786 return 0;
787}
788
Jens Axboe8e827d32009-08-04 09:51:48 +0200789/*
790 * Return next file in the string. Files are separated with ':'. If the ':'
791 * is escaped with a '\', then that ':' is part of the filename and does not
792 * indicate a new file.
793 */
794static char *get_next_file_name(char **ptr)
795{
796 char *str = *ptr;
797 char *p, *start;
798
799 if (!str || !strlen(str))
800 return NULL;
801
802 start = str;
803 do {
804 /*
805 * No colon, we are done
806 */
807 p = strchr(str, ':');
808 if (!p) {
809 *ptr = NULL;
810 break;
811 }
812
813 /*
814 * We got a colon, but it's the first character. Skip and
815 * continue
816 */
817 if (p == start) {
818 str = ++start;
819 continue;
820 }
821
822 if (*(p - 1) != '\\') {
823 *p = '\0';
824 *ptr = p + 1;
825 break;
826 }
827
828 memmove(p - 1, p, strlen(p) + 1);
829 str = p;
830 } while (1);
831
832 return start;
833}
834
Jens Axboe214e1ec2007-03-15 10:48:13 +0100835static int str_filename_cb(void *data, const char *input)
836{
837 struct thread_data *td = data;
838 char *fname, *str, *p;
839
840 p = str = strdup(input);
841
842 strip_blank_front(&str);
843 strip_blank_end(str);
844
845 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100846 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100847
Jens Axboe8e827d32009-08-04 09:51:48 +0200848 while ((fname = get_next_file_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100849 if (!strlen(fname))
850 break;
Jens Axboe921c7662008-03-26 09:17:55 +0100851 if (check_dir(td, fname)) {
852 free(p);
853 return 1;
854 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100855 add_file(td, fname);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100856 td->o.nr_files++;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100857 }
858
859 free(p);
860 return 0;
861}
862
863static int str_directory_cb(void *data, const char fio_unused *str)
864{
865 struct thread_data *td = data;
866 struct stat sb;
867
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100868 if (lstat(td->o.directory, &sb) < 0) {
Jens Axboe921c7662008-03-26 09:17:55 +0100869 int ret = errno;
870
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100871 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe921c7662008-03-26 09:17:55 +0100872 td_verror(td, ret, "lstat");
Jens Axboe214e1ec2007-03-15 10:48:13 +0100873 return 1;
874 }
875 if (!S_ISDIR(sb.st_mode)) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100876 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100877 return 1;
878 }
879
880 return 0;
881}
882
883static int str_opendir_cb(void *data, const char fio_unused *str)
884{
885 struct thread_data *td = data;
886
887 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100888 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100889
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100890 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100891}
892
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100893static int str_verify_pattern_cb(void *data, const char *input)
Jens Axboe90059d62007-07-30 09:33:12 +0200894{
895 struct thread_data *td = data;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100896 long off;
897 int i = 0, j = 0, len, k, base = 10;
898 char* loc1, * loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200899
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100900 loc1 = strstr(input, "0x");
901 loc2 = strstr(input, "0X");
902 if (loc1 || loc2)
903 base = 16;
904 off = strtol(input, NULL, base);
905 if (off != LONG_MAX || errno != ERANGE) {
906 while (off) {
907 td->o.verify_pattern[i] = off & 0xff;
908 off >>= 8;
909 i++;
910 }
911 } else {
912 len = strlen(input);
913 k = len - 1;
914 if (base == 16) {
915 if (loc1)
916 j = loc1 - input + 2;
917 else
918 j = loc2 - input + 2;
919 } else
920 return 1;
921 if (len - j < MAX_PATTERN_SIZE * 2) {
922 while (k >= j) {
923 off = converthexchartoint(input[k--]);
924 if (k >= j)
925 off += (converthexchartoint(input[k--])
926 * 16);
927 td->o.verify_pattern[i++] = (char) off;
928 }
929 }
930 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100931
932 /*
933 * Fill the pattern all the way to the end. This greatly reduces
934 * the number of memcpy's we have to do when verifying the IO.
935 */
936 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
937 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
938 i *= 2;
939 }
Steven Lang9a2a86d2012-02-07 09:42:59 +0100940 if (i == 1) {
941 /*
942 * The code in verify_io_u_pattern assumes a single byte pattern
943 * fills the whole verify pattern buffer.
944 */
945 memset(td->o.verify_pattern, td->o.verify_pattern[0],
946 MAX_PATTERN_SIZE);
947 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100948
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100949 td->o.verify_pattern_bytes = i;
Steven Langefcd9dc2012-02-02 20:22:04 +0100950
Jens Axboe92bf48d2011-01-14 21:20:42 +0100951 /*
952 * VERIFY_META could already be set
953 */
954 if (td->o.verify == VERIFY_NONE)
955 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +0100956
Jens Axboe90059d62007-07-30 09:33:12 +0200957 return 0;
958}
Jens Axboe214e1ec2007-03-15 10:48:13 +0100959
Jens Axboee3cedca2008-11-19 19:57:52 +0100960static int str_write_bw_log_cb(void *data, const char *str)
961{
962 struct thread_data *td = data;
963
964 if (str)
965 td->o.bw_log_file = strdup(str);
966
967 td->o.write_bw_log = 1;
968 return 0;
969}
970
971static int str_write_lat_log_cb(void *data, const char *str)
972{
973 struct thread_data *td = data;
974
975 if (str)
976 td->o.lat_log_file = strdup(str);
977
978 td->o.write_lat_log = 1;
979 return 0;
980}
981
Jens Axboec8eeb9d2011-10-05 14:02:22 +0200982static int str_write_iops_log_cb(void *data, const char *str)
983{
984 struct thread_data *td = data;
985
986 if (str)
987 td->o.iops_log_file = strdup(str);
988
989 td->o.write_iops_log = 1;
990 return 0;
991}
992
Jens Axboe993bf482008-11-14 13:04:53 +0100993static int str_gtod_reduce_cb(void *data, int *il)
994{
995 struct thread_data *td = data;
996 int val = *il;
997
Jens Axboe02af0982010-06-24 09:59:34 +0200998 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +0100999 td->o.disable_clat = !!val;
1000 td->o.disable_slat = !!val;
1001 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001002 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001003 if (val)
1004 td->tv_cache_mask = 63;
1005
1006 return 0;
1007}
1008
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001009static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001010{
1011 struct thread_data *td = data;
1012 int val = *il;
1013
1014 td->o.gtod_cpu = val;
1015 td->o.gtod_offload = 1;
1016 return 0;
1017}
1018
Jens Axboe7bb59102011-07-12 19:47:03 +02001019static int str_size_cb(void *data, unsigned long long *__val)
1020{
1021 struct thread_data *td = data;
1022 unsigned long long v = *__val;
1023
1024 if (parse_is_percent(v)) {
1025 td->o.size = 0;
1026 td->o.size_percent = -1ULL - v;
1027 } else
1028 td->o.size = v;
1029
1030 return 0;
1031}
1032
Jens Axboe896cac22009-07-01 10:38:35 +02001033static int rw_verify(struct fio_option *o, void *data)
1034{
1035 struct thread_data *td = data;
1036
1037 if (read_only && td_write(td)) {
1038 log_err("fio: job <%s> has write bit set, but fio is in"
1039 " read-only mode\n", td->o.name);
1040 return 1;
1041 }
1042
1043 return 0;
1044}
1045
Jens Axboe276ca4f2009-07-01 10:43:05 +02001046static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001047{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001048#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001049 struct thread_data *td = data;
1050
Jens Axboe29d43ff2009-07-01 10:42:18 +02001051 if (td->o.gtod_cpu) {
1052 log_err("fio: platform must support CPU affinity for"
1053 "gettimeofday() offloading\n");
1054 return 1;
1055 }
1056#endif
1057
1058 return 0;
1059}
1060
Jens Axboe214e1ec2007-03-15 10:48:13 +01001061/*
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001062 * Option grouping
1063 */
1064static struct opt_group fio_opt_groups[] = {
1065 {
1066 .name = "General",
1067 .mask = FIO_OPT_C_GENERAL,
1068 },
1069 {
1070 .name = "I/O",
1071 .mask = FIO_OPT_C_IO,
1072 },
1073 {
1074 .name = "File",
1075 .mask = FIO_OPT_C_FILE,
1076 },
1077 {
1078 .name = "Statistics",
1079 .mask = FIO_OPT_C_STAT,
1080 },
1081 {
1082 .name = "Logging",
1083 .mask = FIO_OPT_C_LOG,
1084 },
1085 {
1086 .name = "Profiles",
1087 .mask = FIO_OPT_C_PROFILE,
1088 },
1089 {
1090 .name = NULL,
1091 },
1092};
1093
1094static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1095 unsigned int inv_mask)
1096{
1097 struct opt_group *og;
1098 int i;
1099
1100 if (*mask == inv_mask || !*mask)
1101 return NULL;
1102
1103 for (i = 0; ogs[i].name; i++) {
1104 og = &ogs[i];
1105
1106 if (*mask & og->mask) {
1107 *mask &= ~(og->mask);
1108 return og;
1109 }
1110 }
1111
1112 return NULL;
1113}
1114
1115struct opt_group *opt_group_from_mask(unsigned int *mask)
1116{
1117 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1118}
1119
1120static struct opt_group fio_opt_cat_groups[] = {
1121 {
1122 .name = "Rate",
1123 .mask = FIO_OPT_G_RATE,
1124 },
1125 {
1126 .name = "Zone",
1127 .mask = FIO_OPT_G_ZONE,
1128 },
1129 {
1130 .name = "Read/write mix",
1131 .mask = FIO_OPT_G_RWMIX,
1132 },
1133 {
1134 .name = "Verify",
1135 .mask = FIO_OPT_G_VERIFY,
1136 },
1137 {
1138 .name = "Trim",
1139 .mask = FIO_OPT_G_TRIM,
1140 },
1141 {
1142 .name = "I/O Logging",
1143 .mask = FIO_OPT_G_IOLOG,
1144 },
1145 {
1146 .name = "I/O Depth",
1147 .mask = FIO_OPT_G_IO_DEPTH,
1148 },
1149 {
1150 .name = "I/O Flow",
1151 .mask = FIO_OPT_G_IO_FLOW,
1152 },
1153 {
1154 .name = "Description",
1155 .mask = FIO_OPT_G_DESC,
1156 },
1157 {
1158 .name = "Filename",
1159 .mask = FIO_OPT_G_FILENAME,
1160 },
1161 {
1162 .name = "General I/O",
1163 .mask = FIO_OPT_G_IO_BASIC,
1164 },
1165 {
1166 .name = "Cgroups",
1167 .mask = FIO_OPT_G_CGROUP,
1168 },
1169 {
1170 .name = "Runtime",
1171 .mask = FIO_OPT_G_RUNTIME,
1172 },
1173 {
1174 .name = "Process",
1175 .mask = FIO_OPT_G_PROCESS,
1176 },
1177 {
1178 .name = "Job credentials / priority",
1179 .mask = FIO_OPT_G_CRED,
1180 },
1181 {
1182 .name = "Clock settings",
1183 .mask = FIO_OPT_G_CLOCK,
1184 },
1185 {
1186 .name = "I/O Type",
1187 .mask = FIO_OPT_G_IO_TYPE,
1188 },
1189 {
1190 .name = "I/O Thinktime",
1191 .mask = FIO_OPT_G_THINKTIME,
1192 },
1193 {
1194 .name = "Randomizations",
1195 .mask = FIO_OPT_G_RANDOM,
1196 },
1197 {
1198 .name = "I/O buffers",
1199 .mask = FIO_OPT_G_IO_BUF,
1200 },
1201 {
1202 .name = "Tiobench profile",
1203 .mask = FIO_OPT_G_TIOBENCH,
1204 },
1205
1206 {
1207 .name = NULL,
1208 }
1209};
1210
1211struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1212{
1213 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1214}
1215
1216/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001217 * Map of job/command line options
1218 */
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001219static struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001220 {
1221 .name = "description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001222 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001223 .type = FIO_OPT_STR_STORE,
1224 .off1 = td_var_offset(description),
1225 .help = "Text job description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001226 .category = FIO_OPT_C_GENERAL,
1227 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001228 },
1229 {
1230 .name = "name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001231 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001232 .type = FIO_OPT_STR_STORE,
1233 .off1 = td_var_offset(name),
1234 .help = "Name of this job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001235 .category = FIO_OPT_C_GENERAL,
1236 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001237 },
1238 {
1239 .name = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001240 .lname = "Filename(s)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001241 .type = FIO_OPT_STR_STORE,
1242 .off1 = td_var_offset(filename),
1243 .cb = str_filename_cb,
Jens Axboef0d524b2009-04-27 08:00:48 +02001244 .prio = -1, /* must come after "directory" */
Jens Axboe214e1ec2007-03-15 10:48:13 +01001245 .help = "File(s) to use for the workload",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001246 .category = FIO_OPT_C_FILE,
1247 .group = FIO_OPT_G_FILENAME,
1248 },
1249 {
1250 .name = "directory",
1251 .lname = "Directory",
1252 .type = FIO_OPT_STR_STORE,
1253 .off1 = td_var_offset(directory),
1254 .cb = str_directory_cb,
1255 .help = "Directory to store files in",
1256 .category = FIO_OPT_C_FILE,
1257 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001258 },
1259 {
Jens Axboede98bd32013-04-05 11:09:20 +02001260 .name = "filename_format",
1261 .type = FIO_OPT_STR_STORE,
1262 .off1 = td_var_offset(filename_format),
1263 .prio = -1, /* must come after "directory" */
1264 .help = "Override default $jobname.$jobnum.$filenum naming",
1265 .def = "$jobname.$jobnum.$filenum",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001266 .category = FIO_OPT_C_FILE,
1267 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001268 },
1269 {
Jens Axboe29c13492008-03-01 19:25:20 +01001270 .name = "lockfile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001271 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001272 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001273 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001274 .help = "Lock file when doing IO to it",
1275 .parent = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001276 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001277 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001278 .category = FIO_OPT_C_FILE,
1279 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001280 .posval = {
1281 { .ival = "none",
1282 .oval = FILE_LOCK_NONE,
1283 .help = "No file locking",
1284 },
1285 { .ival = "exclusive",
1286 .oval = FILE_LOCK_EXCLUSIVE,
1287 .help = "Exclusive file lock",
1288 },
1289 {
1290 .ival = "readwrite",
1291 .oval = FILE_LOCK_READWRITE,
1292 .help = "Read vs write lock",
1293 },
1294 },
Jens Axboe29c13492008-03-01 19:25:20 +01001295 },
1296 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001297 .name = "opendir",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001298 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001299 .type = FIO_OPT_STR_STORE,
1300 .off1 = td_var_offset(opendir),
1301 .cb = str_opendir_cb,
1302 .help = "Recursively add files from this directory and down",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001303 .category = FIO_OPT_C_FILE,
1304 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001305 },
1306 {
1307 .name = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001308 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001309 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001310 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001311 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001312 .off1 = td_var_offset(td_ddir),
1313 .help = "IO direction",
1314 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001315 .verify = rw_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001316 .category = FIO_OPT_C_IO,
1317 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001318 .posval = {
1319 { .ival = "read",
1320 .oval = TD_DDIR_READ,
1321 .help = "Sequential read",
1322 },
1323 { .ival = "write",
1324 .oval = TD_DDIR_WRITE,
1325 .help = "Sequential write",
1326 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001327 { .ival = "trim",
1328 .oval = TD_DDIR_TRIM,
1329 .help = "Sequential trim",
1330 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001331 { .ival = "randread",
1332 .oval = TD_DDIR_RANDREAD,
1333 .help = "Random read",
1334 },
1335 { .ival = "randwrite",
1336 .oval = TD_DDIR_RANDWRITE,
1337 .help = "Random write",
1338 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001339 { .ival = "randtrim",
1340 .oval = TD_DDIR_RANDTRIM,
1341 .help = "Random trim",
1342 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001343 { .ival = "rw",
1344 .oval = TD_DDIR_RW,
1345 .help = "Sequential read and write mix",
1346 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001347 { .ival = "readwrite",
1348 .oval = TD_DDIR_RW,
1349 .help = "Sequential read and write mix",
1350 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001351 { .ival = "randrw",
1352 .oval = TD_DDIR_RANDRW,
1353 .help = "Random read and write mix"
1354 },
1355 },
1356 },
1357 {
Jens Axboe38dad622010-07-20 14:46:00 -06001358 .name = "rw_sequencer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001359 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001360 .type = FIO_OPT_STR,
1361 .off1 = td_var_offset(rw_seq),
1362 .help = "IO offset generator modifier",
1363 .def = "sequential",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001364 .category = FIO_OPT_C_IO,
1365 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001366 .posval = {
1367 { .ival = "sequential",
1368 .oval = RW_SEQ_SEQ,
1369 .help = "Generate sequential offsets",
1370 },
1371 { .ival = "identical",
1372 .oval = RW_SEQ_IDENT,
1373 .help = "Generate identical offsets",
1374 },
1375 },
1376 },
1377
1378 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001379 .name = "ioengine",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001380 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001381 .type = FIO_OPT_STR_STORE,
1382 .off1 = td_var_offset(ioengine),
1383 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001384 .def = FIO_PREFERRED_ENGINE,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001385 .category = FIO_OPT_C_IO,
1386 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001387 .posval = {
1388 { .ival = "sync",
1389 .help = "Use read/write",
1390 },
gurudas paia31041e2007-10-23 15:12:30 +02001391 { .ival = "psync",
1392 .help = "Use pread/pwrite",
1393 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001394 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001395 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001396 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001397#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001398 { .ival = "libaio",
1399 .help = "Linux native asynchronous IO",
1400 },
1401#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001402#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001403 { .ival = "posixaio",
1404 .help = "POSIX asynchronous IO",
1405 },
1406#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001407#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001408 { .ival = "solarisaio",
1409 .help = "Solaris native asynchronous IO",
1410 },
1411#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001412#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001413 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001414 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001415 },
Jens Axboe3be80072011-01-19 11:07:28 -07001416#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001417 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001418 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001419 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001420#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001421 { .ival = "splice",
1422 .help = "splice/vmsplice based IO",
1423 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001424 { .ival = "netsplice",
1425 .help = "splice/vmsplice to/from the network",
1426 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001427#endif
1428#ifdef FIO_HAVE_SGIO
1429 { .ival = "sg",
1430 .help = "SCSI generic v3 IO",
1431 },
1432#endif
1433 { .ival = "null",
1434 .help = "Testing engine (no data transfer)",
1435 },
1436 { .ival = "net",
1437 .help = "Network IO",
1438 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001439 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001440 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001441 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001442#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001443 { .ival = "guasi",
1444 .help = "GUASI IO engine",
1445 },
1446#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001447#ifdef FIO_HAVE_BINJECT
1448 { .ival = "binject",
1449 .help = "binject direct inject block engine",
1450 },
1451#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001452#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001453 { .ival = "rdma",
1454 .help = "RDMA IO engine",
1455 },
1456#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001457#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001458 { .ival = "fusion-aw-sync",
1459 .help = "Fusion-io atomic write engine",
1460 },
1461#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001462#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001463 { .ival = "e4defrag",
1464 .help = "ext4 defrag engine",
1465 },
1466#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001467#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001468 { .ival = "falloc",
1469 .help = "fallocate() file based engine",
1470 },
1471#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001472 { .ival = "external",
1473 .help = "Load external engine (append name)",
1474 },
1475 },
1476 },
1477 {
1478 .name = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001479 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001480 .type = FIO_OPT_INT,
1481 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001482 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001483 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001484 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001485 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001486 .category = FIO_OPT_C_IO,
1487 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001488 },
1489 {
1490 .name = "iodepth_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001491 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001492 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001493 .type = FIO_OPT_INT,
1494 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001495 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001496 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001497 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001498 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001499 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001500 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001501 .category = FIO_OPT_C_IO,
1502 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001503 },
1504 {
Jens Axboe49504212008-06-05 09:03:30 +02001505 .name = "iodepth_batch_complete",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001506 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001507 .type = FIO_OPT_INT,
1508 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001509 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001510 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001511 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001512 .minval = 0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001513 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001514 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001515 .category = FIO_OPT_C_IO,
1516 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001517 },
1518 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001519 .name = "iodepth_low",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001520 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001521 .type = FIO_OPT_INT,
1522 .off1 = td_var_offset(iodepth_low),
1523 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001524 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001525 .hide = 1,
1526 .interval = 1,
1527 .category = FIO_OPT_C_IO,
1528 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001529 },
1530 {
1531 .name = "size",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001532 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001533 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001534 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001535 .help = "Total size of device or files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001536 .interval = 1024 * 1024,
1537 .category = FIO_OPT_C_IO,
1538 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001539 },
1540 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001541 .name = "fill_device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001542 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001543 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001544 .type = FIO_OPT_BOOL,
1545 .off1 = td_var_offset(fill_device),
1546 .help = "Write until an ENOSPC error occurs",
1547 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001548 .category = FIO_OPT_C_FILE,
1549 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001550 },
1551 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001552 .name = "filesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001553 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001554 .type = FIO_OPT_STR_VAL,
1555 .off1 = td_var_offset(file_size_low),
1556 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001557 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001558 .help = "Size of individual files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001559 .interval = 1024 * 1024,
1560 .category = FIO_OPT_C_FILE,
1561 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001562 },
1563 {
Jens Axboe67a10002007-07-31 23:12:16 +02001564 .name = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001565 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001566 .alias = "fileoffset",
1567 .type = FIO_OPT_STR_VAL,
1568 .off1 = td_var_offset(start_offset),
1569 .help = "Start IO from this offset",
1570 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001571 .interval = 1024 * 1024,
1572 .category = FIO_OPT_C_IO,
1573 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001574 },
1575 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001576 .name = "offset_increment",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001577 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001578 .type = FIO_OPT_STR_VAL,
1579 .off1 = td_var_offset(offset_increment),
1580 .help = "What is the increment from one offset to the next",
1581 .parent = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001582 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001583 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001584 .interval = 1024 * 1024,
1585 .category = FIO_OPT_C_IO,
1586 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001587 },
1588 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001589 .name = "bs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001590 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001591 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001592 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001593 .off1 = td_var_offset(bs[DDIR_READ]),
1594 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001595 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001596 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001597 .help = "Block size unit",
1598 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001599 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001600 .hide = 1,
1601 .interval = 512,
1602 .category = FIO_OPT_C_IO,
1603 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001604 },
1605 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001606 .name = "ba",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001607 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001608 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001609 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001610 .off1 = td_var_offset(ba[DDIR_READ]),
1611 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001612 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001613 .minval = 1,
1614 .help = "IO block offset alignment",
1615 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001616 .hide = 1,
1617 .interval = 512,
1618 .category = FIO_OPT_C_IO,
1619 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001620 },
1621 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001622 .name = "bsrange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001623 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001624 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001625 .type = FIO_OPT_RANGE,
1626 .off1 = td_var_offset(min_bs[DDIR_READ]),
1627 .off2 = td_var_offset(max_bs[DDIR_READ]),
1628 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1629 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001630 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1631 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001632 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001633 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001634 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001635 .hide = 1,
1636 .interval = 4096,
1637 .category = FIO_OPT_C_IO,
1638 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001639 },
1640 {
Jens Axboe564ca972007-12-14 12:21:19 +01001641 .name = "bssplit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001642 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001643 .type = FIO_OPT_STR,
1644 .cb = str_bssplit_cb,
1645 .help = "Set a specific mix of block sizes",
1646 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001647 .hide = 1,
1648 .category = FIO_OPT_C_IO,
1649 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001650 },
1651 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001652 .name = "bs_unaligned",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001653 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001654 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001655 .type = FIO_OPT_STR_SET,
1656 .off1 = td_var_offset(bs_unaligned),
1657 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001658 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001659 .hide = 1,
1660 .category = FIO_OPT_C_IO,
1661 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001662 },
1663 {
1664 .name = "randrepeat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001665 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001666 .type = FIO_OPT_BOOL,
1667 .off1 = td_var_offset(rand_repeatable),
1668 .help = "Use repeatable random IO pattern",
1669 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001670 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001671 .hide = 1,
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001674 },
1675 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001676 .name = "use_os_rand",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001677 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001678 .type = FIO_OPT_BOOL,
1679 .off1 = td_var_offset(use_os_rand),
1680 .help = "Set to use OS random generator",
1681 .def = "0",
1682 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001683 .hide = 1,
1684 .category = FIO_OPT_C_IO,
1685 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001686 },
1687 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001688 .name = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001689 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001690 .type = FIO_OPT_STR_SET,
1691 .off1 = td_var_offset(norandommap),
1692 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001693 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001694 .hide = 1,
1695 .hide_on_set = 1,
1696 .category = FIO_OPT_C_IO,
1697 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001698 },
1699 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001700 .name = "softrandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001701 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001702 .type = FIO_OPT_BOOL,
1703 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001704 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001705 .parent = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001706 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001707 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001710 },
1711 {
Jens Axboe8055e412012-11-26 08:43:47 +01001712 .name = "random_generator",
1713 .type = FIO_OPT_STR,
1714 .off1 = td_var_offset(random_generator),
1715 .help = "Type of random number generator to use",
1716 .def = "tausworthe",
1717 .posval = {
1718 { .ival = "tausworthe",
1719 .oval = FIO_RAND_GEN_TAUSWORTHE,
1720 .help = "Strong Tausworthe generator",
1721 },
1722 { .ival = "lfsr",
1723 .oval = FIO_RAND_GEN_LFSR,
1724 .help = "Variable length LFSR",
1725 },
1726 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001727 .category = FIO_OPT_C_IO,
1728 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001729 },
1730 {
Jens Axboee25839d2012-11-06 10:49:42 +01001731 .name = "random_distribution",
1732 .type = FIO_OPT_STR,
1733 .off1 = td_var_offset(random_distribution),
1734 .cb = str_random_distribution_cb,
1735 .help = "Random offset distribution generator",
1736 .def = "random",
1737 .posval = {
1738 { .ival = "random",
1739 .oval = FIO_RAND_DIST_RANDOM,
1740 .help = "Completely random",
1741 },
1742 { .ival = "zipf",
1743 .oval = FIO_RAND_DIST_ZIPF,
1744 .help = "Zipf distribution",
1745 },
Jens Axboe925fee32012-11-06 13:50:32 +01001746 { .ival = "pareto",
1747 .oval = FIO_RAND_DIST_PARETO,
1748 .help = "Pareto distribution",
1749 },
Jens Axboee25839d2012-11-06 10:49:42 +01001750 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001751 .category = FIO_OPT_C_IO,
1752 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001753 },
1754 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001755 .name = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001756 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001757 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001758 .type = FIO_OPT_INT,
1759 .off1 = td_var_offset(nr_files),
1760 .help = "Split job workload between this number of files",
1761 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001762 .interval = 1,
1763 .category = FIO_OPT_C_FILE,
1764 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001765 },
1766 {
1767 .name = "openfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001768 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001769 .type = FIO_OPT_INT,
1770 .off1 = td_var_offset(open_files),
1771 .help = "Number of files to keep open at the same time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001772 .category = FIO_OPT_C_FILE,
1773 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001774 },
1775 {
1776 .name = "file_service_type",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001777 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001778 .type = FIO_OPT_STR,
1779 .cb = str_fst_cb,
1780 .off1 = td_var_offset(file_service_type),
1781 .help = "How to select which file to service next",
1782 .def = "roundrobin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001783 .category = FIO_OPT_C_FILE,
1784 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001785 .posval = {
1786 { .ival = "random",
1787 .oval = FIO_FSERVICE_RANDOM,
1788 .help = "Choose a file at random",
1789 },
1790 { .ival = "roundrobin",
1791 .oval = FIO_FSERVICE_RR,
1792 .help = "Round robin select files",
1793 },
Jens Axboea086c252009-03-04 08:27:37 +01001794 { .ival = "sequential",
1795 .oval = FIO_FSERVICE_SEQ,
1796 .help = "Finish one file before moving to the next",
1797 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001798 },
Jens Axboe67a10002007-07-31 23:12:16 +02001799 .parent = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001800 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001801 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001802#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001803 {
1804 .name = "fallocate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001805 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001806 .type = FIO_OPT_STR,
1807 .off1 = td_var_offset(fallocate_mode),
1808 .help = "Whether pre-allocation is performed when laying out files",
1809 .def = "posix",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001810 .category = FIO_OPT_C_FILE,
1811 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001812 .posval = {
1813 { .ival = "none",
1814 .oval = FIO_FALLOCATE_NONE,
1815 .help = "Do not pre-allocate space",
1816 },
1817 { .ival = "posix",
1818 .oval = FIO_FALLOCATE_POSIX,
1819 .help = "Use posix_fallocate()",
1820 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001821#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001822 { .ival = "keep",
1823 .oval = FIO_FALLOCATE_KEEP_SIZE,
1824 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1825 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001826#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001827 /* Compatibility with former boolean values */
1828 { .ival = "0",
1829 .oval = FIO_FALLOCATE_NONE,
1830 .help = "Alias for 'none'",
1831 },
1832 { .ival = "1",
1833 .oval = FIO_FALLOCATE_POSIX,
1834 .help = "Alias for 'posix'",
1835 },
1836 },
1837 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001838#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001839 {
1840 .name = "fadvise_hint",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001841 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001842 .type = FIO_OPT_BOOL,
1843 .off1 = td_var_offset(fadvise_hint),
1844 .help = "Use fadvise() to advise the kernel on IO pattern",
1845 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001846 .category = FIO_OPT_C_FILE,
1847 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001848 },
1849 {
1850 .name = "fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001851 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001852 .type = FIO_OPT_INT,
1853 .off1 = td_var_offset(fsync_blocks),
1854 .help = "Issue fsync for writes every given number of blocks",
1855 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001856 .interval = 1,
1857 .category = FIO_OPT_C_FILE,
1858 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001859 },
1860 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001861 .name = "fdatasync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001862 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001863 .type = FIO_OPT_INT,
1864 .off1 = td_var_offset(fdatasync_blocks),
1865 .help = "Issue fdatasync for writes every given number of blocks",
1866 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001867 .interval = 1,
1868 .category = FIO_OPT_C_FILE,
1869 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001870 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001871 {
1872 .name = "write_barrier",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001873 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001874 .type = FIO_OPT_INT,
1875 .off1 = td_var_offset(barrier_blocks),
1876 .help = "Make every Nth write a barrier write",
1877 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001878 .interval = 1,
1879 .category = FIO_OPT_C_IO,
1880 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001881 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001882#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01001883 {
1884 .name = "sync_file_range",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001885 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01001886 .posval = {
1887 { .ival = "wait_before",
1888 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1889 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001890 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001891 },
1892 { .ival = "write",
1893 .oval = SYNC_FILE_RANGE_WRITE,
1894 .help = "SYNC_FILE_RANGE_WRITE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001895 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001896 },
1897 {
1898 .ival = "wait_after",
1899 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1900 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Jens Axboe3843deb2010-03-09 20:41:15 +01001901 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001902 },
1903 },
Jens Axboe3843deb2010-03-09 20:41:15 +01001904 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01001905 .cb = str_sfr_cb,
1906 .off1 = td_var_offset(sync_file_range),
1907 .help = "Use sync_file_range()",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001908 .category = FIO_OPT_C_FILE,
1909 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01001910 },
1911#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02001912 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001913 .name = "direct",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001914 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001915 .type = FIO_OPT_BOOL,
1916 .off1 = td_var_offset(odirect),
1917 .help = "Use O_DIRECT IO (negates buffered)",
1918 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001919 .inverse = "buffered",
1920 .category = FIO_OPT_C_IO,
1921 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001922 },
1923 {
1924 .name = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001925 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001926 .type = FIO_OPT_BOOL,
1927 .off1 = td_var_offset(odirect),
1928 .neg = 1,
1929 .help = "Use buffered IO (negates direct)",
1930 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001931 .inverse = "direct",
1932 .category = FIO_OPT_C_IO,
1933 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001934 },
1935 {
1936 .name = "overwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001937 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001938 .type = FIO_OPT_BOOL,
1939 .off1 = td_var_offset(overwrite),
1940 .help = "When writing, set whether to overwrite current data",
1941 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001942 .category = FIO_OPT_C_FILE,
1943 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001944 },
1945 {
1946 .name = "loops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001947 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001948 .type = FIO_OPT_INT,
1949 .off1 = td_var_offset(loops),
1950 .help = "Number of times to run the job",
1951 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001952 .interval = 1,
1953 .category = FIO_OPT_C_GENERAL,
1954 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001955 },
1956 {
1957 .name = "numjobs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001958 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001959 .type = FIO_OPT_INT,
1960 .off1 = td_var_offset(numjobs),
1961 .help = "Duplicate this job this many times",
1962 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001963 .interval = 1,
1964 .category = FIO_OPT_C_GENERAL,
1965 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001966 },
1967 {
1968 .name = "startdelay",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001969 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02001970 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001971 .off1 = td_var_offset(start_delay),
1972 .help = "Only start job when this period has passed",
1973 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001974 .category = FIO_OPT_C_GENERAL,
1975 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001976 },
1977 {
1978 .name = "runtime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001979 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001980 .alias = "timeout",
1981 .type = FIO_OPT_STR_VAL_TIME,
1982 .off1 = td_var_offset(timeout),
1983 .help = "Stop workload when this amount of time has passed",
1984 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001985 .category = FIO_OPT_C_GENERAL,
1986 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001987 },
1988 {
Jens Axboecf4464c2007-04-17 20:14:42 +02001989 .name = "time_based",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001990 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02001991 .type = FIO_OPT_STR_SET,
1992 .off1 = td_var_offset(time_based),
1993 .help = "Keep running until runtime/timeout is met",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001994 .category = FIO_OPT_C_GENERAL,
1995 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02001996 },
1997 {
Jens Axboe721938a2008-09-10 09:46:16 +02001998 .name = "ramp_time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001999 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002000 .type = FIO_OPT_STR_VAL_TIME,
2001 .off1 = td_var_offset(ramp_time),
2002 .help = "Ramp up time before measuring performance",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002003 .category = FIO_OPT_C_GENERAL,
2004 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002005 },
2006 {
Jens Axboec223da82010-03-24 13:23:53 +01002007 .name = "clocksource",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002008 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002009 .type = FIO_OPT_STR,
2010 .cb = fio_clock_source_cb,
2011 .off1 = td_var_offset(clocksource),
2012 .help = "What type of timing source to use",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002013 .category = FIO_OPT_C_GENERAL,
2014 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002015 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002016#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002017 { .ival = "gettimeofday",
2018 .oval = CS_GTOD,
2019 .help = "Use gettimeofday(2) for timing",
2020 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002021#endif
2022#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002023 { .ival = "clock_gettime",
2024 .oval = CS_CGETTIME,
2025 .help = "Use clock_gettime(2) for timing",
2026 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002027#endif
Jens Axboec223da82010-03-24 13:23:53 +01002028#ifdef ARCH_HAVE_CPU_CLOCK
2029 { .ival = "cpu",
2030 .oval = CS_CPUCLOCK,
2031 .help = "Use CPU private clock",
2032 },
2033#endif
2034 },
2035 },
2036 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002037 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002038 .alias = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002039 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002040 .type = FIO_OPT_STR,
2041 .cb = str_mem_cb,
2042 .off1 = td_var_offset(mem_type),
2043 .help = "Backing type for IO buffers",
2044 .def = "malloc",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002045 .category = FIO_OPT_C_IO,
2046 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002047 .posval = {
2048 { .ival = "malloc",
2049 .oval = MEM_MALLOC,
2050 .help = "Use malloc(3) for IO buffers",
2051 },
Jens Axboeb370e462007-03-19 10:51:49 +01002052 { .ival = "shm",
2053 .oval = MEM_SHM,
2054 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002055 },
2056#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002057 { .ival = "shmhuge",
2058 .oval = MEM_SHMHUGE,
2059 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002060 },
2061#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002062 { .ival = "mmap",
2063 .oval = MEM_MMAP,
2064 .help = "Use mmap(2) (file or anon) for IO buffers",
2065 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002066#ifdef FIO_HAVE_HUGETLB
2067 { .ival = "mmaphuge",
2068 .oval = MEM_MMAPHUGE,
2069 .help = "Like mmap, but use huge pages",
2070 },
2071#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002072 },
2073 },
2074 {
Jens Axboed529ee12009-07-01 10:33:03 +02002075 .name = "iomem_align",
2076 .alias = "mem_align",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002077 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002078 .type = FIO_OPT_INT,
2079 .off1 = td_var_offset(mem_align),
2080 .minval = 0,
2081 .help = "IO memory buffer offset alignment",
2082 .def = "0",
2083 .parent = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002084 .hide = 1,
2085 .category = FIO_OPT_C_IO,
2086 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002087 },
2088 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002089 .name = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002090 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002091 .type = FIO_OPT_STR,
2092 .off1 = td_var_offset(verify),
2093 .help = "Verify data written",
Jens Axboe5d7c5d32010-06-21 15:08:17 +02002094 .cb = str_verify_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002095 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002096 .category = FIO_OPT_C_IO,
2097 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002098 .posval = {
2099 { .ival = "0",
2100 .oval = VERIFY_NONE,
2101 .help = "Don't do IO verification",
2102 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002103 { .ival = "md5",
2104 .oval = VERIFY_MD5,
2105 .help = "Use md5 checksums for verification",
2106 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002107 { .ival = "crc64",
2108 .oval = VERIFY_CRC64,
2109 .help = "Use crc64 checksums for verification",
2110 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002111 { .ival = "crc32",
2112 .oval = VERIFY_CRC32,
2113 .help = "Use crc32 checksums for verification",
2114 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002115 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002116 .oval = VERIFY_CRC32C,
2117 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002118 },
Jens Axboebac39e02008-06-11 20:46:19 +02002119 { .ival = "crc32c",
2120 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002121 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002122 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002123 { .ival = "crc16",
2124 .oval = VERIFY_CRC16,
2125 .help = "Use crc16 checksums for verification",
2126 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002127 { .ival = "crc7",
2128 .oval = VERIFY_CRC7,
2129 .help = "Use crc7 checksums for verification",
2130 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002131 { .ival = "sha1",
2132 .oval = VERIFY_SHA1,
2133 .help = "Use sha1 checksums for verification",
2134 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002135 { .ival = "sha256",
2136 .oval = VERIFY_SHA256,
2137 .help = "Use sha256 checksums for verification",
2138 },
2139 { .ival = "sha512",
2140 .oval = VERIFY_SHA512,
2141 .help = "Use sha512 checksums for verification",
2142 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002143 { .ival = "meta",
2144 .oval = VERIFY_META,
2145 .help = "Use io information",
2146 },
Jens Axboe36690c92007-03-26 10:23:34 +02002147 {
2148 .ival = "null",
2149 .oval = VERIFY_NULL,
2150 .help = "Pretend to verify",
2151 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002152 },
2153 },
2154 {
Jens Axboe005c5652007-08-02 22:21:36 +02002155 .name = "do_verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002156 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002157 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002158 .off1 = td_var_offset(do_verify),
2159 .help = "Run verification stage after write",
2160 .def = "1",
2161 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002162 .hide = 1,
2163 .category = FIO_OPT_C_IO,
2164 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002165 },
2166 {
Jens Axboe160b9662007-03-27 10:59:49 +02002167 .name = "verifysort",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002168 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002169 .type = FIO_OPT_BOOL,
2170 .off1 = td_var_offset(verifysort),
2171 .help = "Sort written verify blocks for read back",
2172 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002173 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002174 .hide = 1,
2175 .category = FIO_OPT_C_IO,
2176 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002177 },
2178 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002179 .name = "verifysort_nr",
2180 .type = FIO_OPT_INT,
2181 .off1 = td_var_offset(verifysort_nr),
2182 .help = "Pre-load and sort verify blocks for a read workload",
2183 .minval = 0,
2184 .maxval = 131072,
2185 .def = "1024",
2186 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002187 .category = FIO_OPT_C_IO,
2188 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002189 },
2190 {
Jens Axboea59e1702007-07-30 08:53:27 +02002191 .name = "verify_interval",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002192 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002193 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002194 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002195 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002196 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002197 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002198 .hide = 1,
2199 .interval = 2 * sizeof(struct verify_header),
2200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002202 },
2203 {
Jens Axboea59e1702007-07-30 08:53:27 +02002204 .name = "verify_offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002205 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002206 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002207 .help = "Offset verify header location by N bytes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002208 .off1 = td_var_offset(verify_offset),
2209 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002210 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002211 .hide = 1,
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002214 },
2215 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002216 .name = "verify_pattern",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002217 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002218 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002219 .cb = str_verify_pattern_cb,
2220 .help = "Fill pattern for IO buffers",
2221 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002222 .hide = 1,
2223 .category = FIO_OPT_C_IO,
2224 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002225 },
2226 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002227 .name = "verify_fatal",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002228 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002229 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002230 .off1 = td_var_offset(verify_fatal),
2231 .def = "0",
2232 .help = "Exit on a single verify failure, don't continue",
2233 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002234 .hide = 1,
2235 .category = FIO_OPT_C_IO,
2236 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002237 },
2238 {
Jens Axboeb463e932011-01-12 09:03:23 +01002239 .name = "verify_dump",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002240 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002241 .type = FIO_OPT_BOOL,
2242 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002243 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002244 .help = "Dump contents of good and bad blocks on failure",
2245 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002246 .hide = 1,
2247 .category = FIO_OPT_C_IO,
2248 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002249 },
2250 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002251 .name = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002252 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002253 .type = FIO_OPT_INT,
2254 .off1 = td_var_offset(verify_async),
2255 .def = "0",
2256 .help = "Number of async verifier threads to use",
2257 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002258 .hide = 1,
2259 .category = FIO_OPT_C_IO,
2260 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002261 },
Jens Axboe9e144182010-06-15 14:25:36 +02002262 {
2263 .name = "verify_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002264 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002265 .type = FIO_OPT_STR_VAL,
2266 .off1 = td_var_offset(verify_backlog),
2267 .help = "Verify after this number of blocks are written",
2268 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002269 .hide = 1,
2270 .category = FIO_OPT_C_IO,
2271 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002272 },
2273 {
2274 .name = "verify_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002275 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002276 .type = FIO_OPT_INT,
2277 .off1 = td_var_offset(verify_batch),
2278 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002279 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002280 .hide = 1,
2281 .category = FIO_OPT_C_IO,
2282 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002283 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002284#ifdef FIO_HAVE_CPU_AFFINITY
2285 {
2286 .name = "verify_async_cpus",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002287 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002288 .type = FIO_OPT_STR,
2289 .cb = str_verify_cpus_allowed_cb,
2290 .help = "Set CPUs allowed for async verify threads",
2291 .parent = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002292 .hide = 1,
2293 .category = FIO_OPT_C_IO,
2294 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002295 },
2296#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002297 {
2298 .name = "experimental_verify",
2299 .off1 = td_var_offset(experimental_verify),
2300 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002301 .help = "Enable experimental verification",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002302 .category = FIO_OPT_C_IO,
2303 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002304 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002305#ifdef FIO_HAVE_TRIM
2306 {
2307 .name = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002308 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002309 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002310 .off1 = td_var_offset(trim_percentage),
2311 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002312 .maxval = 100,
2313 .help = "Number of verify blocks to discard/trim",
2314 .parent = "verify",
2315 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002316 .interval = 1,
2317 .hide = 1,
2318 .category = FIO_OPT_C_IO,
2319 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002320 },
2321 {
2322 .name = "trim_verify_zero",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002323 .lname = "Verify trim zero",
2324 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002325 .help = "Verify that trim/discarded blocks are returned as zeroes",
2326 .off1 = td_var_offset(trim_zero),
2327 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002328 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002329 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002330 .category = FIO_OPT_C_IO,
2331 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002332 },
2333 {
2334 .name = "trim_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002335 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002336 .type = FIO_OPT_STR_VAL,
2337 .off1 = td_var_offset(trim_backlog),
2338 .help = "Trim after this number of blocks are written",
2339 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002340 .hide = 1,
2341 .interval = 1,
2342 .category = FIO_OPT_C_IO,
2343 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002344 },
2345 {
2346 .name = "trim_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002347 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002348 .type = FIO_OPT_INT,
2349 .off1 = td_var_offset(trim_batch),
2350 .help = "Trim this number of IO blocks",
2351 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002352 .hide = 1,
2353 .interval = 1,
2354 .category = FIO_OPT_C_IO,
2355 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002356 },
2357#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002358 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002359 .name = "write_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002360 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002361 .type = FIO_OPT_STR_STORE,
2362 .off1 = td_var_offset(write_iolog_file),
2363 .help = "Store IO pattern to file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002366 },
2367 {
2368 .name = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002369 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002370 .type = FIO_OPT_STR_STORE,
2371 .off1 = td_var_offset(read_iolog_file),
2372 .help = "Playback IO pattern from file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002373 .category = FIO_OPT_C_IO,
2374 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002375 },
2376 {
David Nellans64bbb862010-08-24 22:13:30 +02002377 .name = "replay_no_stall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002378 .lname = "Don't stall on replay",
2379 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002380 .off1 = td_var_offset(no_stall),
2381 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002382 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002383 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002384 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002385 .category = FIO_OPT_C_IO,
2386 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002387 },
2388 {
David Nellansd1c46c02010-08-31 21:20:47 +02002389 .name = "replay_redirect",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002390 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002391 .type = FIO_OPT_STR_STORE,
2392 .off1 = td_var_offset(replay_redirect),
2393 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002394 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002395 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002398 },
2399 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002400 .name = "exec_prerun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002401 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002402 .type = FIO_OPT_STR_STORE,
2403 .off1 = td_var_offset(exec_prerun),
2404 .help = "Execute this file prior to running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002405 .category = FIO_OPT_C_GENERAL,
2406 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002407 },
2408 {
2409 .name = "exec_postrun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002410 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002411 .type = FIO_OPT_STR_STORE,
2412 .off1 = td_var_offset(exec_postrun),
2413 .help = "Execute this file after running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002414 .category = FIO_OPT_C_GENERAL,
2415 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002416 },
2417#ifdef FIO_HAVE_IOSCHED_SWITCH
2418 {
2419 .name = "ioscheduler",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002420 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002421 .type = FIO_OPT_STR_STORE,
2422 .off1 = td_var_offset(ioscheduler),
2423 .help = "Use this IO scheduler on the backing device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002424 .category = FIO_OPT_C_FILE,
2425 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002426 },
2427#endif
2428 {
2429 .name = "zonesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002430 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002431 .type = FIO_OPT_STR_VAL,
2432 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002433 .help = "Amount of data to read per zone",
2434 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002435 .interval = 1024 * 1024,
2436 .category = FIO_OPT_C_IO,
2437 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002438 },
2439 {
2440 .name = "zonerange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002441 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002442 .type = FIO_OPT_STR_VAL,
2443 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002444 .help = "Give size of an IO zone",
2445 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002446 .interval = 1024 * 1024,
2447 .category = FIO_OPT_C_IO,
2448 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002449 },
2450 {
2451 .name = "zoneskip",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002452 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002453 .type = FIO_OPT_STR_VAL,
2454 .off1 = td_var_offset(zone_skip),
2455 .help = "Space between IO zones",
2456 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002457 .interval = 1024 * 1024,
2458 .category = FIO_OPT_C_IO,
2459 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002460 },
2461 {
2462 .name = "lockmem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002463 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002464 .type = FIO_OPT_STR_VAL,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002465 .off1 = td_var_offset(lockmem),
2466 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002467 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002468 .interval = 1024 * 1024,
2469 .category = FIO_OPT_C_GENERAL,
2470 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002471 },
2472 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002473 .name = "rwmixread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002474 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002475 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002476 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002477 .maxval = 100,
2478 .help = "Percentage of mixed workload that is reads",
2479 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002480 .interval = 5,
2481 .inverse = "rwmixwrite",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002484 },
2485 {
2486 .name = "rwmixwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002487 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002488 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002489 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002490 .maxval = 100,
2491 .help = "Percentage of mixed workload that is writes",
2492 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002493 .interval = 5,
2494 .inverse = "rwmixread",
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002497 },
2498 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002499 .name = "rwmixcycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002500 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002501 .type = FIO_OPT_DEPRECATED,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002502 .category = FIO_OPT_C_IO,
2503 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002504 },
2505 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002506 .name = "nice",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002507 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002508 .type = FIO_OPT_INT,
2509 .off1 = td_var_offset(nice),
2510 .help = "Set job CPU nice value",
2511 .minval = -19,
2512 .maxval = 20,
2513 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002514 .interval = 1,
2515 .category = FIO_OPT_C_GENERAL,
2516 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002517 },
2518#ifdef FIO_HAVE_IOPRIO
2519 {
2520 .name = "prio",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002521 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002522 .type = FIO_OPT_INT,
2523 .cb = str_prio_cb,
2524 .help = "Set job IO priority value",
2525 .minval = 0,
2526 .maxval = 7,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002527 .interval = 1,
2528 .category = FIO_OPT_C_GENERAL,
2529 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002530 },
2531 {
2532 .name = "prioclass",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002533 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002534 .type = FIO_OPT_INT,
2535 .cb = str_prioclass_cb,
2536 .help = "Set job IO priority class",
2537 .minval = 0,
2538 .maxval = 3,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002539 .interval = 1,
2540 .category = FIO_OPT_C_GENERAL,
2541 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002542 },
2543#endif
2544 {
2545 .name = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002546 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002547 .type = FIO_OPT_INT,
2548 .off1 = td_var_offset(thinktime),
2549 .help = "Idle time between IO buffers (usec)",
2550 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002551 .category = FIO_OPT_C_IO,
2552 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002553 },
2554 {
2555 .name = "thinktime_spin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002556 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002557 .type = FIO_OPT_INT,
2558 .off1 = td_var_offset(thinktime_spin),
2559 .help = "Start think time by spinning this amount (usec)",
2560 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002561 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002562 .hide = 1,
2563 .category = FIO_OPT_C_IO,
2564 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002565 },
2566 {
2567 .name = "thinktime_blocks",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002568 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002569 .type = FIO_OPT_INT,
2570 .off1 = td_var_offset(thinktime_blocks),
2571 .help = "IO buffer period between 'thinktime'",
2572 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002573 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002574 .hide = 1,
2575 .category = FIO_OPT_C_IO,
2576 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002577 },
2578 {
2579 .name = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002580 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002581 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002582 .off1 = td_var_offset(rate[DDIR_READ]),
2583 .off2 = td_var_offset(rate[DDIR_WRITE]),
2584 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002585 .help = "Set bandwidth rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002588 },
2589 {
2590 .name = "ratemin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002591 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002592 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002593 .off1 = td_var_offset(ratemin[DDIR_READ]),
2594 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2595 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002596 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002597 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002598 .hide = 1,
2599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002601 },
2602 {
2603 .name = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002604 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002605 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002606 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2607 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2608 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002609 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002610 .hide = 1,
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002613 },
2614 {
2615 .name = "rate_iops_min",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002616 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002617 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002618 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2619 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2620 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002621 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002622 .parent = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002623 .hide = 1,
2624 .category = FIO_OPT_C_IO,
2625 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002626 },
2627 {
2628 .name = "ratecycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002629 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002630 .type = FIO_OPT_INT,
2631 .off1 = td_var_offset(ratecycle),
2632 .help = "Window average for rate limits (msec)",
2633 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002634 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002635 .hide = 1,
2636 .category = FIO_OPT_C_IO,
2637 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002638 },
2639 {
Jens Axboe15501532012-10-24 16:37:45 +02002640 .name = "max_latency",
2641 .type = FIO_OPT_INT,
2642 .off1 = td_var_offset(max_latency),
2643 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002644 .category = FIO_OPT_C_IO,
2645 .group = FIO_OPT_G_RATE,
Jens Axboe15501532012-10-24 16:37:45 +02002646 },
2647 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002648 .name = "invalidate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002649 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002650 .type = FIO_OPT_BOOL,
2651 .off1 = td_var_offset(invalidate_cache),
2652 .help = "Invalidate buffer/page cache prior to running job",
2653 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002654 .category = FIO_OPT_C_IO,
2655 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002656 },
2657 {
2658 .name = "sync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002659 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002660 .type = FIO_OPT_BOOL,
2661 .off1 = td_var_offset(sync_io),
2662 .help = "Use O_SYNC for buffered writes",
2663 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002664 .parent = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002665 .hide = 1,
2666 .category = FIO_OPT_C_IO,
2667 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002668 },
2669 {
2670 .name = "create_serialize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002671 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002672 .type = FIO_OPT_BOOL,
2673 .off1 = td_var_offset(create_serialize),
2674 .help = "Serialize creating of job files",
2675 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002676 .category = FIO_OPT_C_FILE,
2677 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002678 },
2679 {
2680 .name = "create_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002681 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002682 .type = FIO_OPT_BOOL,
2683 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002684 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002685 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002686 .category = FIO_OPT_C_FILE,
2687 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 },
2689 {
Jens Axboe814452b2009-03-04 12:53:13 +01002690 .name = "create_on_open",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002691 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002692 .type = FIO_OPT_BOOL,
2693 .off1 = td_var_offset(create_on_open),
2694 .help = "Create files when they are opened for IO",
2695 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002696 .category = FIO_OPT_C_FILE,
2697 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002698 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002699 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002700 .name = "create_only",
2701 .type = FIO_OPT_BOOL,
2702 .off1 = td_var_offset(create_only),
2703 .help = "Only perform file creation phase",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002704 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002705 .def = "0",
2706 },
2707 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002708 .name = "pre_read",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002709 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002710 .type = FIO_OPT_BOOL,
2711 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002712 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002713 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002714 .category = FIO_OPT_C_FILE,
2715 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002716 },
2717#ifdef FIO_HAVE_CPU_AFFINITY
2718 {
2719 .name = "cpumask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002720 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002721 .type = FIO_OPT_INT,
2722 .cb = str_cpumask_cb,
2723 .help = "CPU affinity mask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002724 .category = FIO_OPT_C_GENERAL,
2725 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002726 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002727 {
2728 .name = "cpus_allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002729 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002730 .type = FIO_OPT_STR,
2731 .cb = str_cpus_allowed_cb,
2732 .help = "Set CPUs allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002733 .category = FIO_OPT_C_GENERAL,
2734 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002735 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002736#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002737#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002738 {
2739 .name = "numa_cpu_nodes",
2740 .type = FIO_OPT_STR,
2741 .cb = str_numa_cpunodes_cb,
2742 .help = "NUMA CPU nodes bind",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002743 .category = FIO_OPT_C_GENERAL,
2744 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002745 },
2746 {
2747 .name = "numa_mem_policy",
2748 .type = FIO_OPT_STR,
2749 .cb = str_numa_mpol_cb,
2750 .help = "NUMA memory policy setup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002751 .category = FIO_OPT_C_GENERAL,
2752 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002753 },
2754#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002755 {
2756 .name = "end_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002757 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002758 .type = FIO_OPT_BOOL,
2759 .off1 = td_var_offset(end_fsync),
2760 .help = "Include fsync at the end of job",
2761 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002762 .category = FIO_OPT_C_FILE,
2763 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002764 },
2765 {
2766 .name = "fsync_on_close",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002767 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002768 .type = FIO_OPT_BOOL,
2769 .off1 = td_var_offset(fsync_on_close),
2770 .help = "fsync files on close",
2771 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002772 .category = FIO_OPT_C_FILE,
2773 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002774 },
2775 {
2776 .name = "unlink",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002777 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002778 .type = FIO_OPT_BOOL,
2779 .off1 = td_var_offset(unlink),
2780 .help = "Unlink created files after job has completed",
2781 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002782 .category = FIO_OPT_C_FILE,
2783 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002784 },
2785 {
2786 .name = "exitall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002787 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002788 .type = FIO_OPT_STR_SET,
2789 .cb = str_exitall_cb,
2790 .help = "Terminate all jobs when one exits",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002791 .category = FIO_OPT_C_GENERAL,
2792 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002793 },
2794 {
2795 .name = "stonewall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002796 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02002797 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002798 .type = FIO_OPT_STR_SET,
2799 .off1 = td_var_offset(stonewall),
2800 .help = "Insert a hard barrier between this job and previous",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002801 .category = FIO_OPT_C_GENERAL,
2802 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002803 },
2804 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01002805 .name = "new_group",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002806 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01002807 .type = FIO_OPT_STR_SET,
2808 .off1 = td_var_offset(new_group),
2809 .help = "Mark the start of a new group (for reporting)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002810 .category = FIO_OPT_C_GENERAL,
2811 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01002812 },
2813 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002814 .name = "thread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002815 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002816 .type = FIO_OPT_STR_SET,
2817 .off1 = td_var_offset(use_thread),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002818 .help = "Use threads instead of processes",
2819 .category = FIO_OPT_C_GENERAL,
2820 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002821 },
2822 {
2823 .name = "write_bw_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002824 .lname = "Write bandwidth log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002825 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002826 .off1 = td_var_offset(bw_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002827 .cb = str_write_bw_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002828 .help = "Write log of bandwidth during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002829 .category = FIO_OPT_C_LOG,
2830 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002831 },
2832 {
2833 .name = "write_lat_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002834 .lname = "Write latency log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002835 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002836 .off1 = td_var_offset(lat_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002837 .cb = str_write_lat_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002838 .help = "Write log of latency during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002839 .category = FIO_OPT_C_LOG,
2840 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002841 },
2842 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002843 .name = "write_iops_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002844 .lname = "Write IOPS log",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002845 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002846 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002847 .cb = str_write_iops_log_cb,
2848 .help = "Write log of IOPS during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002849 .category = FIO_OPT_C_LOG,
2850 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002851 },
2852 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002853 .name = "log_avg_msec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002854 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002855 .type = FIO_OPT_INT,
2856 .off1 = td_var_offset(log_avg_msec),
2857 .help = "Average bw/iops/lat logs over this period of time",
2858 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002859 .category = FIO_OPT_C_LOG,
2860 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002861 },
2862 {
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002863 .name = "bwavgtime",
2864 .lname = "Bandwidth average time",
Jens Axboee01b22b2009-06-09 15:43:25 +02002865 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002866 .off1 = td_var_offset(bw_avg_time),
2867 .help = "Time window over which to calculate bandwidth"
2868 " (msec)",
2869 .def = "500",
2870 .parent = "write_bw_log",
2871 .hide = 1,
2872 .interval = 100,
2873 .category = FIO_OPT_C_LOG,
2874 .group = FIO_OPT_G_INVALID,
2875 },
2876 {
2877 .name = "iopsavgtime",
2878 .lname = "IOPS average time",
2879 .type = FIO_OPT_INT,
2880 .off1 = td_var_offset(iops_avg_time),
2881 .help = "Time window over which to calculate IOPS (msec)",
2882 .def = "500",
2883 .parent = "write_iops_log",
2884 .hide = 1,
2885 .interval = 100,
2886 .category = FIO_OPT_C_LOG,
2887 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002888 },
2889 {
2890 .name = "group_reporting",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002891 .lname = "Group reporting",
2892 .type = FIO_OPT_BOOL,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002893 .off1 = td_var_offset(group_reporting),
2894 .help = "Do reporting on a per-group basis",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002895 .def = "1",
2896 .category = FIO_OPT_C_STAT,
2897 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002898 },
2899 {
Jens Axboee9459e52007-04-17 15:46:32 +02002900 .name = "zero_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002901 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02002902 .type = FIO_OPT_STR_SET,
2903 .off1 = td_var_offset(zero_buffers),
2904 .help = "Init IO buffers to all zeroes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002905 .category = FIO_OPT_C_IO,
2906 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02002907 },
Jens Axboe5973caf2008-05-21 19:52:35 +02002908 {
2909 .name = "refill_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002910 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02002911 .type = FIO_OPT_STR_SET,
2912 .off1 = td_var_offset(refill_buffers),
2913 .help = "Refill IO buffers on every IO submit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002914 .category = FIO_OPT_C_IO,
2915 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02002916 },
Yu-ju Hong83349192011-08-13 00:53:44 +02002917 {
Jens Axboefd684182011-09-19 09:24:44 +02002918 .name = "scramble_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002919 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02002920 .type = FIO_OPT_BOOL,
2921 .off1 = td_var_offset(scramble_buffers),
2922 .help = "Slightly scramble buffers on every IO submit",
2923 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002924 .category = FIO_OPT_C_IO,
2925 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02002926 },
2927 {
Jens Axboe9c426842012-03-02 21:02:12 +01002928 .name = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002929 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01002930 .type = FIO_OPT_INT,
2931 .off1 = td_var_offset(compress_percentage),
2932 .maxval = 100,
2933 .minval = 1,
2934 .help = "How compressible the buffer is (approximately)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002935 .interval = 5,
2936 .category = FIO_OPT_C_IO,
2937 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01002938 },
2939 {
Jens Axboef97a43a2012-03-09 19:06:24 +01002940 .name = "buffer_compress_chunk",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002941 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01002942 .type = FIO_OPT_INT,
2943 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01002944 .parent = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002945 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01002946 .help = "Size of compressible region in buffer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002947 .interval = 256,
2948 .category = FIO_OPT_C_IO,
2949 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01002950 },
2951 {
Yu-ju Hong83349192011-08-13 00:53:44 +02002952 .name = "clat_percentiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002953 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02002954 .type = FIO_OPT_BOOL,
2955 .off1 = td_var_offset(clat_percentiles),
2956 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02002957 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002958 .category = FIO_OPT_C_STAT,
2959 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002960 },
2961 {
2962 .name = "percentile_list",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002963 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02002964 .type = FIO_OPT_FLOAT_LIST,
2965 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01002966 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02002967 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01002968 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
Yu-ju Hong83349192011-08-13 00:53:44 +02002969 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2970 .minfp = 0.0,
2971 .maxfp = 100.0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002972 .category = FIO_OPT_C_STAT,
2973 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002974 },
2975
Jens Axboe0a839f32007-04-26 09:02:34 +02002976#ifdef FIO_HAVE_DISK_UTIL
2977 {
2978 .name = "disk_util",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002979 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02002980 .type = FIO_OPT_BOOL,
2981 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02002982 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02002983 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002984 .category = FIO_OPT_C_STAT,
2985 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02002986 },
2987#endif
Jens Axboee9459e52007-04-17 15:46:32 +02002988 {
Jens Axboe993bf482008-11-14 13:04:53 +01002989 .name = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002990 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01002991 .type = FIO_OPT_BOOL,
2992 .help = "Greatly reduce number of gettimeofday() calls",
2993 .cb = str_gtod_reduce_cb,
2994 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002995 .hide_on_set = 1,
2996 .category = FIO_OPT_C_STAT,
2997 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01002998 },
2999 {
Jens Axboe02af0982010-06-24 09:59:34 +02003000 .name = "disable_lat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003001 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003002 .type = FIO_OPT_BOOL,
3003 .off1 = td_var_offset(disable_lat),
3004 .help = "Disable latency numbers",
3005 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003006 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003007 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003008 .category = FIO_OPT_C_STAT,
3009 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003010 },
3011 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003012 .name = "disable_clat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003013 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003014 .type = FIO_OPT_BOOL,
3015 .off1 = td_var_offset(disable_clat),
3016 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003017 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003018 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003019 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003020 .category = FIO_OPT_C_STAT,
3021 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003022 },
3023 {
3024 .name = "disable_slat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003025 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003026 .type = FIO_OPT_BOOL,
3027 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003028 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003029 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003030 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003031 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003032 .category = FIO_OPT_C_STAT,
3033 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003034 },
3035 {
3036 .name = "disable_bw_measurement",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003037 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003038 .type = FIO_OPT_BOOL,
3039 .off1 = td_var_offset(disable_bw),
3040 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003041 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003042 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003043 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003044 .category = FIO_OPT_C_STAT,
3045 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003046 },
3047 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003048 .name = "gtod_cpu",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003049 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003050 .type = FIO_OPT_INT,
3051 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003052 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003053 .verify = gtod_cpu_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003054 .category = FIO_OPT_C_GENERAL,
3055 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003056 },
3057 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003058 .name = "unified_rw_reporting",
3059 .type = FIO_OPT_BOOL,
3060 .off1 = td_var_offset(unified_rw_rep),
3061 .help = "Unify reporting across data direction",
3062 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003063 .category = FIO_OPT_C_GENERAL,
3064 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003065 },
3066 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003067 .name = "continue_on_error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003068 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003069 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003070 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003071 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003072 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003073 .category = FIO_OPT_C_GENERAL,
3074 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003075 .posval = {
3076 { .ival = "none",
3077 .oval = ERROR_TYPE_NONE,
3078 .help = "Exit when an error is encountered",
3079 },
3080 { .ival = "read",
3081 .oval = ERROR_TYPE_READ,
3082 .help = "Continue on read errors only",
3083 },
3084 { .ival = "write",
3085 .oval = ERROR_TYPE_WRITE,
3086 .help = "Continue on write errors only",
3087 },
3088 { .ival = "io",
3089 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3090 .help = "Continue on any IO errors",
3091 },
3092 { .ival = "verify",
3093 .oval = ERROR_TYPE_VERIFY,
3094 .help = "Continue on verify errors only",
3095 },
3096 { .ival = "all",
3097 .oval = ERROR_TYPE_ANY,
3098 .help = "Continue on all io and verify errors",
3099 },
3100 { .ival = "0",
3101 .oval = ERROR_TYPE_NONE,
3102 .help = "Alias for 'none'",
3103 },
3104 { .ival = "1",
3105 .oval = ERROR_TYPE_ANY,
3106 .help = "Alias for 'all'",
3107 },
3108 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003109 },
3110 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003111 .name = "ignore_error",
3112 .type = FIO_OPT_STR,
3113 .cb = str_ignore_error_cb,
3114 .help = "Set a specific list of errors to ignore",
3115 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003116 .category = FIO_OPT_C_GENERAL,
3117 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003118 },
3119 {
3120 .name = "error_dump",
3121 .type = FIO_OPT_BOOL,
3122 .off1 = td_var_offset(error_dump),
3123 .def = "0",
3124 .help = "Dump info on each error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003125 .category = FIO_OPT_C_GENERAL,
3126 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003127 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003128 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003129 .name = "profile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003130 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003131 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003132 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003133 .help = "Select a specific builtin performance test",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003134 .category = FIO_OPT_C_PROFILE,
3135 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003136 },
3137 {
Jens Axboea696fa22009-12-04 10:05:02 +01003138 .name = "cgroup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003139 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003140 .type = FIO_OPT_STR_STORE,
3141 .off1 = td_var_offset(cgroup),
3142 .help = "Add job to cgroup of this name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003143 .category = FIO_OPT_C_GENERAL,
3144 .group = FIO_OPT_G_CGROUP,
3145 },
3146 {
3147 .name = "cgroup_nodelete",
3148 .lname = "Cgroup no-delete",
3149 .type = FIO_OPT_BOOL,
3150 .off1 = td_var_offset(cgroup_nodelete),
3151 .help = "Do not delete cgroups after job completion",
3152 .def = "0",
3153 .parent = "cgroup",
3154 .category = FIO_OPT_C_GENERAL,
3155 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003156 },
3157 {
3158 .name = "cgroup_weight",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003159 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003160 .type = FIO_OPT_INT,
3161 .off1 = td_var_offset(cgroup_weight),
3162 .help = "Use given weight for cgroup",
3163 .minval = 100,
3164 .maxval = 1000,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003165 .parent = "cgroup",
3166 .category = FIO_OPT_C_GENERAL,
3167 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003168 },
3169 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003170 .name = "uid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003171 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003172 .type = FIO_OPT_INT,
3173 .off1 = td_var_offset(uid),
3174 .help = "Run job with this user ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003175 .category = FIO_OPT_C_GENERAL,
3176 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003177 },
3178 {
3179 .name = "gid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003180 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003181 .type = FIO_OPT_INT,
3182 .off1 = td_var_offset(gid),
3183 .help = "Run job with this group ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003184 .category = FIO_OPT_C_GENERAL,
3185 .group = FIO_OPT_G_CRED,
3186 },
3187 {
3188 .name = "kb_base",
3189 .lname = "KB Base",
3190 .type = FIO_OPT_INT,
3191 .off1 = td_var_offset(kb_base),
3192 .prio = 1,
3193 .def = "1024",
3194 .posval = {
3195 { .ival = "1024",
3196 .oval = 1024,
3197 .help = "Use 1024 as the K base",
3198 },
3199 { .ival = "1000",
3200 .oval = 1000,
3201 .help = "Use 1000 as the K base",
3202 },
3203 },
3204 .help = "How many bytes per KB for reporting (1000 or 1024)",
3205 .category = FIO_OPT_C_GENERAL,
3206 .group = FIO_OPT_G_INVALID,
3207 },
3208 {
3209 .name = "unit_base",
3210 .lname = "Base unit for reporting (Bits or Bytes)",
3211 .type = FIO_OPT_INT,
3212 .off1 = td_var_offset(unit_base),
3213 .prio = 1,
3214 .posval = {
3215 { .ival = "0",
3216 .oval = 0,
3217 .help = "Auto-detect",
3218 },
3219 { .ival = "8",
3220 .oval = 8,
3221 .help = "Normal (byte based)",
3222 },
3223 { .ival = "1",
3224 .oval = 1,
3225 .help = "Bit based",
3226 },
3227 },
3228 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3229 .category = FIO_OPT_C_GENERAL,
3230 .group = FIO_OPT_G_INVALID,
3231 },
3232 {
3233 .name = "hugepage-size",
3234 .lname = "Hugepage size",
3235 .type = FIO_OPT_INT,
3236 .off1 = td_var_offset(hugepage_size),
3237 .help = "When using hugepages, specify size of each page",
3238 .def = __fio_stringify(FIO_HUGE_PAGE),
3239 .interval = 1024 * 1024,
3240 .category = FIO_OPT_C_GENERAL,
3241 .group = FIO_OPT_G_INVALID,
Jens Axboee0b0d892009-12-08 10:10:14 +01003242 },
3243 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003244 .name = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003245 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003246 .type = FIO_OPT_INT,
3247 .off1 = td_var_offset(flow_id),
3248 .help = "The flow index ID to use",
3249 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003250 .category = FIO_OPT_C_IO,
3251 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003252 },
3253 {
3254 .name = "flow",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003255 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003256 .type = FIO_OPT_INT,
3257 .off1 = td_var_offset(flow),
3258 .help = "Weight for flow control of this job",
3259 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003260 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003261 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003262 .category = FIO_OPT_C_IO,
3263 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003264 },
3265 {
3266 .name = "flow_watermark",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003267 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003268 .type = FIO_OPT_INT,
3269 .off1 = td_var_offset(flow_watermark),
3270 .help = "High watermark for flow control. This option"
3271 " should be set to the same value for all threads"
3272 " with non-zero flow.",
3273 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003274 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003275 .def = "1024",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003276 .category = FIO_OPT_C_IO,
3277 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003278 },
3279 {
3280 .name = "flow_sleep",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003281 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003282 .type = FIO_OPT_INT,
3283 .off1 = td_var_offset(flow_sleep),
3284 .help = "How many microseconds to sleep after being held"
3285 " back by the flow control mechanism",
3286 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003287 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003288 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003289 .category = FIO_OPT_C_IO,
3290 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003291 },
3292 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003293 .name = NULL,
3294 },
3295};
3296
Jens Axboe17af15d2010-04-13 10:38:16 +02003297static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003298 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003299{
Jens Axboe17af15d2010-04-13 10:38:16 +02003300 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003301 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003302 if (o->type == FIO_OPT_STR_SET)
3303 lopt->has_arg = no_argument;
3304 else
3305 lopt->has_arg = required_argument;
3306}
3307
Steven Langde890a12011-11-09 14:03:34 +01003308static void options_to_lopts(struct fio_option *opts,
3309 struct option *long_options,
3310 int i, int option_type)
3311{
3312 struct fio_option *o = &opts[0];
3313 while (o->name) {
3314 add_to_lopt(&long_options[i], o, o->name, option_type);
3315 if (o->alias) {
3316 i++;
3317 add_to_lopt(&long_options[i], o, o->alias, option_type);
3318 }
3319
3320 i++;
3321 o++;
3322 assert(i < FIO_NR_OPTIONS);
3323 }
3324}
3325
3326void fio_options_set_ioengine_opts(struct option *long_options,
3327 struct thread_data *td)
3328{
3329 unsigned int i;
3330
3331 i = 0;
3332 while (long_options[i].name) {
3333 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3334 memset(&long_options[i], 0, sizeof(*long_options));
3335 break;
3336 }
3337 i++;
3338 }
3339
3340 /*
3341 * Just clear out the prior ioengine options.
3342 */
3343 if (!td || !td->eo)
3344 return;
3345
3346 options_to_lopts(td->io_ops->options, long_options, i,
3347 FIO_GETOPT_IOENGINE);
3348}
3349
Jens Axboe214e1ec2007-03-15 10:48:13 +01003350void fio_options_dup_and_init(struct option *long_options)
3351{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003352 unsigned int i;
3353
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003354 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003355
3356 i = 0;
3357 while (long_options[i].name)
3358 i++;
3359
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003360 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003361}
3362
Jens Axboe74929ac2009-08-05 11:42:37 +02003363struct fio_keyword {
3364 const char *word;
3365 const char *desc;
3366 char *replace;
3367};
3368
3369static struct fio_keyword fio_keywords[] = {
3370 {
3371 .word = "$pagesize",
3372 .desc = "Page size in the system",
3373 },
3374 {
3375 .word = "$mb_memory",
3376 .desc = "Megabytes of memory online",
3377 },
3378 {
3379 .word = "$ncpus",
3380 .desc = "Number of CPUs online in the system",
3381 },
3382 {
3383 .word = NULL,
3384 },
3385};
3386
3387void fio_keywords_init(void)
3388{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003389 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003390 char buf[128];
3391 long l;
3392
Jens Axboea4cfc472012-10-09 10:30:48 -06003393 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003394 fio_keywords[0].replace = strdup(buf);
3395
Jens Axboe8eb016d2011-07-11 10:24:20 +02003396 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003397 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003398 fio_keywords[1].replace = strdup(buf);
3399
Jens Axboec00a2282011-07-08 20:56:06 +02003400 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003401 sprintf(buf, "%lu", l);
3402 fio_keywords[2].replace = strdup(buf);
3403}
3404
Jens Axboe892a6ff2009-11-13 12:19:49 +01003405#define BC_APP "bc"
3406
3407static char *bc_calc(char *str)
3408{
Steven Langd0c814e2011-10-28 08:37:13 +02003409 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003410 FILE *f;
3411 int ret;
3412
3413 /*
3414 * No math, just return string
3415 */
Steven Langd0c814e2011-10-28 08:37:13 +02003416 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3417 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003418 return str;
3419
3420 /*
3421 * Split option from value, we only need to calculate the value
3422 */
3423 tmp = strchr(str, '=');
3424 if (!tmp)
3425 return str;
3426
3427 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003428
Steven Langd0c814e2011-10-28 08:37:13 +02003429 /*
3430 * Prevent buffer overflows; such a case isn't reasonable anyway
3431 */
3432 if (strlen(str) >= 128 || strlen(tmp) > 100)
3433 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003434
3435 sprintf(buf, "which %s > /dev/null", BC_APP);
3436 if (system(buf)) {
3437 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003438 return NULL;
3439 }
3440
Steven Langd0c814e2011-10-28 08:37:13 +02003441 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003442 f = popen(buf, "r");
3443 if (!f) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003444 return NULL;
3445 }
3446
Steven Langd0c814e2011-10-28 08:37:13 +02003447 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003448 if (ret <= 0) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003449 return NULL;
3450 }
3451
Jens Axboe892a6ff2009-11-13 12:19:49 +01003452 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003453 buf[(tmp - str) + ret - 1] = '\0';
3454 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003455 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003456 return strdup(buf);
3457}
3458
3459/*
3460 * Return a copy of the input string with substrings of the form ${VARNAME}
3461 * substituted with the value of the environment variable VARNAME. The
3462 * substitution always occurs, even if VARNAME is empty or the corresponding
3463 * environment variable undefined.
3464 */
3465static char *option_dup_subs(const char *opt)
3466{
3467 char out[OPT_LEN_MAX+1];
3468 char in[OPT_LEN_MAX+1];
3469 char *outptr = out;
3470 char *inptr = in;
3471 char *ch1, *ch2, *env;
3472 ssize_t nchr = OPT_LEN_MAX;
3473 size_t envlen;
3474
3475 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3476 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3477 return NULL;
3478 }
3479
3480 in[OPT_LEN_MAX] = '\0';
3481 strncpy(in, opt, OPT_LEN_MAX);
3482
3483 while (*inptr && nchr > 0) {
3484 if (inptr[0] == '$' && inptr[1] == '{') {
3485 ch2 = strchr(inptr, '}');
3486 if (ch2 && inptr+1 < ch2) {
3487 ch1 = inptr+2;
3488 inptr = ch2+1;
3489 *ch2 = '\0';
3490
3491 env = getenv(ch1);
3492 if (env) {
3493 envlen = strlen(env);
3494 if (envlen <= nchr) {
3495 memcpy(outptr, env, envlen);
3496 outptr += envlen;
3497 nchr -= envlen;
3498 }
3499 }
3500
3501 continue;
3502 }
3503 }
3504
3505 *outptr++ = *inptr++;
3506 --nchr;
3507 }
3508
3509 *outptr = '\0';
3510 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003511}
3512
Jens Axboe74929ac2009-08-05 11:42:37 +02003513/*
3514 * Look for reserved variable names and replace them with real values
3515 */
3516static char *fio_keyword_replace(char *opt)
3517{
3518 char *s;
3519 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003520 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003521
3522 for (i = 0; fio_keywords[i].word != NULL; i++) {
3523 struct fio_keyword *kw = &fio_keywords[i];
3524
3525 while ((s = strstr(opt, kw->word)) != NULL) {
3526 char *new = malloc(strlen(opt) + 1);
3527 char *o_org = opt;
3528 int olen = s - opt;
3529 int len;
3530
3531 /*
3532 * Copy part of the string before the keyword and
3533 * sprintf() the replacement after it.
3534 */
3535 memcpy(new, opt, olen);
3536 len = sprintf(new + olen, "%s", kw->replace);
3537
3538 /*
3539 * If there's more in the original string, copy that
3540 * in too
3541 */
3542 opt += strlen(kw->word) + olen;
3543 if (strlen(opt))
3544 memcpy(new + olen + len, opt, opt - o_org - 1);
3545
3546 /*
3547 * replace opt and free the old opt
3548 */
3549 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003550 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003551
Steven Langd0c814e2011-10-28 08:37:13 +02003552 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003553 }
3554 }
3555
Steven Langd0c814e2011-10-28 08:37:13 +02003556 /*
3557 * Check for potential math and invoke bc, if possible
3558 */
3559 if (docalc)
3560 opt = bc_calc(opt);
3561
Jens Axboe7a958bd2009-11-13 12:33:54 +01003562 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003563}
3564
Steven Langd0c814e2011-10-28 08:37:13 +02003565static char **dup_and_sub_options(char **opts, int num_opts)
3566{
3567 int i;
3568 char **opts_copy = malloc(num_opts * sizeof(*opts));
3569 for (i = 0; i < num_opts; i++) {
3570 opts_copy[i] = option_dup_subs(opts[i]);
3571 if (!opts_copy[i])
3572 continue;
3573 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3574 }
3575 return opts_copy;
3576}
3577
Jens Axboe3b8b7132008-06-10 19:46:23 +02003578int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003579{
Steven Langde890a12011-11-09 14:03:34 +01003580 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003581 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003582
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003583 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003584 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003585
Steven Langde890a12011-11-09 14:03:34 +01003586 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3587 struct fio_option *o;
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003588 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3589 &o, td);
Steven Langd0c814e2011-10-28 08:37:13 +02003590
Steven Langde890a12011-11-09 14:03:34 +01003591 if (opts_copy[i]) {
3592 if (newret && !o) {
3593 unknown++;
3594 continue;
3595 }
Steven Langd0c814e2011-10-28 08:37:13 +02003596 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003597 opts_copy[i] = NULL;
3598 }
3599
3600 ret |= newret;
3601 }
3602
3603 if (unknown) {
3604 ret |= ioengine_load(td);
3605 if (td->eo) {
3606 sort_options(opts_copy, td->io_ops->options, num_opts);
3607 opts = opts_copy;
3608 }
3609 for (i = 0; i < num_opts; i++) {
3610 struct fio_option *o = NULL;
3611 int newret = 1;
3612 if (!opts_copy[i])
3613 continue;
3614
3615 if (td->eo)
3616 newret = parse_option(opts_copy[i], opts[i],
3617 td->io_ops->options, &o,
3618 td->eo);
3619
3620 ret |= newret;
3621 if (!o)
3622 log_err("Bad option <%s>\n", opts[i]);
3623
3624 free(opts_copy[i]);
3625 opts_copy[i] = NULL;
3626 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003627 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003628
Steven Langd0c814e2011-10-28 08:37:13 +02003629 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003630 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003631}
3632
3633int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3634{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003635 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003636}
3637
Steven Langde890a12011-11-09 14:03:34 +01003638int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3639 char *val)
3640{
3641 return parse_cmd_option(opt, val, td->io_ops->options, td);
3642}
3643
Jens Axboe214e1ec2007-03-15 10:48:13 +01003644void fio_fill_default_options(struct thread_data *td)
3645{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003646 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003647}
3648
3649int fio_show_option_help(const char *opt)
3650{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003651 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003652}
Jens Axboed23bb322007-03-23 15:57:56 +01003653
Steven Langde890a12011-11-09 14:03:34 +01003654void options_mem_dupe(void *data, struct fio_option *options)
3655{
3656 struct fio_option *o;
3657 char **ptr;
3658
3659 for (o = &options[0]; o->name; o++) {
3660 if (o->type != FIO_OPT_STR_STORE)
3661 continue;
3662
3663 ptr = td_var(data, o->off1);
3664 if (*ptr)
3665 *ptr = strdup(*ptr);
3666 }
3667}
3668
Jens Axboe7e356b22011-10-14 10:55:16 +02003669/*
3670 * dupe FIO_OPT_STR_STORE options
3671 */
Steven Langde890a12011-11-09 14:03:34 +01003672void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003673{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003674 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003675
3676 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003677 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003678
Steven Langde890a12011-11-09 14:03:34 +01003679 td->eo = malloc(td->io_ops->option_struct_size);
3680 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3681 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003682 }
3683}
3684
Jens Axboed6978a32009-07-18 21:04:09 +02003685unsigned int fio_get_kb_base(void *data)
3686{
3687 struct thread_data *td = data;
3688 unsigned int kb_base = 0;
3689
3690 if (td)
3691 kb_base = td->o.kb_base;
3692 if (!kb_base)
3693 kb_base = 1024;
3694
3695 return kb_base;
3696}
Jens Axboe9f988e22010-03-04 10:42:38 +01003697
Jens Axboe07b32322010-03-05 09:48:44 +01003698int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003699{
Jens Axboe07b32322010-03-05 09:48:44 +01003700 struct fio_option *__o;
3701 int opt_index = 0;
3702
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003703 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003704 while (__o->name) {
3705 opt_index++;
3706 __o++;
3707 }
3708
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003709 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe07b32322010-03-05 09:48:44 +01003710 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003711}
Jens Axboee2de69d2010-03-04 14:05:48 +01003712
Jens Axboe07b32322010-03-05 09:48:44 +01003713void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003714{
Jens Axboe07b32322010-03-05 09:48:44 +01003715 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003716
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003717 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003718 while (o->name) {
3719 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3720 o->type = FIO_OPT_INVALID;
3721 o->prof_name = NULL;
3722 }
3723 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003724 }
3725}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003726
3727void add_opt_posval(const char *optname, const char *ival, const char *help)
3728{
3729 struct fio_option *o;
3730 unsigned int i;
3731
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003732 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003733 if (!o)
3734 return;
3735
3736 for (i = 0; i < PARSE_MAX_VP; i++) {
3737 if (o->posval[i].ival)
3738 continue;
3739
3740 o->posval[i].ival = ival;
3741 o->posval[i].help = help;
3742 break;
3743 }
3744}
3745
3746void del_opt_posval(const char *optname, const char *ival)
3747{
3748 struct fio_option *o;
3749 unsigned int i;
3750
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003751 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003752 if (!o)
3753 return;
3754
3755 for (i = 0; i < PARSE_MAX_VP; i++) {
3756 if (!o->posval[i].ival)
3757 continue;
3758 if (strcmp(o->posval[i].ival, ival))
3759 continue;
3760
3761 o->posval[i].ival = NULL;
3762 o->posval[i].help = NULL;
3763 }
3764}
Jens Axboe7e356b22011-10-14 10:55:16 +02003765
3766void fio_options_free(struct thread_data *td)
3767{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003768 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003769 if (td->eo && td->io_ops && td->io_ops->options) {
3770 options_free(td->io_ops->options, td->eo);
3771 free(td->eo);
3772 td->eo = NULL;
3773 }
Jens Axboe7e356b22011-10-14 10:55:16 +02003774}