blob: 84ac412874a2742f083d691fcfc1c70bdbb301d1 [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 Axboe925fee32012-11-06 13:50:32 +0100738 td->o.zipf_theta = 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 Axboe925fee32012-11-06 13:50:32 +0100744 td->o.pareto_h = 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
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400893static int str_verify_offset_cb(void *data, unsigned long long *off)
Shawn Lewis546a9142007-07-28 21:11:37 +0200894{
895 struct thread_data *td = data;
Jens Axboea59e1702007-07-30 08:53:27 +0200896
Shawn Lewis546a9142007-07-28 21:11:37 +0200897 if (*off && *off < sizeof(struct verify_header)) {
Jens Axboea59e1702007-07-30 08:53:27 +0200898 log_err("fio: verify_offset too small\n");
Shawn Lewis546a9142007-07-28 21:11:37 +0200899 return 1;
900 }
Jens Axboea59e1702007-07-30 08:53:27 +0200901
902 td->o.verify_offset = *off;
Shawn Lewis546a9142007-07-28 21:11:37 +0200903 return 0;
904}
905
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100906static int str_verify_pattern_cb(void *data, const char *input)
Jens Axboe90059d62007-07-30 09:33:12 +0200907{
908 struct thread_data *td = data;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100909 long off;
910 int i = 0, j = 0, len, k, base = 10;
911 char* loc1, * loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200912
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100913 loc1 = strstr(input, "0x");
914 loc2 = strstr(input, "0X");
915 if (loc1 || loc2)
916 base = 16;
917 off = strtol(input, NULL, base);
918 if (off != LONG_MAX || errno != ERANGE) {
919 while (off) {
920 td->o.verify_pattern[i] = off & 0xff;
921 off >>= 8;
922 i++;
923 }
924 } else {
925 len = strlen(input);
926 k = len - 1;
927 if (base == 16) {
928 if (loc1)
929 j = loc1 - input + 2;
930 else
931 j = loc2 - input + 2;
932 } else
933 return 1;
934 if (len - j < MAX_PATTERN_SIZE * 2) {
935 while (k >= j) {
936 off = converthexchartoint(input[k--]);
937 if (k >= j)
938 off += (converthexchartoint(input[k--])
939 * 16);
940 td->o.verify_pattern[i++] = (char) off;
941 }
942 }
943 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100944
945 /*
946 * Fill the pattern all the way to the end. This greatly reduces
947 * the number of memcpy's we have to do when verifying the IO.
948 */
949 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
950 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
951 i *= 2;
952 }
Steven Lang9a2a86d2012-02-07 09:42:59 +0100953 if (i == 1) {
954 /*
955 * The code in verify_io_u_pattern assumes a single byte pattern
956 * fills the whole verify pattern buffer.
957 */
958 memset(td->o.verify_pattern, td->o.verify_pattern[0],
959 MAX_PATTERN_SIZE);
960 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100961
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100962 td->o.verify_pattern_bytes = i;
Steven Langefcd9dc2012-02-02 20:22:04 +0100963
Jens Axboe92bf48d2011-01-14 21:20:42 +0100964 /*
965 * VERIFY_META could already be set
966 */
967 if (td->o.verify == VERIFY_NONE)
968 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +0100969
Jens Axboe90059d62007-07-30 09:33:12 +0200970 return 0;
971}
Jens Axboe214e1ec2007-03-15 10:48:13 +0100972
Jens Axboee3cedca2008-11-19 19:57:52 +0100973static int str_write_bw_log_cb(void *data, const char *str)
974{
975 struct thread_data *td = data;
976
977 if (str)
978 td->o.bw_log_file = strdup(str);
979
980 td->o.write_bw_log = 1;
981 return 0;
982}
983
984static int str_write_lat_log_cb(void *data, const char *str)
985{
986 struct thread_data *td = data;
987
988 if (str)
989 td->o.lat_log_file = strdup(str);
990
991 td->o.write_lat_log = 1;
992 return 0;
993}
994
Jens Axboec8eeb9d2011-10-05 14:02:22 +0200995static int str_write_iops_log_cb(void *data, const char *str)
996{
997 struct thread_data *td = data;
998
999 if (str)
1000 td->o.iops_log_file = strdup(str);
1001
1002 td->o.write_iops_log = 1;
1003 return 0;
1004}
1005
Jens Axboe993bf482008-11-14 13:04:53 +01001006static int str_gtod_reduce_cb(void *data, int *il)
1007{
1008 struct thread_data *td = data;
1009 int val = *il;
1010
Jens Axboe02af0982010-06-24 09:59:34 +02001011 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001012 td->o.disable_clat = !!val;
1013 td->o.disable_slat = !!val;
1014 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001015 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001016 if (val)
1017 td->tv_cache_mask = 63;
1018
1019 return 0;
1020}
1021
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001022static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001023{
1024 struct thread_data *td = data;
1025 int val = *il;
1026
1027 td->o.gtod_cpu = val;
1028 td->o.gtod_offload = 1;
1029 return 0;
1030}
1031
Jens Axboe7bb59102011-07-12 19:47:03 +02001032static int str_size_cb(void *data, unsigned long long *__val)
1033{
1034 struct thread_data *td = data;
1035 unsigned long long v = *__val;
1036
1037 if (parse_is_percent(v)) {
1038 td->o.size = 0;
1039 td->o.size_percent = -1ULL - v;
1040 } else
1041 td->o.size = v;
1042
1043 return 0;
1044}
1045
Jens Axboe896cac22009-07-01 10:38:35 +02001046static int rw_verify(struct fio_option *o, void *data)
1047{
1048 struct thread_data *td = data;
1049
1050 if (read_only && td_write(td)) {
1051 log_err("fio: job <%s> has write bit set, but fio is in"
1052 " read-only mode\n", td->o.name);
1053 return 1;
1054 }
1055
1056 return 0;
1057}
1058
Jens Axboe276ca4f2009-07-01 10:43:05 +02001059static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001060{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001061#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001062 struct thread_data *td = data;
1063
Jens Axboe29d43ff2009-07-01 10:42:18 +02001064 if (td->o.gtod_cpu) {
1065 log_err("fio: platform must support CPU affinity for"
1066 "gettimeofday() offloading\n");
1067 return 1;
1068 }
1069#endif
1070
1071 return 0;
1072}
1073
Jens Axboe214e1ec2007-03-15 10:48:13 +01001074/*
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001075 * Option grouping
1076 */
1077static struct opt_group fio_opt_groups[] = {
1078 {
1079 .name = "General",
1080 .mask = FIO_OPT_C_GENERAL,
1081 },
1082 {
1083 .name = "I/O",
1084 .mask = FIO_OPT_C_IO,
1085 },
1086 {
1087 .name = "File",
1088 .mask = FIO_OPT_C_FILE,
1089 },
1090 {
1091 .name = "Statistics",
1092 .mask = FIO_OPT_C_STAT,
1093 },
1094 {
1095 .name = "Logging",
1096 .mask = FIO_OPT_C_LOG,
1097 },
1098 {
1099 .name = "Profiles",
1100 .mask = FIO_OPT_C_PROFILE,
1101 },
1102 {
1103 .name = NULL,
1104 },
1105};
1106
1107static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1108 unsigned int inv_mask)
1109{
1110 struct opt_group *og;
1111 int i;
1112
1113 if (*mask == inv_mask || !*mask)
1114 return NULL;
1115
1116 for (i = 0; ogs[i].name; i++) {
1117 og = &ogs[i];
1118
1119 if (*mask & og->mask) {
1120 *mask &= ~(og->mask);
1121 return og;
1122 }
1123 }
1124
1125 return NULL;
1126}
1127
1128struct opt_group *opt_group_from_mask(unsigned int *mask)
1129{
1130 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1131}
1132
1133static struct opt_group fio_opt_cat_groups[] = {
1134 {
1135 .name = "Rate",
1136 .mask = FIO_OPT_G_RATE,
1137 },
1138 {
1139 .name = "Zone",
1140 .mask = FIO_OPT_G_ZONE,
1141 },
1142 {
1143 .name = "Read/write mix",
1144 .mask = FIO_OPT_G_RWMIX,
1145 },
1146 {
1147 .name = "Verify",
1148 .mask = FIO_OPT_G_VERIFY,
1149 },
1150 {
1151 .name = "Trim",
1152 .mask = FIO_OPT_G_TRIM,
1153 },
1154 {
1155 .name = "I/O Logging",
1156 .mask = FIO_OPT_G_IOLOG,
1157 },
1158 {
1159 .name = "I/O Depth",
1160 .mask = FIO_OPT_G_IO_DEPTH,
1161 },
1162 {
1163 .name = "I/O Flow",
1164 .mask = FIO_OPT_G_IO_FLOW,
1165 },
1166 {
1167 .name = "Description",
1168 .mask = FIO_OPT_G_DESC,
1169 },
1170 {
1171 .name = "Filename",
1172 .mask = FIO_OPT_G_FILENAME,
1173 },
1174 {
1175 .name = "General I/O",
1176 .mask = FIO_OPT_G_IO_BASIC,
1177 },
1178 {
1179 .name = "Cgroups",
1180 .mask = FIO_OPT_G_CGROUP,
1181 },
1182 {
1183 .name = "Runtime",
1184 .mask = FIO_OPT_G_RUNTIME,
1185 },
1186 {
1187 .name = "Process",
1188 .mask = FIO_OPT_G_PROCESS,
1189 },
1190 {
1191 .name = "Job credentials / priority",
1192 .mask = FIO_OPT_G_CRED,
1193 },
1194 {
1195 .name = "Clock settings",
1196 .mask = FIO_OPT_G_CLOCK,
1197 },
1198 {
1199 .name = "I/O Type",
1200 .mask = FIO_OPT_G_IO_TYPE,
1201 },
1202 {
1203 .name = "I/O Thinktime",
1204 .mask = FIO_OPT_G_THINKTIME,
1205 },
1206 {
1207 .name = "Randomizations",
1208 .mask = FIO_OPT_G_RANDOM,
1209 },
1210 {
1211 .name = "I/O buffers",
1212 .mask = FIO_OPT_G_IO_BUF,
1213 },
1214 {
1215 .name = "Tiobench profile",
1216 .mask = FIO_OPT_G_TIOBENCH,
1217 },
1218
1219 {
1220 .name = NULL,
1221 }
1222};
1223
1224struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1225{
1226 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1227}
1228
1229/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001230 * Map of job/command line options
1231 */
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001232static struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001233 {
1234 .name = "description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001235 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001236 .type = FIO_OPT_STR_STORE,
1237 .off1 = td_var_offset(description),
1238 .help = "Text job description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001239 .category = FIO_OPT_C_GENERAL,
1240 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001241 },
1242 {
1243 .name = "name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001244 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001245 .type = FIO_OPT_STR_STORE,
1246 .off1 = td_var_offset(name),
1247 .help = "Name of this job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001248 .category = FIO_OPT_C_GENERAL,
1249 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001250 },
1251 {
1252 .name = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001253 .lname = "Filename(s)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001254 .type = FIO_OPT_STR_STORE,
1255 .off1 = td_var_offset(filename),
1256 .cb = str_filename_cb,
Jens Axboef0d524b2009-04-27 08:00:48 +02001257 .prio = -1, /* must come after "directory" */
Jens Axboe214e1ec2007-03-15 10:48:13 +01001258 .help = "File(s) to use for the workload",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001259 .category = FIO_OPT_C_FILE,
1260 .group = FIO_OPT_G_FILENAME,
1261 },
1262 {
1263 .name = "directory",
1264 .lname = "Directory",
1265 .type = FIO_OPT_STR_STORE,
1266 .off1 = td_var_offset(directory),
1267 .cb = str_directory_cb,
1268 .help = "Directory to store files in",
1269 .category = FIO_OPT_C_FILE,
1270 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001271 },
1272 {
Jens Axboede98bd32013-04-05 11:09:20 +02001273 .name = "filename_format",
1274 .type = FIO_OPT_STR_STORE,
1275 .off1 = td_var_offset(filename_format),
1276 .prio = -1, /* must come after "directory" */
1277 .help = "Override default $jobname.$jobnum.$filenum naming",
1278 .def = "$jobname.$jobnum.$filenum",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001279 .category = FIO_OPT_C_FILE,
1280 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001281 },
1282 {
Jens Axboe29c13492008-03-01 19:25:20 +01001283 .name = "lockfile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001284 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001285 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001286 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001287 .help = "Lock file when doing IO to it",
1288 .parent = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001289 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001290 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001291 .category = FIO_OPT_C_FILE,
1292 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001293 .posval = {
1294 { .ival = "none",
1295 .oval = FILE_LOCK_NONE,
1296 .help = "No file locking",
1297 },
1298 { .ival = "exclusive",
1299 .oval = FILE_LOCK_EXCLUSIVE,
1300 .help = "Exclusive file lock",
1301 },
1302 {
1303 .ival = "readwrite",
1304 .oval = FILE_LOCK_READWRITE,
1305 .help = "Read vs write lock",
1306 },
1307 },
Jens Axboe29c13492008-03-01 19:25:20 +01001308 },
1309 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001310 .name = "opendir",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001311 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001312 .type = FIO_OPT_STR_STORE,
1313 .off1 = td_var_offset(opendir),
1314 .cb = str_opendir_cb,
1315 .help = "Recursively add files from this directory and down",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001316 .category = FIO_OPT_C_FILE,
1317 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001318 },
1319 {
1320 .name = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001321 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001322 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001323 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001324 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001325 .off1 = td_var_offset(td_ddir),
1326 .help = "IO direction",
1327 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001328 .verify = rw_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001329 .category = FIO_OPT_C_IO,
1330 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001331 .posval = {
1332 { .ival = "read",
1333 .oval = TD_DDIR_READ,
1334 .help = "Sequential read",
1335 },
1336 { .ival = "write",
1337 .oval = TD_DDIR_WRITE,
1338 .help = "Sequential write",
1339 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001340 { .ival = "trim",
1341 .oval = TD_DDIR_TRIM,
1342 .help = "Sequential trim",
1343 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001344 { .ival = "randread",
1345 .oval = TD_DDIR_RANDREAD,
1346 .help = "Random read",
1347 },
1348 { .ival = "randwrite",
1349 .oval = TD_DDIR_RANDWRITE,
1350 .help = "Random write",
1351 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001352 { .ival = "randtrim",
1353 .oval = TD_DDIR_RANDTRIM,
1354 .help = "Random trim",
1355 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001356 { .ival = "rw",
1357 .oval = TD_DDIR_RW,
1358 .help = "Sequential read and write mix",
1359 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001360 { .ival = "readwrite",
1361 .oval = TD_DDIR_RW,
1362 .help = "Sequential read and write mix",
1363 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001364 { .ival = "randrw",
1365 .oval = TD_DDIR_RANDRW,
1366 .help = "Random read and write mix"
1367 },
1368 },
1369 },
1370 {
Jens Axboe38dad622010-07-20 14:46:00 -06001371 .name = "rw_sequencer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001372 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001373 .type = FIO_OPT_STR,
1374 .off1 = td_var_offset(rw_seq),
1375 .help = "IO offset generator modifier",
1376 .def = "sequential",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001377 .category = FIO_OPT_C_IO,
1378 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001379 .posval = {
1380 { .ival = "sequential",
1381 .oval = RW_SEQ_SEQ,
1382 .help = "Generate sequential offsets",
1383 },
1384 { .ival = "identical",
1385 .oval = RW_SEQ_IDENT,
1386 .help = "Generate identical offsets",
1387 },
1388 },
1389 },
1390
1391 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001392 .name = "ioengine",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001393 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001394 .type = FIO_OPT_STR_STORE,
1395 .off1 = td_var_offset(ioengine),
1396 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001397 .def = FIO_PREFERRED_ENGINE,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001398 .category = FIO_OPT_C_IO,
1399 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001400 .posval = {
1401 { .ival = "sync",
1402 .help = "Use read/write",
1403 },
gurudas paia31041e2007-10-23 15:12:30 +02001404 { .ival = "psync",
1405 .help = "Use pread/pwrite",
1406 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001407 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001408 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001409 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001410#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001411 { .ival = "libaio",
1412 .help = "Linux native asynchronous IO",
1413 },
1414#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001415#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001416 { .ival = "posixaio",
1417 .help = "POSIX asynchronous IO",
1418 },
1419#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001420#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001421 { .ival = "solarisaio",
1422 .help = "Solaris native asynchronous IO",
1423 },
1424#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001425#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001426 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001427 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001428 },
Jens Axboe3be80072011-01-19 11:07:28 -07001429#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001430 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001431 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001432 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001433#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001434 { .ival = "splice",
1435 .help = "splice/vmsplice based IO",
1436 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001437 { .ival = "netsplice",
1438 .help = "splice/vmsplice to/from the network",
1439 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001440#endif
1441#ifdef FIO_HAVE_SGIO
1442 { .ival = "sg",
1443 .help = "SCSI generic v3 IO",
1444 },
1445#endif
1446 { .ival = "null",
1447 .help = "Testing engine (no data transfer)",
1448 },
1449 { .ival = "net",
1450 .help = "Network IO",
1451 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001452 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001453 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001454 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001455#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001456 { .ival = "guasi",
1457 .help = "GUASI IO engine",
1458 },
1459#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001460#ifdef FIO_HAVE_BINJECT
1461 { .ival = "binject",
1462 .help = "binject direct inject block engine",
1463 },
1464#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001465#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001466 { .ival = "rdma",
1467 .help = "RDMA IO engine",
1468 },
1469#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001470#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001471 { .ival = "fusion-aw-sync",
1472 .help = "Fusion-io atomic write engine",
1473 },
1474#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001475#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001476 { .ival = "e4defrag",
1477 .help = "ext4 defrag engine",
1478 },
1479#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001480#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001481 { .ival = "falloc",
1482 .help = "fallocate() file based engine",
1483 },
1484#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001485 { .ival = "external",
1486 .help = "Load external engine (append name)",
1487 },
1488 },
1489 },
1490 {
1491 .name = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001492 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001493 .type = FIO_OPT_INT,
1494 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001495 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001496 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001497 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001498 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001499 .category = FIO_OPT_C_IO,
1500 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001501 },
1502 {
1503 .name = "iodepth_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001504 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001505 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001506 .type = FIO_OPT_INT,
1507 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001508 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001509 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001510 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001511 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001512 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001513 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001514 .category = FIO_OPT_C_IO,
1515 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001516 },
1517 {
Jens Axboe49504212008-06-05 09:03:30 +02001518 .name = "iodepth_batch_complete",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001519 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001520 .type = FIO_OPT_INT,
1521 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001522 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001523 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001524 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001525 .minval = 0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001526 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001527 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001528 .category = FIO_OPT_C_IO,
1529 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001530 },
1531 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001532 .name = "iodepth_low",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001533 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001534 .type = FIO_OPT_INT,
1535 .off1 = td_var_offset(iodepth_low),
1536 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001537 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001538 .hide = 1,
1539 .interval = 1,
1540 .category = FIO_OPT_C_IO,
1541 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001542 },
1543 {
1544 .name = "size",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001545 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001546 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001547 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001548 .help = "Total size of device or files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001549 .interval = 1024 * 1024,
1550 .category = FIO_OPT_C_IO,
1551 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001552 },
1553 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001554 .name = "fill_device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001555 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001556 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001557 .type = FIO_OPT_BOOL,
1558 .off1 = td_var_offset(fill_device),
1559 .help = "Write until an ENOSPC error occurs",
1560 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001561 .category = FIO_OPT_C_FILE,
1562 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001563 },
1564 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001565 .name = "filesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001566 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001567 .type = FIO_OPT_STR_VAL,
1568 .off1 = td_var_offset(file_size_low),
1569 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001570 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001571 .help = "Size of individual files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001572 .interval = 1024 * 1024,
1573 .category = FIO_OPT_C_FILE,
1574 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001575 },
1576 {
Jens Axboe67a10002007-07-31 23:12:16 +02001577 .name = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001578 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001579 .alias = "fileoffset",
1580 .type = FIO_OPT_STR_VAL,
1581 .off1 = td_var_offset(start_offset),
1582 .help = "Start IO from this offset",
1583 .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 Axboe67a10002007-07-31 23:12:16 +02001587 },
1588 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001589 .name = "offset_increment",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001590 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001591 .type = FIO_OPT_STR_VAL,
1592 .off1 = td_var_offset(offset_increment),
1593 .help = "What is the increment from one offset to the next",
1594 .parent = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001595 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001596 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001597 .interval = 1024 * 1024,
1598 .category = FIO_OPT_C_IO,
1599 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001600 },
1601 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001602 .name = "bs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001603 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001604 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001605 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001606 .off1 = td_var_offset(bs[DDIR_READ]),
1607 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001608 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001609 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001610 .help = "Block size unit",
1611 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001612 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001613 .hide = 1,
1614 .interval = 512,
1615 .category = FIO_OPT_C_IO,
1616 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001617 },
1618 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001619 .name = "ba",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001620 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001621 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001622 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001623 .off1 = td_var_offset(ba[DDIR_READ]),
1624 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001625 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001626 .minval = 1,
1627 .help = "IO block offset alignment",
1628 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001629 .hide = 1,
1630 .interval = 512,
1631 .category = FIO_OPT_C_IO,
1632 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001633 },
1634 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001635 .name = "bsrange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001636 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001637 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001638 .type = FIO_OPT_RANGE,
1639 .off1 = td_var_offset(min_bs[DDIR_READ]),
1640 .off2 = td_var_offset(max_bs[DDIR_READ]),
1641 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1642 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001643 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1644 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001645 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001646 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001647 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001648 .hide = 1,
1649 .interval = 4096,
1650 .category = FIO_OPT_C_IO,
1651 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001652 },
1653 {
Jens Axboe564ca972007-12-14 12:21:19 +01001654 .name = "bssplit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001655 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001656 .type = FIO_OPT_STR,
1657 .cb = str_bssplit_cb,
1658 .help = "Set a specific mix of block sizes",
1659 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001660 .hide = 1,
1661 .category = FIO_OPT_C_IO,
1662 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001663 },
1664 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001665 .name = "bs_unaligned",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001666 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001667 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001668 .type = FIO_OPT_STR_SET,
1669 .off1 = td_var_offset(bs_unaligned),
1670 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001671 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001672 .hide = 1,
1673 .category = FIO_OPT_C_IO,
1674 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001675 },
1676 {
1677 .name = "randrepeat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001678 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001679 .type = FIO_OPT_BOOL,
1680 .off1 = td_var_offset(rand_repeatable),
1681 .help = "Use repeatable random IO pattern",
1682 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001683 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001684 .hide = 1,
1685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001687 },
1688 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001689 .name = "use_os_rand",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001690 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001691 .type = FIO_OPT_BOOL,
1692 .off1 = td_var_offset(use_os_rand),
1693 .help = "Set to use OS random generator",
1694 .def = "0",
1695 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001696 .hide = 1,
1697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001699 },
1700 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001701 .name = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001702 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001703 .type = FIO_OPT_STR_SET,
1704 .off1 = td_var_offset(norandommap),
1705 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001706 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001707 .hide = 1,
1708 .hide_on_set = 1,
1709 .category = FIO_OPT_C_IO,
1710 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001711 },
1712 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001713 .name = "softrandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001714 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001715 .type = FIO_OPT_BOOL,
1716 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001717 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001718 .parent = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001719 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001720 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001721 .category = FIO_OPT_C_IO,
1722 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001723 },
1724 {
Jens Axboe8055e412012-11-26 08:43:47 +01001725 .name = "random_generator",
1726 .type = FIO_OPT_STR,
1727 .off1 = td_var_offset(random_generator),
1728 .help = "Type of random number generator to use",
1729 .def = "tausworthe",
1730 .posval = {
1731 { .ival = "tausworthe",
1732 .oval = FIO_RAND_GEN_TAUSWORTHE,
1733 .help = "Strong Tausworthe generator",
1734 },
1735 { .ival = "lfsr",
1736 .oval = FIO_RAND_GEN_LFSR,
1737 .help = "Variable length LFSR",
1738 },
1739 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001740 .category = FIO_OPT_C_IO,
1741 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001742 },
1743 {
Jens Axboee25839d2012-11-06 10:49:42 +01001744 .name = "random_distribution",
1745 .type = FIO_OPT_STR,
1746 .off1 = td_var_offset(random_distribution),
1747 .cb = str_random_distribution_cb,
1748 .help = "Random offset distribution generator",
1749 .def = "random",
1750 .posval = {
1751 { .ival = "random",
1752 .oval = FIO_RAND_DIST_RANDOM,
1753 .help = "Completely random",
1754 },
1755 { .ival = "zipf",
1756 .oval = FIO_RAND_DIST_ZIPF,
1757 .help = "Zipf distribution",
1758 },
Jens Axboe925fee32012-11-06 13:50:32 +01001759 { .ival = "pareto",
1760 .oval = FIO_RAND_DIST_PARETO,
1761 .help = "Pareto distribution",
1762 },
Jens Axboee25839d2012-11-06 10:49:42 +01001763 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001766 },
1767 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001768 .name = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001769 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001770 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001771 .type = FIO_OPT_INT,
1772 .off1 = td_var_offset(nr_files),
1773 .help = "Split job workload between this number of files",
1774 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001775 .interval = 1,
1776 .category = FIO_OPT_C_FILE,
1777 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001778 },
1779 {
1780 .name = "openfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001781 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001782 .type = FIO_OPT_INT,
1783 .off1 = td_var_offset(open_files),
1784 .help = "Number of files to keep open at the same time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001785 .category = FIO_OPT_C_FILE,
1786 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001787 },
1788 {
1789 .name = "file_service_type",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001790 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001791 .type = FIO_OPT_STR,
1792 .cb = str_fst_cb,
1793 .off1 = td_var_offset(file_service_type),
1794 .help = "How to select which file to service next",
1795 .def = "roundrobin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001796 .category = FIO_OPT_C_FILE,
1797 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001798 .posval = {
1799 { .ival = "random",
1800 .oval = FIO_FSERVICE_RANDOM,
1801 .help = "Choose a file at random",
1802 },
1803 { .ival = "roundrobin",
1804 .oval = FIO_FSERVICE_RR,
1805 .help = "Round robin select files",
1806 },
Jens Axboea086c252009-03-04 08:27:37 +01001807 { .ival = "sequential",
1808 .oval = FIO_FSERVICE_SEQ,
1809 .help = "Finish one file before moving to the next",
1810 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001811 },
Jens Axboe67a10002007-07-31 23:12:16 +02001812 .parent = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001813 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001814 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001815#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001816 {
1817 .name = "fallocate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001818 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001819 .type = FIO_OPT_STR,
1820 .off1 = td_var_offset(fallocate_mode),
1821 .help = "Whether pre-allocation is performed when laying out files",
1822 .def = "posix",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001823 .category = FIO_OPT_C_FILE,
1824 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001825 .posval = {
1826 { .ival = "none",
1827 .oval = FIO_FALLOCATE_NONE,
1828 .help = "Do not pre-allocate space",
1829 },
1830 { .ival = "posix",
1831 .oval = FIO_FALLOCATE_POSIX,
1832 .help = "Use posix_fallocate()",
1833 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001834#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001835 { .ival = "keep",
1836 .oval = FIO_FALLOCATE_KEEP_SIZE,
1837 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1838 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001839#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001840 /* Compatibility with former boolean values */
1841 { .ival = "0",
1842 .oval = FIO_FALLOCATE_NONE,
1843 .help = "Alias for 'none'",
1844 },
1845 { .ival = "1",
1846 .oval = FIO_FALLOCATE_POSIX,
1847 .help = "Alias for 'posix'",
1848 },
1849 },
1850 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001851#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001852 {
1853 .name = "fadvise_hint",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001854 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001855 .type = FIO_OPT_BOOL,
1856 .off1 = td_var_offset(fadvise_hint),
1857 .help = "Use fadvise() to advise the kernel on IO pattern",
1858 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001859 .category = FIO_OPT_C_FILE,
1860 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001861 },
1862 {
1863 .name = "fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001864 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001865 .type = FIO_OPT_INT,
1866 .off1 = td_var_offset(fsync_blocks),
1867 .help = "Issue fsync for writes every given number of blocks",
1868 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001869 .interval = 1,
1870 .category = FIO_OPT_C_FILE,
1871 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001872 },
1873 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001874 .name = "fdatasync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001875 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001876 .type = FIO_OPT_INT,
1877 .off1 = td_var_offset(fdatasync_blocks),
1878 .help = "Issue fdatasync for writes every given number of blocks",
1879 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001880 .interval = 1,
1881 .category = FIO_OPT_C_FILE,
1882 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001883 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001884 {
1885 .name = "write_barrier",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001886 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001887 .type = FIO_OPT_INT,
1888 .off1 = td_var_offset(barrier_blocks),
1889 .help = "Make every Nth write a barrier write",
1890 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001891 .interval = 1,
1892 .category = FIO_OPT_C_IO,
1893 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001894 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001895#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01001896 {
1897 .name = "sync_file_range",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001898 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01001899 .posval = {
1900 { .ival = "wait_before",
1901 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1902 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001903 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001904 },
1905 { .ival = "write",
1906 .oval = SYNC_FILE_RANGE_WRITE,
1907 .help = "SYNC_FILE_RANGE_WRITE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001908 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001909 },
1910 {
1911 .ival = "wait_after",
1912 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1913 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Jens Axboe3843deb2010-03-09 20:41:15 +01001914 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001915 },
1916 },
Jens Axboe3843deb2010-03-09 20:41:15 +01001917 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01001918 .cb = str_sfr_cb,
1919 .off1 = td_var_offset(sync_file_range),
1920 .help = "Use sync_file_range()",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001921 .category = FIO_OPT_C_FILE,
1922 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01001923 },
1924#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02001925 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001926 .name = "direct",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001927 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001928 .type = FIO_OPT_BOOL,
1929 .off1 = td_var_offset(odirect),
1930 .help = "Use O_DIRECT IO (negates buffered)",
1931 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001932 .inverse = "buffered",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001935 },
1936 {
1937 .name = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001938 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001939 .type = FIO_OPT_BOOL,
1940 .off1 = td_var_offset(odirect),
1941 .neg = 1,
1942 .help = "Use buffered IO (negates direct)",
1943 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001944 .inverse = "direct",
1945 .category = FIO_OPT_C_IO,
1946 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001947 },
1948 {
1949 .name = "overwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001950 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001951 .type = FIO_OPT_BOOL,
1952 .off1 = td_var_offset(overwrite),
1953 .help = "When writing, set whether to overwrite current data",
1954 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001955 .category = FIO_OPT_C_FILE,
1956 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001957 },
1958 {
1959 .name = "loops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001960 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001961 .type = FIO_OPT_INT,
1962 .off1 = td_var_offset(loops),
1963 .help = "Number of times to run the job",
1964 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001965 .interval = 1,
1966 .category = FIO_OPT_C_GENERAL,
1967 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001968 },
1969 {
1970 .name = "numjobs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001971 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001972 .type = FIO_OPT_INT,
1973 .off1 = td_var_offset(numjobs),
1974 .help = "Duplicate this job this many times",
1975 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001976 .interval = 1,
1977 .category = FIO_OPT_C_GENERAL,
1978 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001979 },
1980 {
1981 .name = "startdelay",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001982 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02001983 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001984 .off1 = td_var_offset(start_delay),
1985 .help = "Only start job when this period has passed",
1986 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001987 .category = FIO_OPT_C_GENERAL,
1988 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001989 },
1990 {
1991 .name = "runtime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001992 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001993 .alias = "timeout",
1994 .type = FIO_OPT_STR_VAL_TIME,
1995 .off1 = td_var_offset(timeout),
1996 .help = "Stop workload when this amount of time has passed",
1997 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001998 .category = FIO_OPT_C_GENERAL,
1999 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002000 },
2001 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002002 .name = "time_based",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002003 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002004 .type = FIO_OPT_STR_SET,
2005 .off1 = td_var_offset(time_based),
2006 .help = "Keep running until runtime/timeout is met",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002007 .category = FIO_OPT_C_GENERAL,
2008 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002009 },
2010 {
Jens Axboe721938a2008-09-10 09:46:16 +02002011 .name = "ramp_time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002012 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002013 .type = FIO_OPT_STR_VAL_TIME,
2014 .off1 = td_var_offset(ramp_time),
2015 .help = "Ramp up time before measuring performance",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002016 .category = FIO_OPT_C_GENERAL,
2017 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002018 },
2019 {
Jens Axboec223da82010-03-24 13:23:53 +01002020 .name = "clocksource",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002021 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002022 .type = FIO_OPT_STR,
2023 .cb = fio_clock_source_cb,
2024 .off1 = td_var_offset(clocksource),
2025 .help = "What type of timing source to use",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002026 .category = FIO_OPT_C_GENERAL,
2027 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002028 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002029#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002030 { .ival = "gettimeofday",
2031 .oval = CS_GTOD,
2032 .help = "Use gettimeofday(2) for timing",
2033 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002034#endif
2035#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002036 { .ival = "clock_gettime",
2037 .oval = CS_CGETTIME,
2038 .help = "Use clock_gettime(2) for timing",
2039 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002040#endif
Jens Axboec223da82010-03-24 13:23:53 +01002041#ifdef ARCH_HAVE_CPU_CLOCK
2042 { .ival = "cpu",
2043 .oval = CS_CPUCLOCK,
2044 .help = "Use CPU private clock",
2045 },
2046#endif
2047 },
2048 },
2049 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002050 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002051 .alias = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002052 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002053 .type = FIO_OPT_STR,
2054 .cb = str_mem_cb,
2055 .off1 = td_var_offset(mem_type),
2056 .help = "Backing type for IO buffers",
2057 .def = "malloc",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002058 .category = FIO_OPT_C_IO,
2059 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002060 .posval = {
2061 { .ival = "malloc",
2062 .oval = MEM_MALLOC,
2063 .help = "Use malloc(3) for IO buffers",
2064 },
Jens Axboeb370e462007-03-19 10:51:49 +01002065 { .ival = "shm",
2066 .oval = MEM_SHM,
2067 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002068 },
2069#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002070 { .ival = "shmhuge",
2071 .oval = MEM_SHMHUGE,
2072 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002073 },
2074#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002075 { .ival = "mmap",
2076 .oval = MEM_MMAP,
2077 .help = "Use mmap(2) (file or anon) for IO buffers",
2078 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002079#ifdef FIO_HAVE_HUGETLB
2080 { .ival = "mmaphuge",
2081 .oval = MEM_MMAPHUGE,
2082 .help = "Like mmap, but use huge pages",
2083 },
2084#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002085 },
2086 },
2087 {
Jens Axboed529ee12009-07-01 10:33:03 +02002088 .name = "iomem_align",
2089 .alias = "mem_align",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002090 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002091 .type = FIO_OPT_INT,
2092 .off1 = td_var_offset(mem_align),
2093 .minval = 0,
2094 .help = "IO memory buffer offset alignment",
2095 .def = "0",
2096 .parent = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002097 .hide = 1,
2098 .category = FIO_OPT_C_IO,
2099 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002100 },
2101 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002102 .name = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002103 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002104 .type = FIO_OPT_STR,
2105 .off1 = td_var_offset(verify),
2106 .help = "Verify data written",
Jens Axboe5d7c5d32010-06-21 15:08:17 +02002107 .cb = str_verify_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002108 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002109 .category = FIO_OPT_C_IO,
2110 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002111 .posval = {
2112 { .ival = "0",
2113 .oval = VERIFY_NONE,
2114 .help = "Don't do IO verification",
2115 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002116 { .ival = "md5",
2117 .oval = VERIFY_MD5,
2118 .help = "Use md5 checksums for verification",
2119 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002120 { .ival = "crc64",
2121 .oval = VERIFY_CRC64,
2122 .help = "Use crc64 checksums for verification",
2123 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002124 { .ival = "crc32",
2125 .oval = VERIFY_CRC32,
2126 .help = "Use crc32 checksums for verification",
2127 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002128 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002129 .oval = VERIFY_CRC32C,
2130 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002131 },
Jens Axboebac39e02008-06-11 20:46:19 +02002132 { .ival = "crc32c",
2133 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002134 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002135 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002136 { .ival = "crc16",
2137 .oval = VERIFY_CRC16,
2138 .help = "Use crc16 checksums for verification",
2139 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002140 { .ival = "crc7",
2141 .oval = VERIFY_CRC7,
2142 .help = "Use crc7 checksums for verification",
2143 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002144 { .ival = "sha1",
2145 .oval = VERIFY_SHA1,
2146 .help = "Use sha1 checksums for verification",
2147 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002148 { .ival = "sha256",
2149 .oval = VERIFY_SHA256,
2150 .help = "Use sha256 checksums for verification",
2151 },
2152 { .ival = "sha512",
2153 .oval = VERIFY_SHA512,
2154 .help = "Use sha512 checksums for verification",
2155 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002156 { .ival = "meta",
2157 .oval = VERIFY_META,
2158 .help = "Use io information",
2159 },
Jens Axboe36690c92007-03-26 10:23:34 +02002160 {
2161 .ival = "null",
2162 .oval = VERIFY_NULL,
2163 .help = "Pretend to verify",
2164 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002165 },
2166 },
2167 {
Jens Axboe005c5652007-08-02 22:21:36 +02002168 .name = "do_verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002169 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002170 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002171 .off1 = td_var_offset(do_verify),
2172 .help = "Run verification stage after write",
2173 .def = "1",
2174 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002175 .hide = 1,
2176 .category = FIO_OPT_C_IO,
2177 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002178 },
2179 {
Jens Axboe160b9662007-03-27 10:59:49 +02002180 .name = "verifysort",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002181 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002182 .type = FIO_OPT_BOOL,
2183 .off1 = td_var_offset(verifysort),
2184 .help = "Sort written verify blocks for read back",
2185 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002186 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002187 .hide = 1,
2188 .category = FIO_OPT_C_IO,
2189 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002190 },
2191 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002192 .name = "verifysort_nr",
2193 .type = FIO_OPT_INT,
2194 .off1 = td_var_offset(verifysort_nr),
2195 .help = "Pre-load and sort verify blocks for a read workload",
2196 .minval = 0,
2197 .maxval = 131072,
2198 .def = "1024",
2199 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002202 },
2203 {
Jens Axboea59e1702007-07-30 08:53:27 +02002204 .name = "verify_interval",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002205 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002206 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002207 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002208 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002209 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002210 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002211 .hide = 1,
2212 .interval = 2 * sizeof(struct verify_header),
2213 .category = FIO_OPT_C_IO,
2214 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002215 },
2216 {
Jens Axboea59e1702007-07-30 08:53:27 +02002217 .name = "verify_offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002218 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002219 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002220 .help = "Offset verify header location by N bytes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002221 .off1 = td_var_offset(verify_offset),
2222 .minval = sizeof(struct verify_header),
Jens Axboe5ec10ea2008-03-06 15:42:00 +01002223 .cb = str_verify_offset_cb,
Jens Axboeafdf9352007-07-31 16:14:34 +02002224 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002225 .hide = 1,
2226 .category = FIO_OPT_C_IO,
2227 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002228 },
2229 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002230 .name = "verify_pattern",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002231 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002232 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002233 .cb = str_verify_pattern_cb,
2234 .help = "Fill pattern for IO buffers",
2235 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002236 .hide = 1,
2237 .category = FIO_OPT_C_IO,
2238 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002239 },
2240 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002241 .name = "verify_fatal",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002242 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002243 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002244 .off1 = td_var_offset(verify_fatal),
2245 .def = "0",
2246 .help = "Exit on a single verify failure, don't continue",
2247 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002248 .hide = 1,
2249 .category = FIO_OPT_C_IO,
2250 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002251 },
2252 {
Jens Axboeb463e932011-01-12 09:03:23 +01002253 .name = "verify_dump",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002254 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002255 .type = FIO_OPT_BOOL,
2256 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002257 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002258 .help = "Dump contents of good and bad blocks on failure",
2259 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002260 .hide = 1,
2261 .category = FIO_OPT_C_IO,
2262 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002263 },
2264 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002265 .name = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002266 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002267 .type = FIO_OPT_INT,
2268 .off1 = td_var_offset(verify_async),
2269 .def = "0",
2270 .help = "Number of async verifier threads to use",
2271 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002272 .hide = 1,
2273 .category = FIO_OPT_C_IO,
2274 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002275 },
Jens Axboe9e144182010-06-15 14:25:36 +02002276 {
2277 .name = "verify_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002278 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002279 .type = FIO_OPT_STR_VAL,
2280 .off1 = td_var_offset(verify_backlog),
2281 .help = "Verify after this number of blocks are written",
2282 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002283 .hide = 1,
2284 .category = FIO_OPT_C_IO,
2285 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002286 },
2287 {
2288 .name = "verify_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002289 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(verify_batch),
2292 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002293 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002294 .hide = 1,
2295 .category = FIO_OPT_C_IO,
2296 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002297 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002298#ifdef FIO_HAVE_CPU_AFFINITY
2299 {
2300 .name = "verify_async_cpus",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002301 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002302 .type = FIO_OPT_STR,
2303 .cb = str_verify_cpus_allowed_cb,
2304 .help = "Set CPUs allowed for async verify threads",
2305 .parent = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002306 .hide = 1,
2307 .category = FIO_OPT_C_IO,
2308 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002309 },
2310#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002311 {
2312 .name = "experimental_verify",
2313 .off1 = td_var_offset(experimental_verify),
2314 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002315 .help = "Enable experimental verification",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002316 .category = FIO_OPT_C_IO,
2317 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002318 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002319#ifdef FIO_HAVE_TRIM
2320 {
2321 .name = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002322 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002323 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002324 .off1 = td_var_offset(trim_percentage),
2325 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002326 .maxval = 100,
2327 .help = "Number of verify blocks to discard/trim",
2328 .parent = "verify",
2329 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002330 .interval = 1,
2331 .hide = 1,
2332 .category = FIO_OPT_C_IO,
2333 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002334 },
2335 {
2336 .name = "trim_verify_zero",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002337 .lname = "Verify trim zero",
2338 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002339 .help = "Verify that trim/discarded blocks are returned as zeroes",
2340 .off1 = td_var_offset(trim_zero),
2341 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002342 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002343 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002344 .category = FIO_OPT_C_IO,
2345 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002346 },
2347 {
2348 .name = "trim_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002349 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002350 .type = FIO_OPT_STR_VAL,
2351 .off1 = td_var_offset(trim_backlog),
2352 .help = "Trim after this number of blocks are written",
2353 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002354 .hide = 1,
2355 .interval = 1,
2356 .category = FIO_OPT_C_IO,
2357 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002358 },
2359 {
2360 .name = "trim_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002361 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002362 .type = FIO_OPT_INT,
2363 .off1 = td_var_offset(trim_batch),
2364 .help = "Trim this number of IO blocks",
2365 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002366 .hide = 1,
2367 .interval = 1,
2368 .category = FIO_OPT_C_IO,
2369 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002370 },
2371#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002372 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002373 .name = "write_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002374 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002375 .type = FIO_OPT_STR_STORE,
2376 .off1 = td_var_offset(write_iolog_file),
2377 .help = "Store IO pattern to file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002380 },
2381 {
2382 .name = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002383 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002384 .type = FIO_OPT_STR_STORE,
2385 .off1 = td_var_offset(read_iolog_file),
2386 .help = "Playback IO pattern from file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002387 .category = FIO_OPT_C_IO,
2388 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002389 },
2390 {
David Nellans64bbb862010-08-24 22:13:30 +02002391 .name = "replay_no_stall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002392 .lname = "Don't stall on replay",
2393 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002394 .off1 = td_var_offset(no_stall),
2395 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002396 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002397 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002398 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002399 .category = FIO_OPT_C_IO,
2400 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002401 },
2402 {
David Nellansd1c46c02010-08-31 21:20:47 +02002403 .name = "replay_redirect",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002404 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002405 .type = FIO_OPT_STR_STORE,
2406 .off1 = td_var_offset(replay_redirect),
2407 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002408 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002409 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002410 .category = FIO_OPT_C_IO,
2411 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002412 },
2413 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002414 .name = "exec_prerun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002415 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002416 .type = FIO_OPT_STR_STORE,
2417 .off1 = td_var_offset(exec_prerun),
2418 .help = "Execute this file prior to running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002419 .category = FIO_OPT_C_GENERAL,
2420 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002421 },
2422 {
2423 .name = "exec_postrun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002424 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002425 .type = FIO_OPT_STR_STORE,
2426 .off1 = td_var_offset(exec_postrun),
2427 .help = "Execute this file after running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002428 .category = FIO_OPT_C_GENERAL,
2429 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002430 },
2431#ifdef FIO_HAVE_IOSCHED_SWITCH
2432 {
2433 .name = "ioscheduler",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002434 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002435 .type = FIO_OPT_STR_STORE,
2436 .off1 = td_var_offset(ioscheduler),
2437 .help = "Use this IO scheduler on the backing device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002438 .category = FIO_OPT_C_FILE,
2439 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002440 },
2441#endif
2442 {
2443 .name = "zonesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002444 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002445 .type = FIO_OPT_STR_VAL,
2446 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002447 .help = "Amount of data to read per zone",
2448 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002449 .interval = 1024 * 1024,
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002452 },
2453 {
2454 .name = "zonerange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002455 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002456 .type = FIO_OPT_STR_VAL,
2457 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002458 .help = "Give size of an IO zone",
2459 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002460 .interval = 1024 * 1024,
2461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002463 },
2464 {
2465 .name = "zoneskip",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002466 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002467 .type = FIO_OPT_STR_VAL,
2468 .off1 = td_var_offset(zone_skip),
2469 .help = "Space between IO zones",
2470 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002471 .interval = 1024 * 1024,
2472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002474 },
2475 {
2476 .name = "lockmem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002477 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002478 .type = FIO_OPT_STR_VAL,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002479 .off1 = td_var_offset(lockmem),
2480 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002481 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002482 .interval = 1024 * 1024,
2483 .category = FIO_OPT_C_GENERAL,
2484 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002485 },
2486 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002487 .name = "rwmixread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002488 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002489 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002490 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002491 .maxval = 100,
2492 .help = "Percentage of mixed workload that is reads",
2493 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002494 .interval = 5,
2495 .inverse = "rwmixwrite",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002498 },
2499 {
2500 .name = "rwmixwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002501 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002502 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002503 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002504 .maxval = 100,
2505 .help = "Percentage of mixed workload that is writes",
2506 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002507 .interval = 5,
2508 .inverse = "rwmixread",
2509 .category = FIO_OPT_C_IO,
2510 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002511 },
2512 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002513 .name = "rwmixcycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002514 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002515 .type = FIO_OPT_DEPRECATED,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002516 .category = FIO_OPT_C_IO,
2517 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002518 },
2519 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002520 .name = "nice",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002521 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002522 .type = FIO_OPT_INT,
2523 .off1 = td_var_offset(nice),
2524 .help = "Set job CPU nice value",
2525 .minval = -19,
2526 .maxval = 20,
2527 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002528 .interval = 1,
2529 .category = FIO_OPT_C_GENERAL,
2530 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002531 },
2532#ifdef FIO_HAVE_IOPRIO
2533 {
2534 .name = "prio",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002535 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002536 .type = FIO_OPT_INT,
2537 .cb = str_prio_cb,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002538 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002539 .help = "Set job IO priority value",
2540 .minval = 0,
2541 .maxval = 7,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002542 .interval = 1,
2543 .category = FIO_OPT_C_GENERAL,
2544 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002545 },
2546 {
2547 .name = "prioclass",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002548 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002549 .type = FIO_OPT_INT,
2550 .cb = str_prioclass_cb,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002551 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002552 .help = "Set job IO priority class",
2553 .minval = 0,
2554 .maxval = 3,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002555 .interval = 1,
2556 .category = FIO_OPT_C_GENERAL,
2557 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002558 },
2559#endif
2560 {
2561 .name = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002562 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(thinktime),
2565 .help = "Idle time between IO buffers (usec)",
2566 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002569 },
2570 {
2571 .name = "thinktime_spin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002572 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002573 .type = FIO_OPT_INT,
2574 .off1 = td_var_offset(thinktime_spin),
2575 .help = "Start think time by spinning this amount (usec)",
2576 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002577 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002578 .hide = 1,
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002581 },
2582 {
2583 .name = "thinktime_blocks",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002584 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002585 .type = FIO_OPT_INT,
2586 .off1 = td_var_offset(thinktime_blocks),
2587 .help = "IO buffer period between 'thinktime'",
2588 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002589 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002590 .hide = 1,
2591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002593 },
2594 {
2595 .name = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002596 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002597 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002598 .off1 = td_var_offset(rate[DDIR_READ]),
2599 .off2 = td_var_offset(rate[DDIR_WRITE]),
2600 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002601 .help = "Set bandwidth rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002604 },
2605 {
2606 .name = "ratemin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002607 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002608 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002609 .off1 = td_var_offset(ratemin[DDIR_READ]),
2610 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2611 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002612 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002613 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002614 .hide = 1,
2615 .category = FIO_OPT_C_IO,
2616 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002617 },
2618 {
2619 .name = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002620 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002621 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002622 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2623 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2624 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002625 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002626 .hide = 1,
2627 .category = FIO_OPT_C_IO,
2628 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002629 },
2630 {
2631 .name = "rate_iops_min",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002632 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002633 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002634 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2635 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2636 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002637 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002638 .parent = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002639 .hide = 1,
2640 .category = FIO_OPT_C_IO,
2641 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002642 },
2643 {
2644 .name = "ratecycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002645 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002646 .type = FIO_OPT_INT,
2647 .off1 = td_var_offset(ratecycle),
2648 .help = "Window average for rate limits (msec)",
2649 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002650 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002651 .hide = 1,
2652 .category = FIO_OPT_C_IO,
2653 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002654 },
2655 {
Jens Axboe15501532012-10-24 16:37:45 +02002656 .name = "max_latency",
2657 .type = FIO_OPT_INT,
2658 .off1 = td_var_offset(max_latency),
2659 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002660 .category = FIO_OPT_C_IO,
2661 .group = FIO_OPT_G_RATE,
Jens Axboe15501532012-10-24 16:37:45 +02002662 },
2663 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002664 .name = "invalidate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002665 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002666 .type = FIO_OPT_BOOL,
2667 .off1 = td_var_offset(invalidate_cache),
2668 .help = "Invalidate buffer/page cache prior to running job",
2669 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002670 .category = FIO_OPT_C_IO,
2671 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002672 },
2673 {
2674 .name = "sync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002675 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002676 .type = FIO_OPT_BOOL,
2677 .off1 = td_var_offset(sync_io),
2678 .help = "Use O_SYNC for buffered writes",
2679 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002680 .parent = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002681 .hide = 1,
2682 .category = FIO_OPT_C_IO,
2683 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002684 },
2685 {
2686 .name = "create_serialize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002687 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 .type = FIO_OPT_BOOL,
2689 .off1 = td_var_offset(create_serialize),
2690 .help = "Serialize creating of job files",
2691 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002692 .category = FIO_OPT_C_FILE,
2693 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002694 },
2695 {
2696 .name = "create_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002697 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002698 .type = FIO_OPT_BOOL,
2699 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002700 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002701 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002702 .category = FIO_OPT_C_FILE,
2703 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002704 },
2705 {
Jens Axboe814452b2009-03-04 12:53:13 +01002706 .name = "create_on_open",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002707 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002708 .type = FIO_OPT_BOOL,
2709 .off1 = td_var_offset(create_on_open),
2710 .help = "Create files when they are opened for IO",
2711 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002712 .category = FIO_OPT_C_FILE,
2713 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002714 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002715 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002716 .name = "create_only",
2717 .type = FIO_OPT_BOOL,
2718 .off1 = td_var_offset(create_only),
2719 .help = "Only perform file creation phase",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002720 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002721 .def = "0",
2722 },
2723 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002724 .name = "pre_read",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002725 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002726 .type = FIO_OPT_BOOL,
2727 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002728 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002729 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002730 .category = FIO_OPT_C_FILE,
2731 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002732 },
2733#ifdef FIO_HAVE_CPU_AFFINITY
2734 {
2735 .name = "cpumask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002736 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002737 .type = FIO_OPT_INT,
2738 .cb = str_cpumask_cb,
2739 .help = "CPU affinity mask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002740 .category = FIO_OPT_C_GENERAL,
2741 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002742 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002743 {
2744 .name = "cpus_allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002745 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002746 .type = FIO_OPT_STR,
2747 .cb = str_cpus_allowed_cb,
2748 .help = "Set CPUs allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002749 .category = FIO_OPT_C_GENERAL,
2750 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002751 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002752#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002753#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002754 {
2755 .name = "numa_cpu_nodes",
2756 .type = FIO_OPT_STR,
2757 .cb = str_numa_cpunodes_cb,
2758 .help = "NUMA CPU nodes bind",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002759 .category = FIO_OPT_C_GENERAL,
2760 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002761 },
2762 {
2763 .name = "numa_mem_policy",
2764 .type = FIO_OPT_STR,
2765 .cb = str_numa_mpol_cb,
2766 .help = "NUMA memory policy setup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002767 .category = FIO_OPT_C_GENERAL,
2768 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002769 },
2770#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002771 {
2772 .name = "end_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002773 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002774 .type = FIO_OPT_BOOL,
2775 .off1 = td_var_offset(end_fsync),
2776 .help = "Include fsync at the end of job",
2777 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002778 .category = FIO_OPT_C_FILE,
2779 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002780 },
2781 {
2782 .name = "fsync_on_close",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002783 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002784 .type = FIO_OPT_BOOL,
2785 .off1 = td_var_offset(fsync_on_close),
2786 .help = "fsync files on close",
2787 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002788 .category = FIO_OPT_C_FILE,
2789 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002790 },
2791 {
2792 .name = "unlink",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002793 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002794 .type = FIO_OPT_BOOL,
2795 .off1 = td_var_offset(unlink),
2796 .help = "Unlink created files after job has completed",
2797 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002798 .category = FIO_OPT_C_FILE,
2799 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002800 },
2801 {
2802 .name = "exitall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002803 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002804 .type = FIO_OPT_STR_SET,
2805 .cb = str_exitall_cb,
2806 .help = "Terminate all jobs when one exits",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002807 .category = FIO_OPT_C_GENERAL,
2808 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002809 },
2810 {
2811 .name = "stonewall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002812 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02002813 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002814 .type = FIO_OPT_STR_SET,
2815 .off1 = td_var_offset(stonewall),
2816 .help = "Insert a hard barrier between this job and previous",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002817 .category = FIO_OPT_C_GENERAL,
2818 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002819 },
2820 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01002821 .name = "new_group",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002822 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01002823 .type = FIO_OPT_STR_SET,
2824 .off1 = td_var_offset(new_group),
2825 .help = "Mark the start of a new group (for reporting)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002826 .category = FIO_OPT_C_GENERAL,
2827 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01002828 },
2829 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002830 .name = "thread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002831 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002832 .type = FIO_OPT_STR_SET,
2833 .off1 = td_var_offset(use_thread),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002834 .help = "Use threads instead of processes",
2835 .category = FIO_OPT_C_GENERAL,
2836 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002837 },
2838 {
2839 .name = "write_bw_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002840 .lname = "Write bandwidth log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002841 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002842 .off1 = td_var_offset(bw_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002843 .cb = str_write_bw_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002844 .help = "Write log of bandwidth during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002845 .category = FIO_OPT_C_LOG,
2846 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002847 },
2848 {
2849 .name = "write_lat_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002850 .lname = "Write latency log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002851 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002852 .off1 = td_var_offset(lat_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002853 .cb = str_write_lat_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002854 .help = "Write log of latency during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002855 .category = FIO_OPT_C_LOG,
2856 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002857 },
2858 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002859 .name = "write_iops_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002860 .lname = "Write IOPS log",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002861 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002862 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002863 .cb = str_write_iops_log_cb,
2864 .help = "Write log of IOPS during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002865 .category = FIO_OPT_C_LOG,
2866 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002867 },
2868 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002869 .name = "log_avg_msec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002870 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002871 .type = FIO_OPT_INT,
2872 .off1 = td_var_offset(log_avg_msec),
2873 .help = "Average bw/iops/lat logs over this period of time",
2874 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002875 .category = FIO_OPT_C_LOG,
2876 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002877 },
2878 {
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002879 .name = "bwavgtime",
2880 .lname = "Bandwidth average time",
Jens Axboee01b22b2009-06-09 15:43:25 +02002881 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002882 .off1 = td_var_offset(bw_avg_time),
2883 .help = "Time window over which to calculate bandwidth"
2884 " (msec)",
2885 .def = "500",
2886 .parent = "write_bw_log",
2887 .hide = 1,
2888 .interval = 100,
2889 .category = FIO_OPT_C_LOG,
2890 .group = FIO_OPT_G_INVALID,
2891 },
2892 {
2893 .name = "iopsavgtime",
2894 .lname = "IOPS average time",
2895 .type = FIO_OPT_INT,
2896 .off1 = td_var_offset(iops_avg_time),
2897 .help = "Time window over which to calculate IOPS (msec)",
2898 .def = "500",
2899 .parent = "write_iops_log",
2900 .hide = 1,
2901 .interval = 100,
2902 .category = FIO_OPT_C_LOG,
2903 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002904 },
2905 {
2906 .name = "group_reporting",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002907 .lname = "Group reporting",
2908 .type = FIO_OPT_BOOL,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002909 .off1 = td_var_offset(group_reporting),
2910 .help = "Do reporting on a per-group basis",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002911 .def = "1",
2912 .category = FIO_OPT_C_STAT,
2913 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002914 },
2915 {
Jens Axboee9459e52007-04-17 15:46:32 +02002916 .name = "zero_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002917 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02002918 .type = FIO_OPT_STR_SET,
2919 .off1 = td_var_offset(zero_buffers),
2920 .help = "Init IO buffers to all zeroes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002921 .category = FIO_OPT_C_IO,
2922 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02002923 },
Jens Axboe5973caf2008-05-21 19:52:35 +02002924 {
2925 .name = "refill_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002926 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02002927 .type = FIO_OPT_STR_SET,
2928 .off1 = td_var_offset(refill_buffers),
2929 .help = "Refill IO buffers on every IO submit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002930 .category = FIO_OPT_C_IO,
2931 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02002932 },
Yu-ju Hong83349192011-08-13 00:53:44 +02002933 {
Jens Axboefd684182011-09-19 09:24:44 +02002934 .name = "scramble_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002935 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02002936 .type = FIO_OPT_BOOL,
2937 .off1 = td_var_offset(scramble_buffers),
2938 .help = "Slightly scramble buffers on every IO submit",
2939 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002940 .category = FIO_OPT_C_IO,
2941 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02002942 },
2943 {
Jens Axboe9c426842012-03-02 21:02:12 +01002944 .name = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002945 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01002946 .type = FIO_OPT_INT,
2947 .off1 = td_var_offset(compress_percentage),
2948 .maxval = 100,
2949 .minval = 1,
2950 .help = "How compressible the buffer is (approximately)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002951 .interval = 5,
2952 .category = FIO_OPT_C_IO,
2953 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01002954 },
2955 {
Jens Axboef97a43a2012-03-09 19:06:24 +01002956 .name = "buffer_compress_chunk",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002957 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01002958 .type = FIO_OPT_INT,
2959 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01002960 .parent = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002961 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01002962 .help = "Size of compressible region in buffer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002963 .interval = 256,
2964 .category = FIO_OPT_C_IO,
2965 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01002966 },
2967 {
Yu-ju Hong83349192011-08-13 00:53:44 +02002968 .name = "clat_percentiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002969 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02002970 .type = FIO_OPT_BOOL,
2971 .off1 = td_var_offset(clat_percentiles),
2972 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02002973 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002974 .category = FIO_OPT_C_STAT,
2975 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002976 },
2977 {
2978 .name = "percentile_list",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002979 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02002980 .type = FIO_OPT_FLOAT_LIST,
2981 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01002982 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02002983 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01002984 .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 +02002985 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2986 .minfp = 0.0,
2987 .maxfp = 100.0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002988 .category = FIO_OPT_C_STAT,
2989 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002990 },
2991
Jens Axboe0a839f32007-04-26 09:02:34 +02002992#ifdef FIO_HAVE_DISK_UTIL
2993 {
2994 .name = "disk_util",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002995 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02002996 .type = FIO_OPT_BOOL,
2997 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02002998 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02002999 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003000 .category = FIO_OPT_C_STAT,
3001 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003002 },
3003#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003004 {
Jens Axboe993bf482008-11-14 13:04:53 +01003005 .name = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003006 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003007 .type = FIO_OPT_BOOL,
3008 .help = "Greatly reduce number of gettimeofday() calls",
3009 .cb = str_gtod_reduce_cb,
3010 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003011 .hide_on_set = 1,
3012 .category = FIO_OPT_C_STAT,
3013 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003014 },
3015 {
Jens Axboe02af0982010-06-24 09:59:34 +02003016 .name = "disable_lat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003017 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003018 .type = FIO_OPT_BOOL,
3019 .off1 = td_var_offset(disable_lat),
3020 .help = "Disable latency numbers",
3021 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003022 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003023 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003024 .category = FIO_OPT_C_STAT,
3025 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003026 },
3027 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003028 .name = "disable_clat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003029 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003030 .type = FIO_OPT_BOOL,
3031 .off1 = td_var_offset(disable_clat),
3032 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003033 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003034 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003035 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003036 .category = FIO_OPT_C_STAT,
3037 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003038 },
3039 {
3040 .name = "disable_slat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003041 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003042 .type = FIO_OPT_BOOL,
3043 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003044 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003045 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003046 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003047 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003048 .category = FIO_OPT_C_STAT,
3049 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003050 },
3051 {
3052 .name = "disable_bw_measurement",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003053 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003054 .type = FIO_OPT_BOOL,
3055 .off1 = td_var_offset(disable_bw),
3056 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003057 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003058 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003059 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003060 .category = FIO_OPT_C_STAT,
3061 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003062 },
3063 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003064 .name = "gtod_cpu",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003065 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003066 .type = FIO_OPT_INT,
3067 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003068 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003069 .verify = gtod_cpu_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003070 .category = FIO_OPT_C_GENERAL,
3071 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003072 },
3073 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003074 .name = "unified_rw_reporting",
3075 .type = FIO_OPT_BOOL,
3076 .off1 = td_var_offset(unified_rw_rep),
3077 .help = "Unify reporting across data direction",
3078 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003079 .category = FIO_OPT_C_GENERAL,
3080 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003081 },
3082 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003083 .name = "continue_on_error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003084 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003085 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003086 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003087 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003088 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003089 .category = FIO_OPT_C_GENERAL,
3090 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003091 .posval = {
3092 { .ival = "none",
3093 .oval = ERROR_TYPE_NONE,
3094 .help = "Exit when an error is encountered",
3095 },
3096 { .ival = "read",
3097 .oval = ERROR_TYPE_READ,
3098 .help = "Continue on read errors only",
3099 },
3100 { .ival = "write",
3101 .oval = ERROR_TYPE_WRITE,
3102 .help = "Continue on write errors only",
3103 },
3104 { .ival = "io",
3105 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3106 .help = "Continue on any IO errors",
3107 },
3108 { .ival = "verify",
3109 .oval = ERROR_TYPE_VERIFY,
3110 .help = "Continue on verify errors only",
3111 },
3112 { .ival = "all",
3113 .oval = ERROR_TYPE_ANY,
3114 .help = "Continue on all io and verify errors",
3115 },
3116 { .ival = "0",
3117 .oval = ERROR_TYPE_NONE,
3118 .help = "Alias for 'none'",
3119 },
3120 { .ival = "1",
3121 .oval = ERROR_TYPE_ANY,
3122 .help = "Alias for 'all'",
3123 },
3124 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003125 },
3126 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003127 .name = "ignore_error",
3128 .type = FIO_OPT_STR,
3129 .cb = str_ignore_error_cb,
3130 .help = "Set a specific list of errors to ignore",
3131 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003132 .category = FIO_OPT_C_GENERAL,
3133 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003134 },
3135 {
3136 .name = "error_dump",
3137 .type = FIO_OPT_BOOL,
3138 .off1 = td_var_offset(error_dump),
3139 .def = "0",
3140 .help = "Dump info on each error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003141 .category = FIO_OPT_C_GENERAL,
3142 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003143 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003144 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003145 .name = "profile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003146 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003147 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003148 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003149 .help = "Select a specific builtin performance test",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003150 .category = FIO_OPT_C_PROFILE,
3151 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003152 },
3153 {
Jens Axboea696fa22009-12-04 10:05:02 +01003154 .name = "cgroup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003155 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003156 .type = FIO_OPT_STR_STORE,
3157 .off1 = td_var_offset(cgroup),
3158 .help = "Add job to cgroup of this name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003159 .category = FIO_OPT_C_GENERAL,
3160 .group = FIO_OPT_G_CGROUP,
3161 },
3162 {
3163 .name = "cgroup_nodelete",
3164 .lname = "Cgroup no-delete",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(cgroup_nodelete),
3167 .help = "Do not delete cgroups after job completion",
3168 .def = "0",
3169 .parent = "cgroup",
3170 .category = FIO_OPT_C_GENERAL,
3171 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003172 },
3173 {
3174 .name = "cgroup_weight",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003175 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003176 .type = FIO_OPT_INT,
3177 .off1 = td_var_offset(cgroup_weight),
3178 .help = "Use given weight for cgroup",
3179 .minval = 100,
3180 .maxval = 1000,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003181 .parent = "cgroup",
3182 .category = FIO_OPT_C_GENERAL,
3183 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003184 },
3185 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003186 .name = "uid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003187 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003188 .type = FIO_OPT_INT,
3189 .off1 = td_var_offset(uid),
3190 .help = "Run job with this user ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003191 .category = FIO_OPT_C_GENERAL,
3192 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003193 },
3194 {
3195 .name = "gid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003196 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003197 .type = FIO_OPT_INT,
3198 .off1 = td_var_offset(gid),
3199 .help = "Run job with this group ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003200 .category = FIO_OPT_C_GENERAL,
3201 .group = FIO_OPT_G_CRED,
3202 },
3203 {
3204 .name = "kb_base",
3205 .lname = "KB Base",
3206 .type = FIO_OPT_INT,
3207 .off1 = td_var_offset(kb_base),
3208 .prio = 1,
3209 .def = "1024",
3210 .posval = {
3211 { .ival = "1024",
3212 .oval = 1024,
3213 .help = "Use 1024 as the K base",
3214 },
3215 { .ival = "1000",
3216 .oval = 1000,
3217 .help = "Use 1000 as the K base",
3218 },
3219 },
3220 .help = "How many bytes per KB for reporting (1000 or 1024)",
3221 .category = FIO_OPT_C_GENERAL,
3222 .group = FIO_OPT_G_INVALID,
3223 },
3224 {
3225 .name = "unit_base",
3226 .lname = "Base unit for reporting (Bits or Bytes)",
3227 .type = FIO_OPT_INT,
3228 .off1 = td_var_offset(unit_base),
3229 .prio = 1,
3230 .posval = {
3231 { .ival = "0",
3232 .oval = 0,
3233 .help = "Auto-detect",
3234 },
3235 { .ival = "8",
3236 .oval = 8,
3237 .help = "Normal (byte based)",
3238 },
3239 { .ival = "1",
3240 .oval = 1,
3241 .help = "Bit based",
3242 },
3243 },
3244 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_INVALID,
3247 },
3248 {
3249 .name = "hugepage-size",
3250 .lname = "Hugepage size",
3251 .type = FIO_OPT_INT,
3252 .off1 = td_var_offset(hugepage_size),
3253 .help = "When using hugepages, specify size of each page",
3254 .def = __fio_stringify(FIO_HUGE_PAGE),
3255 .interval = 1024 * 1024,
3256 .category = FIO_OPT_C_GENERAL,
3257 .group = FIO_OPT_G_INVALID,
Jens Axboee0b0d892009-12-08 10:10:14 +01003258 },
3259 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003260 .name = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003261 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003262 .type = FIO_OPT_INT,
3263 .off1 = td_var_offset(flow_id),
3264 .help = "The flow index ID to use",
3265 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003266 .category = FIO_OPT_C_IO,
3267 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003268 },
3269 {
3270 .name = "flow",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003271 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003272 .type = FIO_OPT_INT,
3273 .off1 = td_var_offset(flow),
3274 .help = "Weight for flow control of this job",
3275 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003276 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003277 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003278 .category = FIO_OPT_C_IO,
3279 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003280 },
3281 {
3282 .name = "flow_watermark",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003283 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003284 .type = FIO_OPT_INT,
3285 .off1 = td_var_offset(flow_watermark),
3286 .help = "High watermark for flow control. This option"
3287 " should be set to the same value for all threads"
3288 " with non-zero flow.",
3289 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003290 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003291 .def = "1024",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003292 .category = FIO_OPT_C_IO,
3293 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003294 },
3295 {
3296 .name = "flow_sleep",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003297 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003298 .type = FIO_OPT_INT,
3299 .off1 = td_var_offset(flow_sleep),
3300 .help = "How many microseconds to sleep after being held"
3301 " back by the flow control mechanism",
3302 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003303 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003304 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003305 .category = FIO_OPT_C_IO,
3306 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003307 },
3308 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003309 .name = NULL,
3310 },
3311};
3312
Jens Axboe17af15d2010-04-13 10:38:16 +02003313static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003314 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003315{
Jens Axboe17af15d2010-04-13 10:38:16 +02003316 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003317 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003318 if (o->type == FIO_OPT_STR_SET)
3319 lopt->has_arg = no_argument;
3320 else
3321 lopt->has_arg = required_argument;
3322}
3323
Steven Langde890a12011-11-09 14:03:34 +01003324static void options_to_lopts(struct fio_option *opts,
3325 struct option *long_options,
3326 int i, int option_type)
3327{
3328 struct fio_option *o = &opts[0];
3329 while (o->name) {
3330 add_to_lopt(&long_options[i], o, o->name, option_type);
3331 if (o->alias) {
3332 i++;
3333 add_to_lopt(&long_options[i], o, o->alias, option_type);
3334 }
3335
3336 i++;
3337 o++;
3338 assert(i < FIO_NR_OPTIONS);
3339 }
3340}
3341
3342void fio_options_set_ioengine_opts(struct option *long_options,
3343 struct thread_data *td)
3344{
3345 unsigned int i;
3346
3347 i = 0;
3348 while (long_options[i].name) {
3349 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3350 memset(&long_options[i], 0, sizeof(*long_options));
3351 break;
3352 }
3353 i++;
3354 }
3355
3356 /*
3357 * Just clear out the prior ioengine options.
3358 */
3359 if (!td || !td->eo)
3360 return;
3361
3362 options_to_lopts(td->io_ops->options, long_options, i,
3363 FIO_GETOPT_IOENGINE);
3364}
3365
Jens Axboe214e1ec2007-03-15 10:48:13 +01003366void fio_options_dup_and_init(struct option *long_options)
3367{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003368 unsigned int i;
3369
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003370 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003371
3372 i = 0;
3373 while (long_options[i].name)
3374 i++;
3375
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003376 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003377}
3378
Jens Axboe74929ac2009-08-05 11:42:37 +02003379struct fio_keyword {
3380 const char *word;
3381 const char *desc;
3382 char *replace;
3383};
3384
3385static struct fio_keyword fio_keywords[] = {
3386 {
3387 .word = "$pagesize",
3388 .desc = "Page size in the system",
3389 },
3390 {
3391 .word = "$mb_memory",
3392 .desc = "Megabytes of memory online",
3393 },
3394 {
3395 .word = "$ncpus",
3396 .desc = "Number of CPUs online in the system",
3397 },
3398 {
3399 .word = NULL,
3400 },
3401};
3402
3403void fio_keywords_init(void)
3404{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003405 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003406 char buf[128];
3407 long l;
3408
Jens Axboea4cfc472012-10-09 10:30:48 -06003409 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003410 fio_keywords[0].replace = strdup(buf);
3411
Jens Axboe8eb016d2011-07-11 10:24:20 +02003412 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003413 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003414 fio_keywords[1].replace = strdup(buf);
3415
Jens Axboec00a2282011-07-08 20:56:06 +02003416 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003417 sprintf(buf, "%lu", l);
3418 fio_keywords[2].replace = strdup(buf);
3419}
3420
Jens Axboe892a6ff2009-11-13 12:19:49 +01003421#define BC_APP "bc"
3422
3423static char *bc_calc(char *str)
3424{
Steven Langd0c814e2011-10-28 08:37:13 +02003425 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003426 FILE *f;
3427 int ret;
3428
3429 /*
3430 * No math, just return string
3431 */
Steven Langd0c814e2011-10-28 08:37:13 +02003432 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3433 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003434 return str;
3435
3436 /*
3437 * Split option from value, we only need to calculate the value
3438 */
3439 tmp = strchr(str, '=');
3440 if (!tmp)
3441 return str;
3442
3443 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003444
Steven Langd0c814e2011-10-28 08:37:13 +02003445 /*
3446 * Prevent buffer overflows; such a case isn't reasonable anyway
3447 */
3448 if (strlen(str) >= 128 || strlen(tmp) > 100)
3449 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003450
3451 sprintf(buf, "which %s > /dev/null", BC_APP);
3452 if (system(buf)) {
3453 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003454 return NULL;
3455 }
3456
Steven Langd0c814e2011-10-28 08:37:13 +02003457 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003458 f = popen(buf, "r");
3459 if (!f) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003460 return NULL;
3461 }
3462
Steven Langd0c814e2011-10-28 08:37:13 +02003463 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003464 if (ret <= 0) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003465 return NULL;
3466 }
3467
Jens Axboe892a6ff2009-11-13 12:19:49 +01003468 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003469 buf[(tmp - str) + ret - 1] = '\0';
3470 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003471 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003472 return strdup(buf);
3473}
3474
3475/*
3476 * Return a copy of the input string with substrings of the form ${VARNAME}
3477 * substituted with the value of the environment variable VARNAME. The
3478 * substitution always occurs, even if VARNAME is empty or the corresponding
3479 * environment variable undefined.
3480 */
3481static char *option_dup_subs(const char *opt)
3482{
3483 char out[OPT_LEN_MAX+1];
3484 char in[OPT_LEN_MAX+1];
3485 char *outptr = out;
3486 char *inptr = in;
3487 char *ch1, *ch2, *env;
3488 ssize_t nchr = OPT_LEN_MAX;
3489 size_t envlen;
3490
3491 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3492 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3493 return NULL;
3494 }
3495
3496 in[OPT_LEN_MAX] = '\0';
3497 strncpy(in, opt, OPT_LEN_MAX);
3498
3499 while (*inptr && nchr > 0) {
3500 if (inptr[0] == '$' && inptr[1] == '{') {
3501 ch2 = strchr(inptr, '}');
3502 if (ch2 && inptr+1 < ch2) {
3503 ch1 = inptr+2;
3504 inptr = ch2+1;
3505 *ch2 = '\0';
3506
3507 env = getenv(ch1);
3508 if (env) {
3509 envlen = strlen(env);
3510 if (envlen <= nchr) {
3511 memcpy(outptr, env, envlen);
3512 outptr += envlen;
3513 nchr -= envlen;
3514 }
3515 }
3516
3517 continue;
3518 }
3519 }
3520
3521 *outptr++ = *inptr++;
3522 --nchr;
3523 }
3524
3525 *outptr = '\0';
3526 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003527}
3528
Jens Axboe74929ac2009-08-05 11:42:37 +02003529/*
3530 * Look for reserved variable names and replace them with real values
3531 */
3532static char *fio_keyword_replace(char *opt)
3533{
3534 char *s;
3535 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003536 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003537
3538 for (i = 0; fio_keywords[i].word != NULL; i++) {
3539 struct fio_keyword *kw = &fio_keywords[i];
3540
3541 while ((s = strstr(opt, kw->word)) != NULL) {
3542 char *new = malloc(strlen(opt) + 1);
3543 char *o_org = opt;
3544 int olen = s - opt;
3545 int len;
3546
3547 /*
3548 * Copy part of the string before the keyword and
3549 * sprintf() the replacement after it.
3550 */
3551 memcpy(new, opt, olen);
3552 len = sprintf(new + olen, "%s", kw->replace);
3553
3554 /*
3555 * If there's more in the original string, copy that
3556 * in too
3557 */
3558 opt += strlen(kw->word) + olen;
3559 if (strlen(opt))
3560 memcpy(new + olen + len, opt, opt - o_org - 1);
3561
3562 /*
3563 * replace opt and free the old opt
3564 */
3565 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003566 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003567
Steven Langd0c814e2011-10-28 08:37:13 +02003568 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003569 }
3570 }
3571
Steven Langd0c814e2011-10-28 08:37:13 +02003572 /*
3573 * Check for potential math and invoke bc, if possible
3574 */
3575 if (docalc)
3576 opt = bc_calc(opt);
3577
Jens Axboe7a958bd2009-11-13 12:33:54 +01003578 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003579}
3580
Steven Langd0c814e2011-10-28 08:37:13 +02003581static char **dup_and_sub_options(char **opts, int num_opts)
3582{
3583 int i;
3584 char **opts_copy = malloc(num_opts * sizeof(*opts));
3585 for (i = 0; i < num_opts; i++) {
3586 opts_copy[i] = option_dup_subs(opts[i]);
3587 if (!opts_copy[i])
3588 continue;
3589 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3590 }
3591 return opts_copy;
3592}
3593
Jens Axboe3b8b7132008-06-10 19:46:23 +02003594int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003595{
Steven Langde890a12011-11-09 14:03:34 +01003596 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003597 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003598
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003599 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003600 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003601
Steven Langde890a12011-11-09 14:03:34 +01003602 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3603 struct fio_option *o;
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003604 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3605 &o, td);
Steven Langd0c814e2011-10-28 08:37:13 +02003606
Steven Langde890a12011-11-09 14:03:34 +01003607 if (opts_copy[i]) {
3608 if (newret && !o) {
3609 unknown++;
3610 continue;
3611 }
Steven Langd0c814e2011-10-28 08:37:13 +02003612 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003613 opts_copy[i] = NULL;
3614 }
3615
3616 ret |= newret;
3617 }
3618
3619 if (unknown) {
3620 ret |= ioengine_load(td);
3621 if (td->eo) {
3622 sort_options(opts_copy, td->io_ops->options, num_opts);
3623 opts = opts_copy;
3624 }
3625 for (i = 0; i < num_opts; i++) {
3626 struct fio_option *o = NULL;
3627 int newret = 1;
3628 if (!opts_copy[i])
3629 continue;
3630
3631 if (td->eo)
3632 newret = parse_option(opts_copy[i], opts[i],
3633 td->io_ops->options, &o,
3634 td->eo);
3635
3636 ret |= newret;
3637 if (!o)
3638 log_err("Bad option <%s>\n", opts[i]);
3639
3640 free(opts_copy[i]);
3641 opts_copy[i] = NULL;
3642 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003643 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003644
Steven Langd0c814e2011-10-28 08:37:13 +02003645 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003646 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003647}
3648
3649int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3650{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003651 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003652}
3653
Steven Langde890a12011-11-09 14:03:34 +01003654int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3655 char *val)
3656{
3657 return parse_cmd_option(opt, val, td->io_ops->options, td);
3658}
3659
Jens Axboe214e1ec2007-03-15 10:48:13 +01003660void fio_fill_default_options(struct thread_data *td)
3661{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003662 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003663}
3664
3665int fio_show_option_help(const char *opt)
3666{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003667 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003668}
Jens Axboed23bb322007-03-23 15:57:56 +01003669
Steven Langde890a12011-11-09 14:03:34 +01003670void options_mem_dupe(void *data, struct fio_option *options)
3671{
3672 struct fio_option *o;
3673 char **ptr;
3674
3675 for (o = &options[0]; o->name; o++) {
3676 if (o->type != FIO_OPT_STR_STORE)
3677 continue;
3678
3679 ptr = td_var(data, o->off1);
3680 if (*ptr)
3681 *ptr = strdup(*ptr);
3682 }
3683}
3684
Jens Axboe7e356b22011-10-14 10:55:16 +02003685/*
3686 * dupe FIO_OPT_STR_STORE options
3687 */
Steven Langde890a12011-11-09 14:03:34 +01003688void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003689{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003690 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003691
3692 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003693 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003694
Steven Langde890a12011-11-09 14:03:34 +01003695 td->eo = malloc(td->io_ops->option_struct_size);
3696 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3697 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003698 }
3699}
3700
Jens Axboed6978a32009-07-18 21:04:09 +02003701unsigned int fio_get_kb_base(void *data)
3702{
3703 struct thread_data *td = data;
3704 unsigned int kb_base = 0;
3705
3706 if (td)
3707 kb_base = td->o.kb_base;
3708 if (!kb_base)
3709 kb_base = 1024;
3710
3711 return kb_base;
3712}
Jens Axboe9f988e22010-03-04 10:42:38 +01003713
Jens Axboe07b32322010-03-05 09:48:44 +01003714int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003715{
Jens Axboe07b32322010-03-05 09:48:44 +01003716 struct fio_option *__o;
3717 int opt_index = 0;
3718
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003719 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003720 while (__o->name) {
3721 opt_index++;
3722 __o++;
3723 }
3724
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003725 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe07b32322010-03-05 09:48:44 +01003726 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003727}
Jens Axboee2de69d2010-03-04 14:05:48 +01003728
Jens Axboe07b32322010-03-05 09:48:44 +01003729void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003730{
Jens Axboe07b32322010-03-05 09:48:44 +01003731 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003732
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003733 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003734 while (o->name) {
3735 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3736 o->type = FIO_OPT_INVALID;
3737 o->prof_name = NULL;
3738 }
3739 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003740 }
3741}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003742
3743void add_opt_posval(const char *optname, const char *ival, const char *help)
3744{
3745 struct fio_option *o;
3746 unsigned int i;
3747
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003748 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003749 if (!o)
3750 return;
3751
3752 for (i = 0; i < PARSE_MAX_VP; i++) {
3753 if (o->posval[i].ival)
3754 continue;
3755
3756 o->posval[i].ival = ival;
3757 o->posval[i].help = help;
3758 break;
3759 }
3760}
3761
3762void del_opt_posval(const char *optname, const char *ival)
3763{
3764 struct fio_option *o;
3765 unsigned int i;
3766
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003767 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003768 if (!o)
3769 return;
3770
3771 for (i = 0; i < PARSE_MAX_VP; i++) {
3772 if (!o->posval[i].ival)
3773 continue;
3774 if (strcmp(o->posval[i].ival, ival))
3775 continue;
3776
3777 o->posval[i].ival = NULL;
3778 o->posval[i].help = NULL;
3779 }
3780}
Jens Axboe7e356b22011-10-14 10:55:16 +02003781
3782void fio_options_free(struct thread_data *td)
3783{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003784 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003785 if (td->eo && td->io_ops && td->io_ops->options) {
3786 options_free(td->io_ops->options, td->eo);
3787 free(td->eo);
3788 td->eo = NULL;
3789 }
Jens Axboe7e356b22011-10-14 10:55:16 +02003790}