blob: 16b9fbc09c9f25d68dbc1aca568bfc949d908085 [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 Axboec223da82010-03-24 13:23:53 +0100351static int fio_clock_source_cb(void *data, const char *str)
352{
353 struct thread_data *td = data;
354
355 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100356 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100357 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100358 return 0;
359}
360
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400361static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200362{
363 struct thread_data *td = data;
364
365 td->o.rwmix[DDIR_READ] = *val;
366 td->o.rwmix[DDIR_WRITE] = 100 - *val;
367 return 0;
368}
369
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400370static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200371{
372 struct thread_data *td = data;
373
374 td->o.rwmix[DDIR_WRITE] = *val;
375 td->o.rwmix[DDIR_READ] = 100 - *val;
376 return 0;
377}
378
Jens Axboe214e1ec2007-03-15 10:48:13 +0100379#ifdef FIO_HAVE_IOPRIO
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400380static int str_prioclass_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100381{
382 struct thread_data *td = data;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200383 unsigned short mask;
384
385 /*
386 * mask off old class bits, str_prio_cb() may have set a default class
387 */
388 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
389 td->ioprio &= mask;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100390
391 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
Jens Axboeac684782007-11-08 08:29:07 +0100392 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100393 return 0;
394}
395
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400396static int str_prio_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100397{
398 struct thread_data *td = data;
399
400 td->ioprio |= *val;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200401
402 /*
403 * If no class is set, assume BE
404 */
405 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
406 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
407
Jens Axboeac684782007-11-08 08:29:07 +0100408 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100409 return 0;
410}
411#endif
412
413static int str_exitall_cb(void)
414{
415 exitall_on_terminate = 1;
416 return 0;
417}
418
Jens Axboe214e1ec2007-03-15 10:48:13 +0100419#ifdef FIO_HAVE_CPU_AFFINITY
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400420static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100421{
422 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200423 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100424 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100425 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100426
Jens Axboed2ce18b2008-12-12 20:51:40 +0100427 ret = fio_cpuset_init(&td->o.cpumask);
428 if (ret < 0) {
429 log_err("fio: cpuset_init failed\n");
430 td_verror(td, ret, "fio_cpuset_init");
431 return 1;
432 }
433
Jens Axboec00a2282011-07-08 20:56:06 +0200434 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200435
Jens Axboe62a72732008-12-08 11:37:01 +0100436 for (i = 0; i < sizeof(int) * 8; i++) {
437 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100438 if (i > max_cpu) {
439 log_err("fio: CPU %d too large (max=%ld)\n", i,
440 max_cpu);
441 return 1;
442 }
Jens Axboe62a72732008-12-08 11:37:01 +0100443 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100444 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100445 }
446 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200447
Jens Axboe375b2692007-05-22 09:13:02 +0200448 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100449 return 0;
450}
451
Jens Axboee8462bd2009-07-06 12:59:04 +0200452static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
453 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200454{
Jens Axboed2e268b2007-06-15 10:33:49 +0200455 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100456 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100457 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200458
Jens Axboee8462bd2009-07-06 12:59:04 +0200459 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100460 if (ret < 0) {
461 log_err("fio: cpuset_init failed\n");
462 td_verror(td, ret, "fio_cpuset_init");
463 return 1;
464 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200465
466 p = str = strdup(input);
467
468 strip_blank_front(&str);
469 strip_blank_end(str);
470
Jens Axboec00a2282011-07-08 20:56:06 +0200471 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100472
Jens Axboed2e268b2007-06-15 10:33:49 +0200473 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100474 char *str2, *cpu2;
475 int icpu, icpu2;
476
Jens Axboed2e268b2007-06-15 10:33:49 +0200477 if (!strlen(cpu))
478 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100479
480 str2 = cpu;
481 icpu2 = -1;
482 while ((cpu2 = strsep(&str2, "-")) != NULL) {
483 if (!strlen(cpu2))
484 break;
485
486 icpu2 = atoi(cpu2);
487 }
488
489 icpu = atoi(cpu);
490 if (icpu2 == -1)
491 icpu2 = icpu;
492 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100493 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100494 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100495 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100496 ret = 1;
497 break;
498 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100499 if (icpu > max_cpu) {
500 log_err("fio: CPU %d too large (max=%ld)\n",
501 icpu, max_cpu);
502 ret = 1;
503 break;
504 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200505
Jens Axboe62a72732008-12-08 11:37:01 +0100506 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200507 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100508 icpu++;
509 }
Jens Axboe19608d62008-12-08 15:03:12 +0100510 if (ret)
511 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200512 }
513
514 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100515 if (!ret)
516 td->o.cpumask_set = 1;
517 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200518}
Jens Axboee8462bd2009-07-06 12:59:04 +0200519
520static int str_cpus_allowed_cb(void *data, const char *input)
521{
522 struct thread_data *td = data;
523 int ret;
524
525 ret = set_cpus_allowed(td, &td->o.cpumask, input);
526 if (!ret)
527 td->o.cpumask_set = 1;
528
529 return ret;
530}
531
532static int str_verify_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.verify_cpumask, input);
538 if (!ret)
539 td->o.verify_cpumask_set = 1;
540
541 return ret;
542}
Jens Axboed2e268b2007-06-15 10:33:49 +0200543#endif
544
Jens Axboe67bf9822013-01-10 11:23:19 +0100545#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400546static int str_numa_cpunodes_cb(void *data, char *input)
547{
548 struct thread_data *td = data;
549
550 /* numa_parse_nodestring() parses a character string list
551 * of nodes into a bit mask. The bit mask is allocated by
552 * numa_allocate_nodemask(), so it should be freed by
553 * numa_free_nodemask().
554 */
555 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
556 if (td->o.numa_cpunodesmask == NULL) {
557 log_err("fio: numa_parse_nodestring failed\n");
558 td_verror(td, 1, "str_numa_cpunodes_cb");
559 return 1;
560 }
561
562 td->o.numa_cpumask_set = 1;
563 return 0;
564}
565
566static int str_numa_mpol_cb(void *data, char *input)
567{
568 struct thread_data *td = data;
569 const char * const policy_types[] =
570 { "default", "prefer", "bind", "interleave", "local" };
571 int i;
572
573 char *nodelist = strchr(input, ':');
574 if (nodelist) {
575 /* NUL-terminate mode */
576 *nodelist++ = '\0';
577 }
578
579 for (i = 0; i <= MPOL_LOCAL; i++) {
580 if (!strcmp(input, policy_types[i])) {
581 td->o.numa_mem_mode = i;
582 break;
583 }
584 }
585 if (i > MPOL_LOCAL) {
586 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
587 goto out;
588 }
589
590 switch (td->o.numa_mem_mode) {
591 case MPOL_PREFERRED:
592 /*
593 * Insist on a nodelist of one node only
594 */
595 if (nodelist) {
596 char *rest = nodelist;
597 while (isdigit(*rest))
598 rest++;
599 if (*rest) {
600 log_err("fio: one node only for \'prefer\'\n");
601 goto out;
602 }
603 } else {
604 log_err("fio: one node is needed for \'prefer\'\n");
605 goto out;
606 }
607 break;
608 case MPOL_INTERLEAVE:
609 /*
610 * Default to online nodes with memory if no nodelist
611 */
612 if (!nodelist)
613 nodelist = strdup("all");
614 break;
615 case MPOL_LOCAL:
616 case MPOL_DEFAULT:
617 /*
618 * Don't allow a nodelist
619 */
620 if (nodelist) {
621 log_err("fio: NO nodelist for \'local\'\n");
622 goto out;
623 }
624 break;
625 case MPOL_BIND:
626 /*
627 * Insist on a nodelist
628 */
629 if (!nodelist) {
630 log_err("fio: a nodelist is needed for \'bind\'\n");
631 goto out;
632 }
633 break;
634 }
635
636
637 /* numa_parse_nodestring() parses a character string list
638 * of nodes into a bit mask. The bit mask is allocated by
639 * numa_allocate_nodemask(), so it should be freed by
640 * numa_free_nodemask().
641 */
642 switch (td->o.numa_mem_mode) {
643 case MPOL_PREFERRED:
644 td->o.numa_mem_prefer_node = atoi(nodelist);
645 break;
646 case MPOL_INTERLEAVE:
647 case MPOL_BIND:
648 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
649 if (td->o.numa_memnodesmask == NULL) {
650 log_err("fio: numa_parse_nodestring failed\n");
651 td_verror(td, 1, "str_numa_memnodes_cb");
652 return 1;
653 }
654 break;
655 case MPOL_LOCAL:
656 case MPOL_DEFAULT:
657 default:
658 break;
659 }
660
661 td->o.numa_memmask_set = 1;
662 return 0;
663
664out:
665 return 1;
666}
667#endif
668
Jens Axboe214e1ec2007-03-15 10:48:13 +0100669static int str_fst_cb(void *data, const char *str)
670{
671 struct thread_data *td = data;
672 char *nr = get_opt_postfix(str);
673
674 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100675 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100676 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100677 free(nr);
678 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100679
680 return 0;
681}
682
Jens Axboe67bf9822013-01-10 11:23:19 +0100683#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100684static int str_sfr_cb(void *data, const char *str)
685{
686 struct thread_data *td = data;
687 char *nr = get_opt_postfix(str);
688
689 td->sync_file_range_nr = 1;
690 if (nr) {
691 td->sync_file_range_nr = atoi(nr);
692 free(nr);
693 }
694
695 return 0;
696}
Jens Axboe3ae06372010-03-19 19:17:15 +0100697#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100698
Jens Axboee25839d2012-11-06 10:49:42 +0100699static int str_random_distribution_cb(void *data, const char *str)
700{
701 struct thread_data *td = data;
702 double val;
703 char *nr;
704
Jens Axboe925fee32012-11-06 13:50:32 +0100705 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
706 val = 1.1;
707 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
708 val = 0.2;
709 else
Jens Axboee25839d2012-11-06 10:49:42 +0100710 return 0;
711
712 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100713 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100714 log_err("fio: random postfix parsing failed\n");
715 free(nr);
716 return 1;
717 }
718
Jens Axboe078189c2012-11-07 13:47:22 +0100719 free(nr);
720
Jens Axboe18ded912012-11-08 08:36:00 +0100721 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
722 if (val == 1.00) {
723 log_err("fio: zipf theta must different than 1.0\n");
724 return 1;
725 }
Jens Axboe888677a2013-04-10 22:19:46 +0200726 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100727 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100728 if (val <= 0.00 || val >= 1.00) {
729 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
730 return 1;
731 }
Jens Axboe888677a2013-04-10 22:19:46 +0200732 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100733 }
Jens Axboe925fee32012-11-06 13:50:32 +0100734
Jens Axboee25839d2012-11-06 10:49:42 +0100735 return 0;
736}
737
Jens Axboe921c7662008-03-26 09:17:55 +0100738static int check_dir(struct thread_data *td, char *fname)
739{
Jens Axboe3f0ca9b2011-05-24 21:36:24 +0200740#if 0
Jens Axboe921c7662008-03-26 09:17:55 +0100741 char file[PATH_MAX], *dir;
Jens Axboebc838912008-04-07 09:00:54 +0200742 int elen = 0;
Jens Axboe921c7662008-03-26 09:17:55 +0100743
Jens Axboebc838912008-04-07 09:00:54 +0200744 if (td->o.directory) {
745 strcpy(file, td->o.directory);
Jens Axboefcef0b32008-05-26 14:53:24 +0200746 strcat(file, "/");
Jens Axboebc838912008-04-07 09:00:54 +0200747 elen = strlen(file);
748 }
749
Jens Axboefcef0b32008-05-26 14:53:24 +0200750 sprintf(file + elen, "%s", fname);
Jens Axboe921c7662008-03-26 09:17:55 +0100751 dir = dirname(file);
752
Jens Axboefcef0b32008-05-26 14:53:24 +0200753 {
754 struct stat sb;
755 /*
756 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
757 * yet, so we can't do this check right here...
758 */
Jens Axboe921c7662008-03-26 09:17:55 +0100759 if (lstat(dir, &sb) < 0) {
760 int ret = errno;
761
762 log_err("fio: %s is not a directory\n", dir);
763 td_verror(td, ret, "lstat");
764 return 1;
765 }
766
767 if (!S_ISDIR(sb.st_mode)) {
768 log_err("fio: %s is not a directory\n", dir);
769 return 1;
770 }
Jens Axboefcef0b32008-05-26 14:53:24 +0200771 }
772#endif
Jens Axboe921c7662008-03-26 09:17:55 +0100773
774 return 0;
775}
776
Jens Axboe8e827d32009-08-04 09:51:48 +0200777/*
778 * Return next file in the string. Files are separated with ':'. If the ':'
779 * is escaped with a '\', then that ':' is part of the filename and does not
780 * indicate a new file.
781 */
782static char *get_next_file_name(char **ptr)
783{
784 char *str = *ptr;
785 char *p, *start;
786
787 if (!str || !strlen(str))
788 return NULL;
789
790 start = str;
791 do {
792 /*
793 * No colon, we are done
794 */
795 p = strchr(str, ':');
796 if (!p) {
797 *ptr = NULL;
798 break;
799 }
800
801 /*
802 * We got a colon, but it's the first character. Skip and
803 * continue
804 */
805 if (p == start) {
806 str = ++start;
807 continue;
808 }
809
810 if (*(p - 1) != '\\') {
811 *p = '\0';
812 *ptr = p + 1;
813 break;
814 }
815
816 memmove(p - 1, p, strlen(p) + 1);
817 str = p;
818 } while (1);
819
820 return start;
821}
822
Jens Axboe214e1ec2007-03-15 10:48:13 +0100823static int str_filename_cb(void *data, const char *input)
824{
825 struct thread_data *td = data;
826 char *fname, *str, *p;
827
828 p = str = strdup(input);
829
830 strip_blank_front(&str);
831 strip_blank_end(str);
832
833 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100834 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100835
Jens Axboe8e827d32009-08-04 09:51:48 +0200836 while ((fname = get_next_file_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100837 if (!strlen(fname))
838 break;
Jens Axboe921c7662008-03-26 09:17:55 +0100839 if (check_dir(td, fname)) {
840 free(p);
841 return 1;
842 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100843 add_file(td, fname);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100844 td->o.nr_files++;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100845 }
846
847 free(p);
848 return 0;
849}
850
851static int str_directory_cb(void *data, const char fio_unused *str)
852{
853 struct thread_data *td = data;
854 struct stat sb;
855
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100856 if (lstat(td->o.directory, &sb) < 0) {
Jens Axboe921c7662008-03-26 09:17:55 +0100857 int ret = errno;
858
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100859 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe921c7662008-03-26 09:17:55 +0100860 td_verror(td, ret, "lstat");
Jens Axboe214e1ec2007-03-15 10:48:13 +0100861 return 1;
862 }
863 if (!S_ISDIR(sb.st_mode)) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100864 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100865 return 1;
866 }
867
868 return 0;
869}
870
871static int str_opendir_cb(void *data, const char fio_unused *str)
872{
873 struct thread_data *td = data;
874
875 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100876 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100877
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100878 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100879}
880
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100881static int str_verify_pattern_cb(void *data, const char *input)
Jens Axboe90059d62007-07-30 09:33:12 +0200882{
883 struct thread_data *td = data;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100884 long off;
885 int i = 0, j = 0, len, k, base = 10;
886 char* loc1, * loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200887
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100888 loc1 = strstr(input, "0x");
889 loc2 = strstr(input, "0X");
890 if (loc1 || loc2)
891 base = 16;
892 off = strtol(input, NULL, base);
893 if (off != LONG_MAX || errno != ERANGE) {
894 while (off) {
895 td->o.verify_pattern[i] = off & 0xff;
896 off >>= 8;
897 i++;
898 }
899 } else {
900 len = strlen(input);
901 k = len - 1;
902 if (base == 16) {
903 if (loc1)
904 j = loc1 - input + 2;
905 else
906 j = loc2 - input + 2;
907 } else
908 return 1;
909 if (len - j < MAX_PATTERN_SIZE * 2) {
910 while (k >= j) {
911 off = converthexchartoint(input[k--]);
912 if (k >= j)
913 off += (converthexchartoint(input[k--])
914 * 16);
915 td->o.verify_pattern[i++] = (char) off;
916 }
917 }
918 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100919
920 /*
921 * Fill the pattern all the way to the end. This greatly reduces
922 * the number of memcpy's we have to do when verifying the IO.
923 */
924 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
925 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
926 i *= 2;
927 }
Steven Lang9a2a86d2012-02-07 09:42:59 +0100928 if (i == 1) {
929 /*
930 * The code in verify_io_u_pattern assumes a single byte pattern
931 * fills the whole verify pattern buffer.
932 */
933 memset(td->o.verify_pattern, td->o.verify_pattern[0],
934 MAX_PATTERN_SIZE);
935 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100936
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100937 td->o.verify_pattern_bytes = i;
Steven Langefcd9dc2012-02-02 20:22:04 +0100938
Jens Axboe92bf48d2011-01-14 21:20:42 +0100939 /*
940 * VERIFY_META could already be set
941 */
942 if (td->o.verify == VERIFY_NONE)
943 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +0100944
Jens Axboe90059d62007-07-30 09:33:12 +0200945 return 0;
946}
Jens Axboe214e1ec2007-03-15 10:48:13 +0100947
Jens Axboee3cedca2008-11-19 19:57:52 +0100948static int str_write_bw_log_cb(void *data, const char *str)
949{
950 struct thread_data *td = data;
951
952 if (str)
953 td->o.bw_log_file = strdup(str);
954
955 td->o.write_bw_log = 1;
956 return 0;
957}
958
959static int str_write_lat_log_cb(void *data, const char *str)
960{
961 struct thread_data *td = data;
962
963 if (str)
964 td->o.lat_log_file = strdup(str);
965
966 td->o.write_lat_log = 1;
967 return 0;
968}
969
Jens Axboec8eeb9d2011-10-05 14:02:22 +0200970static int str_write_iops_log_cb(void *data, const char *str)
971{
972 struct thread_data *td = data;
973
974 if (str)
975 td->o.iops_log_file = strdup(str);
976
977 td->o.write_iops_log = 1;
978 return 0;
979}
980
Jens Axboe993bf482008-11-14 13:04:53 +0100981static int str_gtod_reduce_cb(void *data, int *il)
982{
983 struct thread_data *td = data;
984 int val = *il;
985
Jens Axboe02af0982010-06-24 09:59:34 +0200986 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +0100987 td->o.disable_clat = !!val;
988 td->o.disable_slat = !!val;
989 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +0200990 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +0100991 if (val)
992 td->tv_cache_mask = 63;
993
994 return 0;
995}
996
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400997static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +0100998{
999 struct thread_data *td = data;
1000 int val = *il;
1001
1002 td->o.gtod_cpu = val;
1003 td->o.gtod_offload = 1;
1004 return 0;
1005}
1006
Jens Axboe7bb59102011-07-12 19:47:03 +02001007static int str_size_cb(void *data, unsigned long long *__val)
1008{
1009 struct thread_data *td = data;
1010 unsigned long long v = *__val;
1011
1012 if (parse_is_percent(v)) {
1013 td->o.size = 0;
1014 td->o.size_percent = -1ULL - v;
1015 } else
1016 td->o.size = v;
1017
1018 return 0;
1019}
1020
Jens Axboe896cac22009-07-01 10:38:35 +02001021static int rw_verify(struct fio_option *o, void *data)
1022{
1023 struct thread_data *td = data;
1024
1025 if (read_only && td_write(td)) {
1026 log_err("fio: job <%s> has write bit set, but fio is in"
1027 " read-only mode\n", td->o.name);
1028 return 1;
1029 }
1030
1031 return 0;
1032}
1033
Jens Axboe276ca4f2009-07-01 10:43:05 +02001034static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001035{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001036#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001037 struct thread_data *td = data;
1038
Jens Axboe29d43ff2009-07-01 10:42:18 +02001039 if (td->o.gtod_cpu) {
1040 log_err("fio: platform must support CPU affinity for"
1041 "gettimeofday() offloading\n");
1042 return 1;
1043 }
1044#endif
1045
1046 return 0;
1047}
1048
Jens Axboe214e1ec2007-03-15 10:48:13 +01001049/*
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001050 * Option grouping
1051 */
1052static struct opt_group fio_opt_groups[] = {
1053 {
1054 .name = "General",
1055 .mask = FIO_OPT_C_GENERAL,
1056 },
1057 {
1058 .name = "I/O",
1059 .mask = FIO_OPT_C_IO,
1060 },
1061 {
1062 .name = "File",
1063 .mask = FIO_OPT_C_FILE,
1064 },
1065 {
1066 .name = "Statistics",
1067 .mask = FIO_OPT_C_STAT,
1068 },
1069 {
1070 .name = "Logging",
1071 .mask = FIO_OPT_C_LOG,
1072 },
1073 {
1074 .name = "Profiles",
1075 .mask = FIO_OPT_C_PROFILE,
1076 },
1077 {
1078 .name = NULL,
1079 },
1080};
1081
1082static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1083 unsigned int inv_mask)
1084{
1085 struct opt_group *og;
1086 int i;
1087
1088 if (*mask == inv_mask || !*mask)
1089 return NULL;
1090
1091 for (i = 0; ogs[i].name; i++) {
1092 og = &ogs[i];
1093
1094 if (*mask & og->mask) {
1095 *mask &= ~(og->mask);
1096 return og;
1097 }
1098 }
1099
1100 return NULL;
1101}
1102
1103struct opt_group *opt_group_from_mask(unsigned int *mask)
1104{
1105 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1106}
1107
1108static struct opt_group fio_opt_cat_groups[] = {
1109 {
1110 .name = "Rate",
1111 .mask = FIO_OPT_G_RATE,
1112 },
1113 {
1114 .name = "Zone",
1115 .mask = FIO_OPT_G_ZONE,
1116 },
1117 {
1118 .name = "Read/write mix",
1119 .mask = FIO_OPT_G_RWMIX,
1120 },
1121 {
1122 .name = "Verify",
1123 .mask = FIO_OPT_G_VERIFY,
1124 },
1125 {
1126 .name = "Trim",
1127 .mask = FIO_OPT_G_TRIM,
1128 },
1129 {
1130 .name = "I/O Logging",
1131 .mask = FIO_OPT_G_IOLOG,
1132 },
1133 {
1134 .name = "I/O Depth",
1135 .mask = FIO_OPT_G_IO_DEPTH,
1136 },
1137 {
1138 .name = "I/O Flow",
1139 .mask = FIO_OPT_G_IO_FLOW,
1140 },
1141 {
1142 .name = "Description",
1143 .mask = FIO_OPT_G_DESC,
1144 },
1145 {
1146 .name = "Filename",
1147 .mask = FIO_OPT_G_FILENAME,
1148 },
1149 {
1150 .name = "General I/O",
1151 .mask = FIO_OPT_G_IO_BASIC,
1152 },
1153 {
1154 .name = "Cgroups",
1155 .mask = FIO_OPT_G_CGROUP,
1156 },
1157 {
1158 .name = "Runtime",
1159 .mask = FIO_OPT_G_RUNTIME,
1160 },
1161 {
1162 .name = "Process",
1163 .mask = FIO_OPT_G_PROCESS,
1164 },
1165 {
1166 .name = "Job credentials / priority",
1167 .mask = FIO_OPT_G_CRED,
1168 },
1169 {
1170 .name = "Clock settings",
1171 .mask = FIO_OPT_G_CLOCK,
1172 },
1173 {
1174 .name = "I/O Type",
1175 .mask = FIO_OPT_G_IO_TYPE,
1176 },
1177 {
1178 .name = "I/O Thinktime",
1179 .mask = FIO_OPT_G_THINKTIME,
1180 },
1181 {
1182 .name = "Randomizations",
1183 .mask = FIO_OPT_G_RANDOM,
1184 },
1185 {
1186 .name = "I/O buffers",
1187 .mask = FIO_OPT_G_IO_BUF,
1188 },
1189 {
1190 .name = "Tiobench profile",
1191 .mask = FIO_OPT_G_TIOBENCH,
1192 },
1193
1194 {
1195 .name = NULL,
1196 }
1197};
1198
1199struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1200{
1201 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1202}
1203
1204/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001205 * Map of job/command line options
1206 */
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001207static struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001208 {
1209 .name = "description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001210 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001211 .type = FIO_OPT_STR_STORE,
1212 .off1 = td_var_offset(description),
1213 .help = "Text job description",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001214 .category = FIO_OPT_C_GENERAL,
1215 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001216 },
1217 {
1218 .name = "name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001219 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001220 .type = FIO_OPT_STR_STORE,
1221 .off1 = td_var_offset(name),
1222 .help = "Name of this job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001223 .category = FIO_OPT_C_GENERAL,
1224 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001225 },
1226 {
1227 .name = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001228 .lname = "Filename(s)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001229 .type = FIO_OPT_STR_STORE,
1230 .off1 = td_var_offset(filename),
1231 .cb = str_filename_cb,
Jens Axboef0d524b2009-04-27 08:00:48 +02001232 .prio = -1, /* must come after "directory" */
Jens Axboe214e1ec2007-03-15 10:48:13 +01001233 .help = "File(s) to use for the workload",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001234 .category = FIO_OPT_C_FILE,
1235 .group = FIO_OPT_G_FILENAME,
1236 },
1237 {
1238 .name = "directory",
1239 .lname = "Directory",
1240 .type = FIO_OPT_STR_STORE,
1241 .off1 = td_var_offset(directory),
1242 .cb = str_directory_cb,
1243 .help = "Directory to store files in",
1244 .category = FIO_OPT_C_FILE,
1245 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001246 },
1247 {
Jens Axboede98bd32013-04-05 11:09:20 +02001248 .name = "filename_format",
1249 .type = FIO_OPT_STR_STORE,
1250 .off1 = td_var_offset(filename_format),
1251 .prio = -1, /* must come after "directory" */
1252 .help = "Override default $jobname.$jobnum.$filenum naming",
1253 .def = "$jobname.$jobnum.$filenum",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001254 .category = FIO_OPT_C_FILE,
1255 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001256 },
1257 {
Jens Axboe29c13492008-03-01 19:25:20 +01001258 .name = "lockfile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001259 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001260 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001261 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001262 .help = "Lock file when doing IO to it",
1263 .parent = "filename",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001264 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001265 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001266 .category = FIO_OPT_C_FILE,
1267 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001268 .posval = {
1269 { .ival = "none",
1270 .oval = FILE_LOCK_NONE,
1271 .help = "No file locking",
1272 },
1273 { .ival = "exclusive",
1274 .oval = FILE_LOCK_EXCLUSIVE,
1275 .help = "Exclusive file lock",
1276 },
1277 {
1278 .ival = "readwrite",
1279 .oval = FILE_LOCK_READWRITE,
1280 .help = "Read vs write lock",
1281 },
1282 },
Jens Axboe29c13492008-03-01 19:25:20 +01001283 },
1284 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001285 .name = "opendir",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001286 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001287 .type = FIO_OPT_STR_STORE,
1288 .off1 = td_var_offset(opendir),
1289 .cb = str_opendir_cb,
1290 .help = "Recursively add files from this directory and down",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001291 .category = FIO_OPT_C_FILE,
1292 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001293 },
1294 {
1295 .name = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001296 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001297 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001298 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001299 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001300 .off1 = td_var_offset(td_ddir),
1301 .help = "IO direction",
1302 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001303 .verify = rw_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001304 .category = FIO_OPT_C_IO,
1305 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001306 .posval = {
1307 { .ival = "read",
1308 .oval = TD_DDIR_READ,
1309 .help = "Sequential read",
1310 },
1311 { .ival = "write",
1312 .oval = TD_DDIR_WRITE,
1313 .help = "Sequential write",
1314 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001315 { .ival = "trim",
1316 .oval = TD_DDIR_TRIM,
1317 .help = "Sequential trim",
1318 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001319 { .ival = "randread",
1320 .oval = TD_DDIR_RANDREAD,
1321 .help = "Random read",
1322 },
1323 { .ival = "randwrite",
1324 .oval = TD_DDIR_RANDWRITE,
1325 .help = "Random write",
1326 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001327 { .ival = "randtrim",
1328 .oval = TD_DDIR_RANDTRIM,
1329 .help = "Random trim",
1330 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001331 { .ival = "rw",
1332 .oval = TD_DDIR_RW,
1333 .help = "Sequential read and write mix",
1334 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001335 { .ival = "readwrite",
1336 .oval = TD_DDIR_RW,
1337 .help = "Sequential read and write mix",
1338 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001339 { .ival = "randrw",
1340 .oval = TD_DDIR_RANDRW,
1341 .help = "Random read and write mix"
1342 },
1343 },
1344 },
1345 {
Jens Axboe38dad622010-07-20 14:46:00 -06001346 .name = "rw_sequencer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001347 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001348 .type = FIO_OPT_STR,
1349 .off1 = td_var_offset(rw_seq),
1350 .help = "IO offset generator modifier",
1351 .def = "sequential",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001352 .category = FIO_OPT_C_IO,
1353 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001354 .posval = {
1355 { .ival = "sequential",
1356 .oval = RW_SEQ_SEQ,
1357 .help = "Generate sequential offsets",
1358 },
1359 { .ival = "identical",
1360 .oval = RW_SEQ_IDENT,
1361 .help = "Generate identical offsets",
1362 },
1363 },
1364 },
1365
1366 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001367 .name = "ioengine",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001368 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001369 .type = FIO_OPT_STR_STORE,
1370 .off1 = td_var_offset(ioengine),
1371 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001372 .def = FIO_PREFERRED_ENGINE,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001373 .category = FIO_OPT_C_IO,
1374 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001375 .posval = {
1376 { .ival = "sync",
1377 .help = "Use read/write",
1378 },
gurudas paia31041e2007-10-23 15:12:30 +02001379 { .ival = "psync",
1380 .help = "Use pread/pwrite",
1381 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001382 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001383 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001384 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001385#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001386 { .ival = "libaio",
1387 .help = "Linux native asynchronous IO",
1388 },
1389#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001390#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001391 { .ival = "posixaio",
1392 .help = "POSIX asynchronous IO",
1393 },
1394#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001395#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001396 { .ival = "solarisaio",
1397 .help = "Solaris native asynchronous IO",
1398 },
1399#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001400#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001401 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001402 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001403 },
Jens Axboe3be80072011-01-19 11:07:28 -07001404#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001405 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001406 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001407 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001408#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001409 { .ival = "splice",
1410 .help = "splice/vmsplice based IO",
1411 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001412 { .ival = "netsplice",
1413 .help = "splice/vmsplice to/from the network",
1414 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001415#endif
1416#ifdef FIO_HAVE_SGIO
1417 { .ival = "sg",
1418 .help = "SCSI generic v3 IO",
1419 },
1420#endif
1421 { .ival = "null",
1422 .help = "Testing engine (no data transfer)",
1423 },
1424 { .ival = "net",
1425 .help = "Network IO",
1426 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001427 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001428 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001429 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001430#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001431 { .ival = "guasi",
1432 .help = "GUASI IO engine",
1433 },
1434#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001435#ifdef FIO_HAVE_BINJECT
1436 { .ival = "binject",
1437 .help = "binject direct inject block engine",
1438 },
1439#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001440#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001441 { .ival = "rdma",
1442 .help = "RDMA IO engine",
1443 },
1444#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001445#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001446 { .ival = "fusion-aw-sync",
1447 .help = "Fusion-io atomic write engine",
1448 },
1449#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001450#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001451 { .ival = "e4defrag",
1452 .help = "ext4 defrag engine",
1453 },
1454#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001455#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001456 { .ival = "falloc",
1457 .help = "fallocate() file based engine",
1458 },
1459#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001460 { .ival = "external",
1461 .help = "Load external engine (append name)",
1462 },
1463 },
1464 },
1465 {
1466 .name = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001467 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001468 .type = FIO_OPT_INT,
1469 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001470 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001471 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001472 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001473 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001474 .category = FIO_OPT_C_IO,
1475 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001476 },
1477 {
1478 .name = "iodepth_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001479 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001480 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001481 .type = FIO_OPT_INT,
1482 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001483 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001484 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001485 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001486 .minval = 1,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001487 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001488 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001489 .category = FIO_OPT_C_IO,
1490 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001491 },
1492 {
Jens Axboe49504212008-06-05 09:03:30 +02001493 .name = "iodepth_batch_complete",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001494 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001495 .type = FIO_OPT_INT,
1496 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001497 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001498 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001499 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001500 .minval = 0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001501 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001502 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001503 .category = FIO_OPT_C_IO,
1504 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001505 },
1506 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001507 .name = "iodepth_low",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001508 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001509 .type = FIO_OPT_INT,
1510 .off1 = td_var_offset(iodepth_low),
1511 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001512 .parent = "iodepth",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001513 .hide = 1,
1514 .interval = 1,
1515 .category = FIO_OPT_C_IO,
1516 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001517 },
1518 {
1519 .name = "size",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001520 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001521 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001522 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001523 .help = "Total size of device or files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001524 .interval = 1024 * 1024,
1525 .category = FIO_OPT_C_IO,
1526 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001527 },
1528 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001529 .name = "fill_device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001530 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001531 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001532 .type = FIO_OPT_BOOL,
1533 .off1 = td_var_offset(fill_device),
1534 .help = "Write until an ENOSPC error occurs",
1535 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001536 .category = FIO_OPT_C_FILE,
1537 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001538 },
1539 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001540 .name = "filesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001541 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001542 .type = FIO_OPT_STR_VAL,
1543 .off1 = td_var_offset(file_size_low),
1544 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001545 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001546 .help = "Size of individual files",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001547 .interval = 1024 * 1024,
1548 .category = FIO_OPT_C_FILE,
1549 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001550 },
1551 {
Jens Axboe67a10002007-07-31 23:12:16 +02001552 .name = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001553 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001554 .alias = "fileoffset",
1555 .type = FIO_OPT_STR_VAL,
1556 .off1 = td_var_offset(start_offset),
1557 .help = "Start IO from this offset",
1558 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001559 .interval = 1024 * 1024,
1560 .category = FIO_OPT_C_IO,
1561 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001562 },
1563 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001564 .name = "offset_increment",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001565 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001566 .type = FIO_OPT_STR_VAL,
1567 .off1 = td_var_offset(offset_increment),
1568 .help = "What is the increment from one offset to the next",
1569 .parent = "offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001570 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001571 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001572 .interval = 1024 * 1024,
1573 .category = FIO_OPT_C_IO,
1574 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001575 },
1576 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001577 .name = "bs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001578 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001579 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001580 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001581 .off1 = td_var_offset(bs[DDIR_READ]),
1582 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001583 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001584 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001585 .help = "Block size unit",
1586 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001587 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001588 .hide = 1,
1589 .interval = 512,
1590 .category = FIO_OPT_C_IO,
1591 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001592 },
1593 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001594 .name = "ba",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001595 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001596 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001597 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001598 .off1 = td_var_offset(ba[DDIR_READ]),
1599 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001600 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001601 .minval = 1,
1602 .help = "IO block offset alignment",
1603 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001604 .hide = 1,
1605 .interval = 512,
1606 .category = FIO_OPT_C_IO,
1607 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001608 },
1609 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001610 .name = "bsrange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001611 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001612 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001613 .type = FIO_OPT_RANGE,
1614 .off1 = td_var_offset(min_bs[DDIR_READ]),
1615 .off2 = td_var_offset(max_bs[DDIR_READ]),
1616 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1617 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001618 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1619 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001620 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001621 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001622 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001623 .hide = 1,
1624 .interval = 4096,
1625 .category = FIO_OPT_C_IO,
1626 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001627 },
1628 {
Jens Axboe564ca972007-12-14 12:21:19 +01001629 .name = "bssplit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001630 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001631 .type = FIO_OPT_STR,
1632 .cb = str_bssplit_cb,
1633 .help = "Set a specific mix of block sizes",
1634 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001635 .hide = 1,
1636 .category = FIO_OPT_C_IO,
1637 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001638 },
1639 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001640 .name = "bs_unaligned",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001641 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001642 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001643 .type = FIO_OPT_STR_SET,
1644 .off1 = td_var_offset(bs_unaligned),
1645 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001646 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001647 .hide = 1,
1648 .category = FIO_OPT_C_IO,
1649 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001650 },
1651 {
1652 .name = "randrepeat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001653 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001654 .type = FIO_OPT_BOOL,
1655 .off1 = td_var_offset(rand_repeatable),
1656 .help = "Use repeatable random IO pattern",
1657 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001658 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001659 .hide = 1,
1660 .category = FIO_OPT_C_IO,
1661 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001662 },
1663 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001664 .name = "use_os_rand",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001665 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001666 .type = FIO_OPT_BOOL,
1667 .off1 = td_var_offset(use_os_rand),
1668 .help = "Set to use OS random generator",
1669 .def = "0",
1670 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001671 .hide = 1,
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001674 },
1675 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001676 .name = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001677 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001678 .type = FIO_OPT_STR_SET,
1679 .off1 = td_var_offset(norandommap),
1680 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001681 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001682 .hide = 1,
1683 .hide_on_set = 1,
1684 .category = FIO_OPT_C_IO,
1685 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001686 },
1687 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001688 .name = "softrandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001689 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001690 .type = FIO_OPT_BOOL,
1691 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001692 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001693 .parent = "norandommap",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001694 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001695 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001696 .category = FIO_OPT_C_IO,
1697 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001698 },
1699 {
Jens Axboe8055e412012-11-26 08:43:47 +01001700 .name = "random_generator",
1701 .type = FIO_OPT_STR,
1702 .off1 = td_var_offset(random_generator),
1703 .help = "Type of random number generator to use",
1704 .def = "tausworthe",
1705 .posval = {
1706 { .ival = "tausworthe",
1707 .oval = FIO_RAND_GEN_TAUSWORTHE,
1708 .help = "Strong Tausworthe generator",
1709 },
1710 { .ival = "lfsr",
1711 .oval = FIO_RAND_GEN_LFSR,
1712 .help = "Variable length LFSR",
1713 },
1714 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001715 .category = FIO_OPT_C_IO,
1716 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001717 },
1718 {
Jens Axboee25839d2012-11-06 10:49:42 +01001719 .name = "random_distribution",
1720 .type = FIO_OPT_STR,
1721 .off1 = td_var_offset(random_distribution),
1722 .cb = str_random_distribution_cb,
1723 .help = "Random offset distribution generator",
1724 .def = "random",
1725 .posval = {
1726 { .ival = "random",
1727 .oval = FIO_RAND_DIST_RANDOM,
1728 .help = "Completely random",
1729 },
1730 { .ival = "zipf",
1731 .oval = FIO_RAND_DIST_ZIPF,
1732 .help = "Zipf distribution",
1733 },
Jens Axboe925fee32012-11-06 13:50:32 +01001734 { .ival = "pareto",
1735 .oval = FIO_RAND_DIST_PARETO,
1736 .help = "Pareto distribution",
1737 },
Jens Axboee25839d2012-11-06 10:49:42 +01001738 },
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001741 },
1742 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001743 .name = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001744 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001745 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001746 .type = FIO_OPT_INT,
1747 .off1 = td_var_offset(nr_files),
1748 .help = "Split job workload between this number of files",
1749 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001750 .interval = 1,
1751 .category = FIO_OPT_C_FILE,
1752 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001753 },
1754 {
1755 .name = "openfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001756 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001757 .type = FIO_OPT_INT,
1758 .off1 = td_var_offset(open_files),
1759 .help = "Number of files to keep open at the same time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001760 .category = FIO_OPT_C_FILE,
1761 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001762 },
1763 {
1764 .name = "file_service_type",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001765 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001766 .type = FIO_OPT_STR,
1767 .cb = str_fst_cb,
1768 .off1 = td_var_offset(file_service_type),
1769 .help = "How to select which file to service next",
1770 .def = "roundrobin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001771 .category = FIO_OPT_C_FILE,
1772 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001773 .posval = {
1774 { .ival = "random",
1775 .oval = FIO_FSERVICE_RANDOM,
1776 .help = "Choose a file at random",
1777 },
1778 { .ival = "roundrobin",
1779 .oval = FIO_FSERVICE_RR,
1780 .help = "Round robin select files",
1781 },
Jens Axboea086c252009-03-04 08:27:37 +01001782 { .ival = "sequential",
1783 .oval = FIO_FSERVICE_SEQ,
1784 .help = "Finish one file before moving to the next",
1785 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001786 },
Jens Axboe67a10002007-07-31 23:12:16 +02001787 .parent = "nrfiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001788 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001789 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001790#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001791 {
1792 .name = "fallocate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001793 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001794 .type = FIO_OPT_STR,
1795 .off1 = td_var_offset(fallocate_mode),
1796 .help = "Whether pre-allocation is performed when laying out files",
1797 .def = "posix",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001798 .category = FIO_OPT_C_FILE,
1799 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001800 .posval = {
1801 { .ival = "none",
1802 .oval = FIO_FALLOCATE_NONE,
1803 .help = "Do not pre-allocate space",
1804 },
1805 { .ival = "posix",
1806 .oval = FIO_FALLOCATE_POSIX,
1807 .help = "Use posix_fallocate()",
1808 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001809#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001810 { .ival = "keep",
1811 .oval = FIO_FALLOCATE_KEEP_SIZE,
1812 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1813 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001814#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001815 /* Compatibility with former boolean values */
1816 { .ival = "0",
1817 .oval = FIO_FALLOCATE_NONE,
1818 .help = "Alias for 'none'",
1819 },
1820 { .ival = "1",
1821 .oval = FIO_FALLOCATE_POSIX,
1822 .help = "Alias for 'posix'",
1823 },
1824 },
1825 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001826#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001827 {
1828 .name = "fadvise_hint",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001829 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001830 .type = FIO_OPT_BOOL,
1831 .off1 = td_var_offset(fadvise_hint),
1832 .help = "Use fadvise() to advise the kernel on IO pattern",
1833 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001834 .category = FIO_OPT_C_FILE,
1835 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001836 },
1837 {
1838 .name = "fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001839 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001840 .type = FIO_OPT_INT,
1841 .off1 = td_var_offset(fsync_blocks),
1842 .help = "Issue fsync for writes every given number of blocks",
1843 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001844 .interval = 1,
1845 .category = FIO_OPT_C_FILE,
1846 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001847 },
1848 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001849 .name = "fdatasync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001850 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001851 .type = FIO_OPT_INT,
1852 .off1 = td_var_offset(fdatasync_blocks),
1853 .help = "Issue fdatasync for writes every given number of blocks",
1854 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001855 .interval = 1,
1856 .category = FIO_OPT_C_FILE,
1857 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001858 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001859 {
1860 .name = "write_barrier",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001861 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001862 .type = FIO_OPT_INT,
1863 .off1 = td_var_offset(barrier_blocks),
1864 .help = "Make every Nth write a barrier write",
1865 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001866 .interval = 1,
1867 .category = FIO_OPT_C_IO,
1868 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001869 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001870#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01001871 {
1872 .name = "sync_file_range",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001873 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01001874 .posval = {
1875 { .ival = "wait_before",
1876 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1877 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001878 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001879 },
1880 { .ival = "write",
1881 .oval = SYNC_FILE_RANGE_WRITE,
1882 .help = "SYNC_FILE_RANGE_WRITE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001883 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001884 },
1885 {
1886 .ival = "wait_after",
1887 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1888 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Jens Axboe3843deb2010-03-09 20:41:15 +01001889 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001890 },
1891 },
Jens Axboe3843deb2010-03-09 20:41:15 +01001892 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01001893 .cb = str_sfr_cb,
1894 .off1 = td_var_offset(sync_file_range),
1895 .help = "Use sync_file_range()",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001896 .category = FIO_OPT_C_FILE,
1897 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01001898 },
1899#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02001900 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001901 .name = "direct",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001902 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001903 .type = FIO_OPT_BOOL,
1904 .off1 = td_var_offset(odirect),
1905 .help = "Use O_DIRECT IO (negates buffered)",
1906 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001907 .inverse = "buffered",
1908 .category = FIO_OPT_C_IO,
1909 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001910 },
1911 {
1912 .name = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001913 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001914 .type = FIO_OPT_BOOL,
1915 .off1 = td_var_offset(odirect),
1916 .neg = 1,
1917 .help = "Use buffered IO (negates direct)",
1918 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001919 .inverse = "direct",
1920 .category = FIO_OPT_C_IO,
1921 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001922 },
1923 {
1924 .name = "overwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001925 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001926 .type = FIO_OPT_BOOL,
1927 .off1 = td_var_offset(overwrite),
1928 .help = "When writing, set whether to overwrite current data",
1929 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001930 .category = FIO_OPT_C_FILE,
1931 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001932 },
1933 {
1934 .name = "loops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001935 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001936 .type = FIO_OPT_INT,
1937 .off1 = td_var_offset(loops),
1938 .help = "Number of times to run the job",
1939 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001940 .interval = 1,
1941 .category = FIO_OPT_C_GENERAL,
1942 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001943 },
1944 {
1945 .name = "numjobs",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001946 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001947 .type = FIO_OPT_INT,
1948 .off1 = td_var_offset(numjobs),
1949 .help = "Duplicate this job this many times",
1950 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001951 .interval = 1,
1952 .category = FIO_OPT_C_GENERAL,
1953 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001954 },
1955 {
1956 .name = "startdelay",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001957 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02001958 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001959 .off1 = td_var_offset(start_delay),
1960 .help = "Only start job when this period has passed",
1961 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001962 .category = FIO_OPT_C_GENERAL,
1963 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001964 },
1965 {
1966 .name = "runtime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001967 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001968 .alias = "timeout",
1969 .type = FIO_OPT_STR_VAL_TIME,
1970 .off1 = td_var_offset(timeout),
1971 .help = "Stop workload when this amount of time has passed",
1972 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001973 .category = FIO_OPT_C_GENERAL,
1974 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001975 },
1976 {
Jens Axboecf4464c2007-04-17 20:14:42 +02001977 .name = "time_based",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001978 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02001979 .type = FIO_OPT_STR_SET,
1980 .off1 = td_var_offset(time_based),
1981 .help = "Keep running until runtime/timeout is met",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001982 .category = FIO_OPT_C_GENERAL,
1983 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02001984 },
1985 {
Jens Axboe721938a2008-09-10 09:46:16 +02001986 .name = "ramp_time",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001987 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02001988 .type = FIO_OPT_STR_VAL_TIME,
1989 .off1 = td_var_offset(ramp_time),
1990 .help = "Ramp up time before measuring performance",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001991 .category = FIO_OPT_C_GENERAL,
1992 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02001993 },
1994 {
Jens Axboec223da82010-03-24 13:23:53 +01001995 .name = "clocksource",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02001996 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01001997 .type = FIO_OPT_STR,
1998 .cb = fio_clock_source_cb,
1999 .off1 = td_var_offset(clocksource),
2000 .help = "What type of timing source to use",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002001 .category = FIO_OPT_C_GENERAL,
2002 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002003 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002004#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002005 { .ival = "gettimeofday",
2006 .oval = CS_GTOD,
2007 .help = "Use gettimeofday(2) for timing",
2008 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002009#endif
2010#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002011 { .ival = "clock_gettime",
2012 .oval = CS_CGETTIME,
2013 .help = "Use clock_gettime(2) for timing",
2014 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002015#endif
Jens Axboec223da82010-03-24 13:23:53 +01002016#ifdef ARCH_HAVE_CPU_CLOCK
2017 { .ival = "cpu",
2018 .oval = CS_CPUCLOCK,
2019 .help = "Use CPU private clock",
2020 },
2021#endif
2022 },
2023 },
2024 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002025 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002026 .alias = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002027 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002028 .type = FIO_OPT_STR,
2029 .cb = str_mem_cb,
2030 .off1 = td_var_offset(mem_type),
2031 .help = "Backing type for IO buffers",
2032 .def = "malloc",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002033 .category = FIO_OPT_C_IO,
2034 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002035 .posval = {
2036 { .ival = "malloc",
2037 .oval = MEM_MALLOC,
2038 .help = "Use malloc(3) for IO buffers",
2039 },
Jens Axboeb370e462007-03-19 10:51:49 +01002040 { .ival = "shm",
2041 .oval = MEM_SHM,
2042 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002043 },
2044#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002045 { .ival = "shmhuge",
2046 .oval = MEM_SHMHUGE,
2047 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002048 },
2049#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002050 { .ival = "mmap",
2051 .oval = MEM_MMAP,
2052 .help = "Use mmap(2) (file or anon) for IO buffers",
2053 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002054#ifdef FIO_HAVE_HUGETLB
2055 { .ival = "mmaphuge",
2056 .oval = MEM_MMAPHUGE,
2057 .help = "Like mmap, but use huge pages",
2058 },
2059#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002060 },
2061 },
2062 {
Jens Axboed529ee12009-07-01 10:33:03 +02002063 .name = "iomem_align",
2064 .alias = "mem_align",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002065 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002066 .type = FIO_OPT_INT,
2067 .off1 = td_var_offset(mem_align),
2068 .minval = 0,
2069 .help = "IO memory buffer offset alignment",
2070 .def = "0",
2071 .parent = "iomem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002072 .hide = 1,
2073 .category = FIO_OPT_C_IO,
2074 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002075 },
2076 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002077 .name = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002078 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002079 .type = FIO_OPT_STR,
2080 .off1 = td_var_offset(verify),
2081 .help = "Verify data written",
2082 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002083 .category = FIO_OPT_C_IO,
2084 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002085 .posval = {
2086 { .ival = "0",
2087 .oval = VERIFY_NONE,
2088 .help = "Don't do IO verification",
2089 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002090 { .ival = "md5",
2091 .oval = VERIFY_MD5,
2092 .help = "Use md5 checksums for verification",
2093 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002094 { .ival = "crc64",
2095 .oval = VERIFY_CRC64,
2096 .help = "Use crc64 checksums for verification",
2097 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002098 { .ival = "crc32",
2099 .oval = VERIFY_CRC32,
2100 .help = "Use crc32 checksums for verification",
2101 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002102 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002103 .oval = VERIFY_CRC32C,
2104 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002105 },
Jens Axboebac39e02008-06-11 20:46:19 +02002106 { .ival = "crc32c",
2107 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002108 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002109 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002110 { .ival = "crc16",
2111 .oval = VERIFY_CRC16,
2112 .help = "Use crc16 checksums for verification",
2113 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002114 { .ival = "crc7",
2115 .oval = VERIFY_CRC7,
2116 .help = "Use crc7 checksums for verification",
2117 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002118 { .ival = "sha1",
2119 .oval = VERIFY_SHA1,
2120 .help = "Use sha1 checksums for verification",
2121 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002122 { .ival = "sha256",
2123 .oval = VERIFY_SHA256,
2124 .help = "Use sha256 checksums for verification",
2125 },
2126 { .ival = "sha512",
2127 .oval = VERIFY_SHA512,
2128 .help = "Use sha512 checksums for verification",
2129 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002130 { .ival = "meta",
2131 .oval = VERIFY_META,
2132 .help = "Use io information",
2133 },
Jens Axboe36690c92007-03-26 10:23:34 +02002134 {
2135 .ival = "null",
2136 .oval = VERIFY_NULL,
2137 .help = "Pretend to verify",
2138 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002139 },
2140 },
2141 {
Jens Axboe005c5652007-08-02 22:21:36 +02002142 .name = "do_verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002143 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002144 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002145 .off1 = td_var_offset(do_verify),
2146 .help = "Run verification stage after write",
2147 .def = "1",
2148 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002149 .hide = 1,
2150 .category = FIO_OPT_C_IO,
2151 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002152 },
2153 {
Jens Axboe160b9662007-03-27 10:59:49 +02002154 .name = "verifysort",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002155 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002156 .type = FIO_OPT_BOOL,
2157 .off1 = td_var_offset(verifysort),
2158 .help = "Sort written verify blocks for read back",
2159 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002160 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002161 .hide = 1,
2162 .category = FIO_OPT_C_IO,
2163 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002164 },
2165 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002166 .name = "verifysort_nr",
2167 .type = FIO_OPT_INT,
2168 .off1 = td_var_offset(verifysort_nr),
2169 .help = "Pre-load and sort verify blocks for a read workload",
2170 .minval = 0,
2171 .maxval = 131072,
2172 .def = "1024",
2173 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002174 .category = FIO_OPT_C_IO,
2175 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002176 },
2177 {
Jens Axboea59e1702007-07-30 08:53:27 +02002178 .name = "verify_interval",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002179 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002180 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002181 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002182 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002183 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002184 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002185 .hide = 1,
2186 .interval = 2 * sizeof(struct verify_header),
2187 .category = FIO_OPT_C_IO,
2188 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002189 },
2190 {
Jens Axboea59e1702007-07-30 08:53:27 +02002191 .name = "verify_offset",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002192 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002193 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002194 .help = "Offset verify header location by N bytes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002195 .off1 = td_var_offset(verify_offset),
2196 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002197 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002198 .hide = 1,
2199 .category = FIO_OPT_C_IO,
2200 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002201 },
2202 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002203 .name = "verify_pattern",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002204 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002205 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002206 .cb = str_verify_pattern_cb,
2207 .help = "Fill pattern for IO buffers",
2208 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002209 .hide = 1,
2210 .category = FIO_OPT_C_IO,
2211 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002212 },
2213 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002214 .name = "verify_fatal",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002215 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002216 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002217 .off1 = td_var_offset(verify_fatal),
2218 .def = "0",
2219 .help = "Exit on a single verify failure, don't continue",
2220 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002221 .hide = 1,
2222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002224 },
2225 {
Jens Axboeb463e932011-01-12 09:03:23 +01002226 .name = "verify_dump",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002227 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002228 .type = FIO_OPT_BOOL,
2229 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002230 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002231 .help = "Dump contents of good and bad blocks on failure",
2232 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002233 .hide = 1,
2234 .category = FIO_OPT_C_IO,
2235 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002236 },
2237 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002238 .name = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002239 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002240 .type = FIO_OPT_INT,
2241 .off1 = td_var_offset(verify_async),
2242 .def = "0",
2243 .help = "Number of async verifier threads to use",
2244 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002245 .hide = 1,
2246 .category = FIO_OPT_C_IO,
2247 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002248 },
Jens Axboe9e144182010-06-15 14:25:36 +02002249 {
2250 .name = "verify_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002251 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002252 .type = FIO_OPT_STR_VAL,
2253 .off1 = td_var_offset(verify_backlog),
2254 .help = "Verify after this number of blocks are written",
2255 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002256 .hide = 1,
2257 .category = FIO_OPT_C_IO,
2258 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002259 },
2260 {
2261 .name = "verify_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002262 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002263 .type = FIO_OPT_INT,
2264 .off1 = td_var_offset(verify_batch),
2265 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002266 .parent = "verify",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002267 .hide = 1,
2268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002270 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002271#ifdef FIO_HAVE_CPU_AFFINITY
2272 {
2273 .name = "verify_async_cpus",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002274 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002275 .type = FIO_OPT_STR,
2276 .cb = str_verify_cpus_allowed_cb,
2277 .help = "Set CPUs allowed for async verify threads",
2278 .parent = "verify_async",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002279 .hide = 1,
2280 .category = FIO_OPT_C_IO,
2281 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002282 },
2283#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002284 {
2285 .name = "experimental_verify",
2286 .off1 = td_var_offset(experimental_verify),
2287 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002288 .help = "Enable experimental verification",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002289 .category = FIO_OPT_C_IO,
2290 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002291 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002292#ifdef FIO_HAVE_TRIM
2293 {
2294 .name = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002295 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002296 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002297 .off1 = td_var_offset(trim_percentage),
2298 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002299 .maxval = 100,
2300 .help = "Number of verify blocks to discard/trim",
2301 .parent = "verify",
2302 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002303 .interval = 1,
2304 .hide = 1,
2305 .category = FIO_OPT_C_IO,
2306 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002307 },
2308 {
2309 .name = "trim_verify_zero",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002310 .lname = "Verify trim zero",
2311 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002312 .help = "Verify that trim/discarded blocks are returned as zeroes",
2313 .off1 = td_var_offset(trim_zero),
2314 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002315 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002316 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002317 .category = FIO_OPT_C_IO,
2318 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002319 },
2320 {
2321 .name = "trim_backlog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002322 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002323 .type = FIO_OPT_STR_VAL,
2324 .off1 = td_var_offset(trim_backlog),
2325 .help = "Trim after this number of blocks are written",
2326 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002327 .hide = 1,
2328 .interval = 1,
2329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002331 },
2332 {
2333 .name = "trim_backlog_batch",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002334 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002335 .type = FIO_OPT_INT,
2336 .off1 = td_var_offset(trim_batch),
2337 .help = "Trim this number of IO blocks",
2338 .parent = "trim_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002339 .hide = 1,
2340 .interval = 1,
2341 .category = FIO_OPT_C_IO,
2342 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002343 },
2344#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002345 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002346 .name = "write_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002347 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002348 .type = FIO_OPT_STR_STORE,
2349 .off1 = td_var_offset(write_iolog_file),
2350 .help = "Store IO pattern to file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002351 .category = FIO_OPT_C_IO,
2352 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002353 },
2354 {
2355 .name = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002356 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002357 .type = FIO_OPT_STR_STORE,
2358 .off1 = td_var_offset(read_iolog_file),
2359 .help = "Playback IO pattern from file",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002360 .category = FIO_OPT_C_IO,
2361 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002362 },
2363 {
David Nellans64bbb862010-08-24 22:13:30 +02002364 .name = "replay_no_stall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002365 .lname = "Don't stall on replay",
2366 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002367 .off1 = td_var_offset(no_stall),
2368 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002369 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002370 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002371 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002372 .category = FIO_OPT_C_IO,
2373 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002374 },
2375 {
David Nellansd1c46c02010-08-31 21:20:47 +02002376 .name = "replay_redirect",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002377 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002378 .type = FIO_OPT_STR_STORE,
2379 .off1 = td_var_offset(replay_redirect),
2380 .parent = "read_iolog",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002381 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002382 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002383 .category = FIO_OPT_C_IO,
2384 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002385 },
2386 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002387 .name = "exec_prerun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002388 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002389 .type = FIO_OPT_STR_STORE,
2390 .off1 = td_var_offset(exec_prerun),
2391 .help = "Execute this file prior to running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002392 .category = FIO_OPT_C_GENERAL,
2393 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002394 },
2395 {
2396 .name = "exec_postrun",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002397 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002398 .type = FIO_OPT_STR_STORE,
2399 .off1 = td_var_offset(exec_postrun),
2400 .help = "Execute this file after running job",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002401 .category = FIO_OPT_C_GENERAL,
2402 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002403 },
2404#ifdef FIO_HAVE_IOSCHED_SWITCH
2405 {
2406 .name = "ioscheduler",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002407 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002408 .type = FIO_OPT_STR_STORE,
2409 .off1 = td_var_offset(ioscheduler),
2410 .help = "Use this IO scheduler on the backing device",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002411 .category = FIO_OPT_C_FILE,
2412 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002413 },
2414#endif
2415 {
2416 .name = "zonesize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002417 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002418 .type = FIO_OPT_STR_VAL,
2419 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002420 .help = "Amount of data to read per zone",
2421 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002422 .interval = 1024 * 1024,
2423 .category = FIO_OPT_C_IO,
2424 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002425 },
2426 {
2427 .name = "zonerange",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002428 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002429 .type = FIO_OPT_STR_VAL,
2430 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002431 .help = "Give size of an IO zone",
2432 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002433 .interval = 1024 * 1024,
2434 .category = FIO_OPT_C_IO,
2435 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002436 },
2437 {
2438 .name = "zoneskip",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002439 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002440 .type = FIO_OPT_STR_VAL,
2441 .off1 = td_var_offset(zone_skip),
2442 .help = "Space between IO zones",
2443 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002444 .interval = 1024 * 1024,
2445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002447 },
2448 {
2449 .name = "lockmem",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002450 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002451 .type = FIO_OPT_STR_VAL,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002452 .off1 = td_var_offset(lockmem),
2453 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002454 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002455 .interval = 1024 * 1024,
2456 .category = FIO_OPT_C_GENERAL,
2457 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002458 },
2459 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002460 .name = "rwmixread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002461 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002462 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002463 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002464 .maxval = 100,
2465 .help = "Percentage of mixed workload that is reads",
2466 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002467 .interval = 5,
2468 .inverse = "rwmixwrite",
2469 .category = FIO_OPT_C_IO,
2470 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002471 },
2472 {
2473 .name = "rwmixwrite",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002474 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002475 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002476 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002477 .maxval = 100,
2478 .help = "Percentage of mixed workload that is writes",
2479 .def = "50",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002480 .interval = 5,
2481 .inverse = "rwmixread",
2482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002484 },
2485 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002486 .name = "rwmixcycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002487 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002488 .type = FIO_OPT_DEPRECATED,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002489 .category = FIO_OPT_C_IO,
2490 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002491 },
2492 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002493 .name = "nice",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002494 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002495 .type = FIO_OPT_INT,
2496 .off1 = td_var_offset(nice),
2497 .help = "Set job CPU nice value",
2498 .minval = -19,
2499 .maxval = 20,
2500 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002501 .interval = 1,
2502 .category = FIO_OPT_C_GENERAL,
2503 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002504 },
2505#ifdef FIO_HAVE_IOPRIO
2506 {
2507 .name = "prio",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002508 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002509 .type = FIO_OPT_INT,
2510 .cb = str_prio_cb,
2511 .help = "Set job IO priority value",
2512 .minval = 0,
2513 .maxval = 7,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002514 .interval = 1,
2515 .category = FIO_OPT_C_GENERAL,
2516 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002517 },
2518 {
2519 .name = "prioclass",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002520 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002521 .type = FIO_OPT_INT,
2522 .cb = str_prioclass_cb,
2523 .help = "Set job IO priority class",
2524 .minval = 0,
2525 .maxval = 3,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002526 .interval = 1,
2527 .category = FIO_OPT_C_GENERAL,
2528 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002529 },
2530#endif
2531 {
2532 .name = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002533 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002534 .type = FIO_OPT_INT,
2535 .off1 = td_var_offset(thinktime),
2536 .help = "Idle time between IO buffers (usec)",
2537 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002538 .category = FIO_OPT_C_IO,
2539 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002540 },
2541 {
2542 .name = "thinktime_spin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002543 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002544 .type = FIO_OPT_INT,
2545 .off1 = td_var_offset(thinktime_spin),
2546 .help = "Start think time by spinning this amount (usec)",
2547 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002548 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002549 .hide = 1,
2550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002552 },
2553 {
2554 .name = "thinktime_blocks",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002555 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002556 .type = FIO_OPT_INT,
2557 .off1 = td_var_offset(thinktime_blocks),
2558 .help = "IO buffer period between 'thinktime'",
2559 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002560 .parent = "thinktime",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002561 .hide = 1,
2562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002564 },
2565 {
2566 .name = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002567 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002568 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002569 .off1 = td_var_offset(rate[DDIR_READ]),
2570 .off2 = td_var_offset(rate[DDIR_WRITE]),
2571 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002572 .help = "Set bandwidth rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002573 .category = FIO_OPT_C_IO,
2574 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002575 },
2576 {
2577 .name = "ratemin",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002578 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002579 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002580 .off1 = td_var_offset(ratemin[DDIR_READ]),
2581 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2582 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002583 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002584 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002585 .hide = 1,
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002588 },
2589 {
2590 .name = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002591 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002592 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002593 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2594 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2595 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002596 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002597 .hide = 1,
2598 .category = FIO_OPT_C_IO,
2599 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002600 },
2601 {
2602 .name = "rate_iops_min",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002603 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002604 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002605 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2606 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2607 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002608 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002609 .parent = "rate_iops",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002610 .hide = 1,
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002613 },
2614 {
2615 .name = "ratecycle",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002616 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002617 .type = FIO_OPT_INT,
2618 .off1 = td_var_offset(ratecycle),
2619 .help = "Window average for rate limits (msec)",
2620 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002621 .parent = "rate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002622 .hide = 1,
2623 .category = FIO_OPT_C_IO,
2624 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002625 },
2626 {
Jens Axboe15501532012-10-24 16:37:45 +02002627 .name = "max_latency",
2628 .type = FIO_OPT_INT,
2629 .off1 = td_var_offset(max_latency),
2630 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002631 .category = FIO_OPT_C_IO,
2632 .group = FIO_OPT_G_RATE,
Jens Axboe15501532012-10-24 16:37:45 +02002633 },
2634 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002635 .name = "invalidate",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002636 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002637 .type = FIO_OPT_BOOL,
2638 .off1 = td_var_offset(invalidate_cache),
2639 .help = "Invalidate buffer/page cache prior to running job",
2640 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002641 .category = FIO_OPT_C_IO,
2642 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002643 },
2644 {
2645 .name = "sync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002646 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002647 .type = FIO_OPT_BOOL,
2648 .off1 = td_var_offset(sync_io),
2649 .help = "Use O_SYNC for buffered writes",
2650 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002651 .parent = "buffered",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002652 .hide = 1,
2653 .category = FIO_OPT_C_IO,
2654 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002655 },
2656 {
2657 .name = "create_serialize",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002658 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002659 .type = FIO_OPT_BOOL,
2660 .off1 = td_var_offset(create_serialize),
2661 .help = "Serialize creating of job files",
2662 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002663 .category = FIO_OPT_C_FILE,
2664 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002665 },
2666 {
2667 .name = "create_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002668 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002669 .type = FIO_OPT_BOOL,
2670 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002671 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002672 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002673 .category = FIO_OPT_C_FILE,
2674 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002675 },
2676 {
Jens Axboe814452b2009-03-04 12:53:13 +01002677 .name = "create_on_open",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002678 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002679 .type = FIO_OPT_BOOL,
2680 .off1 = td_var_offset(create_on_open),
2681 .help = "Create files when they are opened for IO",
2682 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002683 .category = FIO_OPT_C_FILE,
2684 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002685 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002686 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002687 .name = "create_only",
2688 .type = FIO_OPT_BOOL,
2689 .off1 = td_var_offset(create_only),
2690 .help = "Only perform file creation phase",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002691 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002692 .def = "0",
2693 },
2694 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002695 .name = "pre_read",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002696 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002697 .type = FIO_OPT_BOOL,
2698 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002699 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002700 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002701 .category = FIO_OPT_C_FILE,
2702 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002703 },
2704#ifdef FIO_HAVE_CPU_AFFINITY
2705 {
2706 .name = "cpumask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002707 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002708 .type = FIO_OPT_INT,
2709 .cb = str_cpumask_cb,
2710 .help = "CPU affinity mask",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002711 .category = FIO_OPT_C_GENERAL,
2712 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002713 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002714 {
2715 .name = "cpus_allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002716 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002717 .type = FIO_OPT_STR,
2718 .cb = str_cpus_allowed_cb,
2719 .help = "Set CPUs allowed",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002720 .category = FIO_OPT_C_GENERAL,
2721 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002722 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002723#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002724#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002725 {
2726 .name = "numa_cpu_nodes",
2727 .type = FIO_OPT_STR,
2728 .cb = str_numa_cpunodes_cb,
2729 .help = "NUMA CPU nodes bind",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002730 .category = FIO_OPT_C_GENERAL,
2731 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002732 },
2733 {
2734 .name = "numa_mem_policy",
2735 .type = FIO_OPT_STR,
2736 .cb = str_numa_mpol_cb,
2737 .help = "NUMA memory policy setup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002738 .category = FIO_OPT_C_GENERAL,
2739 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002740 },
2741#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002742 {
2743 .name = "end_fsync",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002744 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002745 .type = FIO_OPT_BOOL,
2746 .off1 = td_var_offset(end_fsync),
2747 .help = "Include fsync at the end of job",
2748 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002749 .category = FIO_OPT_C_FILE,
2750 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002751 },
2752 {
2753 .name = "fsync_on_close",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002754 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002755 .type = FIO_OPT_BOOL,
2756 .off1 = td_var_offset(fsync_on_close),
2757 .help = "fsync files on close",
2758 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002759 .category = FIO_OPT_C_FILE,
2760 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002761 },
2762 {
2763 .name = "unlink",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002764 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002765 .type = FIO_OPT_BOOL,
2766 .off1 = td_var_offset(unlink),
2767 .help = "Unlink created files after job has completed",
2768 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002769 .category = FIO_OPT_C_FILE,
2770 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002771 },
2772 {
2773 .name = "exitall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002774 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002775 .type = FIO_OPT_STR_SET,
2776 .cb = str_exitall_cb,
2777 .help = "Terminate all jobs when one exits",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002778 .category = FIO_OPT_C_GENERAL,
2779 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002780 },
2781 {
2782 .name = "stonewall",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002783 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02002784 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002785 .type = FIO_OPT_STR_SET,
2786 .off1 = td_var_offset(stonewall),
2787 .help = "Insert a hard barrier between this job and previous",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002788 .category = FIO_OPT_C_GENERAL,
2789 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002790 },
2791 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01002792 .name = "new_group",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002793 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01002794 .type = FIO_OPT_STR_SET,
2795 .off1 = td_var_offset(new_group),
2796 .help = "Mark the start of a new group (for reporting)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002797 .category = FIO_OPT_C_GENERAL,
2798 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01002799 },
2800 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002801 .name = "thread",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002802 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002803 .type = FIO_OPT_STR_SET,
2804 .off1 = td_var_offset(use_thread),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002805 .help = "Use threads instead of processes",
2806 .category = FIO_OPT_C_GENERAL,
2807 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002808 },
2809 {
2810 .name = "write_bw_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002811 .lname = "Write bandwidth log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002812 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002813 .off1 = td_var_offset(bw_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002814 .cb = str_write_bw_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002815 .help = "Write log of bandwidth during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002816 .category = FIO_OPT_C_LOG,
2817 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002818 },
2819 {
2820 .name = "write_lat_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002821 .lname = "Write latency log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002822 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002823 .off1 = td_var_offset(lat_log_file),
Jens Axboee3cedca2008-11-19 19:57:52 +01002824 .cb = str_write_lat_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002825 .help = "Write log of latency during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002826 .category = FIO_OPT_C_LOG,
2827 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002828 },
2829 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002830 .name = "write_iops_log",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002831 .lname = "Write IOPS log",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002832 .type = FIO_OPT_STR,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002833 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002834 .cb = str_write_iops_log_cb,
2835 .help = "Write log of IOPS during run",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002836 .category = FIO_OPT_C_LOG,
2837 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002838 },
2839 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002840 .name = "log_avg_msec",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002841 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002842 .type = FIO_OPT_INT,
2843 .off1 = td_var_offset(log_avg_msec),
2844 .help = "Average bw/iops/lat logs over this period of time",
2845 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002846 .category = FIO_OPT_C_LOG,
2847 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002848 },
2849 {
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002850 .name = "bwavgtime",
2851 .lname = "Bandwidth average time",
Jens Axboee01b22b2009-06-09 15:43:25 +02002852 .type = FIO_OPT_INT,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002853 .off1 = td_var_offset(bw_avg_time),
2854 .help = "Time window over which to calculate bandwidth"
2855 " (msec)",
2856 .def = "500",
2857 .parent = "write_bw_log",
2858 .hide = 1,
2859 .interval = 100,
2860 .category = FIO_OPT_C_LOG,
2861 .group = FIO_OPT_G_INVALID,
2862 },
2863 {
2864 .name = "iopsavgtime",
2865 .lname = "IOPS average time",
2866 .type = FIO_OPT_INT,
2867 .off1 = td_var_offset(iops_avg_time),
2868 .help = "Time window over which to calculate IOPS (msec)",
2869 .def = "500",
2870 .parent = "write_iops_log",
2871 .hide = 1,
2872 .interval = 100,
2873 .category = FIO_OPT_C_LOG,
2874 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002875 },
2876 {
2877 .name = "group_reporting",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002878 .lname = "Group reporting",
2879 .type = FIO_OPT_BOOL,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002880 .off1 = td_var_offset(group_reporting),
2881 .help = "Do reporting on a per-group basis",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002882 .def = "1",
2883 .category = FIO_OPT_C_STAT,
2884 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002885 },
2886 {
Jens Axboee9459e52007-04-17 15:46:32 +02002887 .name = "zero_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002888 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02002889 .type = FIO_OPT_STR_SET,
2890 .off1 = td_var_offset(zero_buffers),
2891 .help = "Init IO buffers to all zeroes",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002892 .category = FIO_OPT_C_IO,
2893 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02002894 },
Jens Axboe5973caf2008-05-21 19:52:35 +02002895 {
2896 .name = "refill_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002897 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02002898 .type = FIO_OPT_STR_SET,
2899 .off1 = td_var_offset(refill_buffers),
2900 .help = "Refill IO buffers on every IO submit",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002901 .category = FIO_OPT_C_IO,
2902 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02002903 },
Yu-ju Hong83349192011-08-13 00:53:44 +02002904 {
Jens Axboefd684182011-09-19 09:24:44 +02002905 .name = "scramble_buffers",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002906 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02002907 .type = FIO_OPT_BOOL,
2908 .off1 = td_var_offset(scramble_buffers),
2909 .help = "Slightly scramble buffers on every IO submit",
2910 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002911 .category = FIO_OPT_C_IO,
2912 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02002913 },
2914 {
Jens Axboe9c426842012-03-02 21:02:12 +01002915 .name = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002916 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01002917 .type = FIO_OPT_INT,
2918 .off1 = td_var_offset(compress_percentage),
2919 .maxval = 100,
2920 .minval = 1,
2921 .help = "How compressible the buffer is (approximately)",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002922 .interval = 5,
2923 .category = FIO_OPT_C_IO,
2924 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01002925 },
2926 {
Jens Axboef97a43a2012-03-09 19:06:24 +01002927 .name = "buffer_compress_chunk",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002928 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01002929 .type = FIO_OPT_INT,
2930 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01002931 .parent = "buffer_compress_percentage",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002932 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01002933 .help = "Size of compressible region in buffer",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002934 .interval = 256,
2935 .category = FIO_OPT_C_IO,
2936 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01002937 },
2938 {
Yu-ju Hong83349192011-08-13 00:53:44 +02002939 .name = "clat_percentiles",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002940 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02002941 .type = FIO_OPT_BOOL,
2942 .off1 = td_var_offset(clat_percentiles),
2943 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02002944 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002945 .category = FIO_OPT_C_STAT,
2946 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002947 },
2948 {
2949 .name = "percentile_list",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002950 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02002951 .type = FIO_OPT_FLOAT_LIST,
2952 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01002953 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02002954 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01002955 .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 +02002956 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2957 .minfp = 0.0,
2958 .maxfp = 100.0,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002959 .category = FIO_OPT_C_STAT,
2960 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002961 },
2962
Jens Axboe0a839f32007-04-26 09:02:34 +02002963#ifdef FIO_HAVE_DISK_UTIL
2964 {
2965 .name = "disk_util",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002966 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02002967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02002969 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02002970 .def = "1",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002971 .category = FIO_OPT_C_STAT,
2972 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02002973 },
2974#endif
Jens Axboee9459e52007-04-17 15:46:32 +02002975 {
Jens Axboe993bf482008-11-14 13:04:53 +01002976 .name = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002977 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01002978 .type = FIO_OPT_BOOL,
2979 .help = "Greatly reduce number of gettimeofday() calls",
2980 .cb = str_gtod_reduce_cb,
2981 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002982 .hide_on_set = 1,
2983 .category = FIO_OPT_C_STAT,
2984 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01002985 },
2986 {
Jens Axboe02af0982010-06-24 09:59:34 +02002987 .name = "disable_lat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002988 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02002989 .type = FIO_OPT_BOOL,
2990 .off1 = td_var_offset(disable_lat),
2991 .help = "Disable latency numbers",
2992 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002993 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02002994 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002995 .category = FIO_OPT_C_STAT,
2996 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02002997 },
2998 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02002999 .name = "disable_clat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003000 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003001 .type = FIO_OPT_BOOL,
3002 .off1 = td_var_offset(disable_clat),
3003 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003004 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003005 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003006 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003007 .category = FIO_OPT_C_STAT,
3008 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003009 },
3010 {
3011 .name = "disable_slat",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003012 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003013 .type = FIO_OPT_BOOL,
3014 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003015 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003016 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003017 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003018 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003019 .category = FIO_OPT_C_STAT,
3020 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003021 },
3022 {
3023 .name = "disable_bw_measurement",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003024 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003025 .type = FIO_OPT_BOOL,
3026 .off1 = td_var_offset(disable_bw),
3027 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003028 .parent = "gtod_reduce",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003029 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003030 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003031 .category = FIO_OPT_C_STAT,
3032 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003033 },
3034 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003035 .name = "gtod_cpu",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003036 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003037 .type = FIO_OPT_INT,
3038 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003039 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003040 .verify = gtod_cpu_verify,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003041 .category = FIO_OPT_C_GENERAL,
3042 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003043 },
3044 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003045 .name = "unified_rw_reporting",
3046 .type = FIO_OPT_BOOL,
3047 .off1 = td_var_offset(unified_rw_rep),
3048 .help = "Unify reporting across data direction",
3049 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003050 .category = FIO_OPT_C_GENERAL,
3051 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003052 },
3053 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003054 .name = "continue_on_error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003055 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003056 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003057 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003058 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003059 .def = "none",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003060 .category = FIO_OPT_C_GENERAL,
3061 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003062 .posval = {
3063 { .ival = "none",
3064 .oval = ERROR_TYPE_NONE,
3065 .help = "Exit when an error is encountered",
3066 },
3067 { .ival = "read",
3068 .oval = ERROR_TYPE_READ,
3069 .help = "Continue on read errors only",
3070 },
3071 { .ival = "write",
3072 .oval = ERROR_TYPE_WRITE,
3073 .help = "Continue on write errors only",
3074 },
3075 { .ival = "io",
3076 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3077 .help = "Continue on any IO errors",
3078 },
3079 { .ival = "verify",
3080 .oval = ERROR_TYPE_VERIFY,
3081 .help = "Continue on verify errors only",
3082 },
3083 { .ival = "all",
3084 .oval = ERROR_TYPE_ANY,
3085 .help = "Continue on all io and verify errors",
3086 },
3087 { .ival = "0",
3088 .oval = ERROR_TYPE_NONE,
3089 .help = "Alias for 'none'",
3090 },
3091 { .ival = "1",
3092 .oval = ERROR_TYPE_ANY,
3093 .help = "Alias for 'all'",
3094 },
3095 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003096 },
3097 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003098 .name = "ignore_error",
3099 .type = FIO_OPT_STR,
3100 .cb = str_ignore_error_cb,
3101 .help = "Set a specific list of errors to ignore",
3102 .parent = "rw",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003103 .category = FIO_OPT_C_GENERAL,
3104 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003105 },
3106 {
3107 .name = "error_dump",
3108 .type = FIO_OPT_BOOL,
3109 .off1 = td_var_offset(error_dump),
3110 .def = "0",
3111 .help = "Dump info on each error",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003112 .category = FIO_OPT_C_GENERAL,
3113 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003114 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003115 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003116 .name = "profile",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003117 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003118 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003119 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003120 .help = "Select a specific builtin performance test",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003121 .category = FIO_OPT_C_PROFILE,
3122 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003123 },
3124 {
Jens Axboea696fa22009-12-04 10:05:02 +01003125 .name = "cgroup",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003126 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003127 .type = FIO_OPT_STR_STORE,
3128 .off1 = td_var_offset(cgroup),
3129 .help = "Add job to cgroup of this name",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003130 .category = FIO_OPT_C_GENERAL,
3131 .group = FIO_OPT_G_CGROUP,
3132 },
3133 {
3134 .name = "cgroup_nodelete",
3135 .lname = "Cgroup no-delete",
3136 .type = FIO_OPT_BOOL,
3137 .off1 = td_var_offset(cgroup_nodelete),
3138 .help = "Do not delete cgroups after job completion",
3139 .def = "0",
3140 .parent = "cgroup",
3141 .category = FIO_OPT_C_GENERAL,
3142 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003143 },
3144 {
3145 .name = "cgroup_weight",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003146 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003147 .type = FIO_OPT_INT,
3148 .off1 = td_var_offset(cgroup_weight),
3149 .help = "Use given weight for cgroup",
3150 .minval = 100,
3151 .maxval = 1000,
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003152 .parent = "cgroup",
3153 .category = FIO_OPT_C_GENERAL,
3154 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003155 },
3156 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003157 .name = "uid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003158 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003159 .type = FIO_OPT_INT,
3160 .off1 = td_var_offset(uid),
3161 .help = "Run job with this user ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003162 .category = FIO_OPT_C_GENERAL,
3163 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003164 },
3165 {
3166 .name = "gid",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003167 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003168 .type = FIO_OPT_INT,
3169 .off1 = td_var_offset(gid),
3170 .help = "Run job with this group ID",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003171 .category = FIO_OPT_C_GENERAL,
3172 .group = FIO_OPT_G_CRED,
3173 },
3174 {
3175 .name = "kb_base",
3176 .lname = "KB Base",
3177 .type = FIO_OPT_INT,
3178 .off1 = td_var_offset(kb_base),
3179 .prio = 1,
3180 .def = "1024",
3181 .posval = {
3182 { .ival = "1024",
3183 .oval = 1024,
3184 .help = "Use 1024 as the K base",
3185 },
3186 { .ival = "1000",
3187 .oval = 1000,
3188 .help = "Use 1000 as the K base",
3189 },
3190 },
3191 .help = "How many bytes per KB for reporting (1000 or 1024)",
3192 .category = FIO_OPT_C_GENERAL,
3193 .group = FIO_OPT_G_INVALID,
3194 },
3195 {
3196 .name = "unit_base",
3197 .lname = "Base unit for reporting (Bits or Bytes)",
3198 .type = FIO_OPT_INT,
3199 .off1 = td_var_offset(unit_base),
3200 .prio = 1,
3201 .posval = {
3202 { .ival = "0",
3203 .oval = 0,
3204 .help = "Auto-detect",
3205 },
3206 { .ival = "8",
3207 .oval = 8,
3208 .help = "Normal (byte based)",
3209 },
3210 { .ival = "1",
3211 .oval = 1,
3212 .help = "Bit based",
3213 },
3214 },
3215 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3216 .category = FIO_OPT_C_GENERAL,
3217 .group = FIO_OPT_G_INVALID,
3218 },
3219 {
3220 .name = "hugepage-size",
3221 .lname = "Hugepage size",
3222 .type = FIO_OPT_INT,
3223 .off1 = td_var_offset(hugepage_size),
3224 .help = "When using hugepages, specify size of each page",
3225 .def = __fio_stringify(FIO_HUGE_PAGE),
3226 .interval = 1024 * 1024,
3227 .category = FIO_OPT_C_GENERAL,
3228 .group = FIO_OPT_G_INVALID,
Jens Axboee0b0d892009-12-08 10:10:14 +01003229 },
3230 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003231 .name = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003232 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003233 .type = FIO_OPT_INT,
3234 .off1 = td_var_offset(flow_id),
3235 .help = "The flow index ID to use",
3236 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003237 .category = FIO_OPT_C_IO,
3238 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003239 },
3240 {
3241 .name = "flow",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003242 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003243 .type = FIO_OPT_INT,
3244 .off1 = td_var_offset(flow),
3245 .help = "Weight for flow control of this job",
3246 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003247 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003248 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003249 .category = FIO_OPT_C_IO,
3250 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003251 },
3252 {
3253 .name = "flow_watermark",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003254 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003255 .type = FIO_OPT_INT,
3256 .off1 = td_var_offset(flow_watermark),
3257 .help = "High watermark for flow control. This option"
3258 " should be set to the same value for all threads"
3259 " with non-zero flow.",
3260 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003261 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003262 .def = "1024",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003263 .category = FIO_OPT_C_IO,
3264 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003265 },
3266 {
3267 .name = "flow_sleep",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003268 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003269 .type = FIO_OPT_INT,
3270 .off1 = td_var_offset(flow_sleep),
3271 .help = "How many microseconds to sleep after being held"
3272 " back by the flow control mechanism",
3273 .parent = "flow_id",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003274 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003275 .def = "0",
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003276 .category = FIO_OPT_C_IO,
3277 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003278 },
3279 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003280 .name = NULL,
3281 },
3282};
3283
Jens Axboe17af15d2010-04-13 10:38:16 +02003284static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003285 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003286{
Jens Axboe17af15d2010-04-13 10:38:16 +02003287 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003288 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003289 if (o->type == FIO_OPT_STR_SET)
3290 lopt->has_arg = no_argument;
3291 else
3292 lopt->has_arg = required_argument;
3293}
3294
Steven Langde890a12011-11-09 14:03:34 +01003295static void options_to_lopts(struct fio_option *opts,
3296 struct option *long_options,
3297 int i, int option_type)
3298{
3299 struct fio_option *o = &opts[0];
3300 while (o->name) {
3301 add_to_lopt(&long_options[i], o, o->name, option_type);
3302 if (o->alias) {
3303 i++;
3304 add_to_lopt(&long_options[i], o, o->alias, option_type);
3305 }
3306
3307 i++;
3308 o++;
3309 assert(i < FIO_NR_OPTIONS);
3310 }
3311}
3312
3313void fio_options_set_ioengine_opts(struct option *long_options,
3314 struct thread_data *td)
3315{
3316 unsigned int i;
3317
3318 i = 0;
3319 while (long_options[i].name) {
3320 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3321 memset(&long_options[i], 0, sizeof(*long_options));
3322 break;
3323 }
3324 i++;
3325 }
3326
3327 /*
3328 * Just clear out the prior ioengine options.
3329 */
3330 if (!td || !td->eo)
3331 return;
3332
3333 options_to_lopts(td->io_ops->options, long_options, i,
3334 FIO_GETOPT_IOENGINE);
3335}
3336
Jens Axboe214e1ec2007-03-15 10:48:13 +01003337void fio_options_dup_and_init(struct option *long_options)
3338{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003339 unsigned int i;
3340
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003341 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003342
3343 i = 0;
3344 while (long_options[i].name)
3345 i++;
3346
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003347 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003348}
3349
Jens Axboe74929ac2009-08-05 11:42:37 +02003350struct fio_keyword {
3351 const char *word;
3352 const char *desc;
3353 char *replace;
3354};
3355
3356static struct fio_keyword fio_keywords[] = {
3357 {
3358 .word = "$pagesize",
3359 .desc = "Page size in the system",
3360 },
3361 {
3362 .word = "$mb_memory",
3363 .desc = "Megabytes of memory online",
3364 },
3365 {
3366 .word = "$ncpus",
3367 .desc = "Number of CPUs online in the system",
3368 },
3369 {
3370 .word = NULL,
3371 },
3372};
3373
3374void fio_keywords_init(void)
3375{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003376 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003377 char buf[128];
3378 long l;
3379
Jens Axboea4cfc472012-10-09 10:30:48 -06003380 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003381 fio_keywords[0].replace = strdup(buf);
3382
Jens Axboe8eb016d2011-07-11 10:24:20 +02003383 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003384 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003385 fio_keywords[1].replace = strdup(buf);
3386
Jens Axboec00a2282011-07-08 20:56:06 +02003387 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003388 sprintf(buf, "%lu", l);
3389 fio_keywords[2].replace = strdup(buf);
3390}
3391
Jens Axboe892a6ff2009-11-13 12:19:49 +01003392#define BC_APP "bc"
3393
3394static char *bc_calc(char *str)
3395{
Steven Langd0c814e2011-10-28 08:37:13 +02003396 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003397 FILE *f;
3398 int ret;
3399
3400 /*
3401 * No math, just return string
3402 */
Steven Langd0c814e2011-10-28 08:37:13 +02003403 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3404 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003405 return str;
3406
3407 /*
3408 * Split option from value, we only need to calculate the value
3409 */
3410 tmp = strchr(str, '=');
3411 if (!tmp)
3412 return str;
3413
3414 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003415
Steven Langd0c814e2011-10-28 08:37:13 +02003416 /*
3417 * Prevent buffer overflows; such a case isn't reasonable anyway
3418 */
3419 if (strlen(str) >= 128 || strlen(tmp) > 100)
3420 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003421
3422 sprintf(buf, "which %s > /dev/null", BC_APP);
3423 if (system(buf)) {
3424 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003425 return NULL;
3426 }
3427
Steven Langd0c814e2011-10-28 08:37:13 +02003428 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003429 f = popen(buf, "r");
3430 if (!f) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003431 return NULL;
3432 }
3433
Steven Langd0c814e2011-10-28 08:37:13 +02003434 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003435 if (ret <= 0) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003436 return NULL;
3437 }
3438
Jens Axboe892a6ff2009-11-13 12:19:49 +01003439 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003440 buf[(tmp - str) + ret - 1] = '\0';
3441 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003442 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003443 return strdup(buf);
3444}
3445
3446/*
3447 * Return a copy of the input string with substrings of the form ${VARNAME}
3448 * substituted with the value of the environment variable VARNAME. The
3449 * substitution always occurs, even if VARNAME is empty or the corresponding
3450 * environment variable undefined.
3451 */
3452static char *option_dup_subs(const char *opt)
3453{
3454 char out[OPT_LEN_MAX+1];
3455 char in[OPT_LEN_MAX+1];
3456 char *outptr = out;
3457 char *inptr = in;
3458 char *ch1, *ch2, *env;
3459 ssize_t nchr = OPT_LEN_MAX;
3460 size_t envlen;
3461
3462 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3463 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3464 return NULL;
3465 }
3466
3467 in[OPT_LEN_MAX] = '\0';
3468 strncpy(in, opt, OPT_LEN_MAX);
3469
3470 while (*inptr && nchr > 0) {
3471 if (inptr[0] == '$' && inptr[1] == '{') {
3472 ch2 = strchr(inptr, '}');
3473 if (ch2 && inptr+1 < ch2) {
3474 ch1 = inptr+2;
3475 inptr = ch2+1;
3476 *ch2 = '\0';
3477
3478 env = getenv(ch1);
3479 if (env) {
3480 envlen = strlen(env);
3481 if (envlen <= nchr) {
3482 memcpy(outptr, env, envlen);
3483 outptr += envlen;
3484 nchr -= envlen;
3485 }
3486 }
3487
3488 continue;
3489 }
3490 }
3491
3492 *outptr++ = *inptr++;
3493 --nchr;
3494 }
3495
3496 *outptr = '\0';
3497 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003498}
3499
Jens Axboe74929ac2009-08-05 11:42:37 +02003500/*
3501 * Look for reserved variable names and replace them with real values
3502 */
3503static char *fio_keyword_replace(char *opt)
3504{
3505 char *s;
3506 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003507 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003508
3509 for (i = 0; fio_keywords[i].word != NULL; i++) {
3510 struct fio_keyword *kw = &fio_keywords[i];
3511
3512 while ((s = strstr(opt, kw->word)) != NULL) {
3513 char *new = malloc(strlen(opt) + 1);
3514 char *o_org = opt;
3515 int olen = s - opt;
3516 int len;
3517
3518 /*
3519 * Copy part of the string before the keyword and
3520 * sprintf() the replacement after it.
3521 */
3522 memcpy(new, opt, olen);
3523 len = sprintf(new + olen, "%s", kw->replace);
3524
3525 /*
3526 * If there's more in the original string, copy that
3527 * in too
3528 */
3529 opt += strlen(kw->word) + olen;
3530 if (strlen(opt))
3531 memcpy(new + olen + len, opt, opt - o_org - 1);
3532
3533 /*
3534 * replace opt and free the old opt
3535 */
3536 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003537 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003538
Steven Langd0c814e2011-10-28 08:37:13 +02003539 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003540 }
3541 }
3542
Steven Langd0c814e2011-10-28 08:37:13 +02003543 /*
3544 * Check for potential math and invoke bc, if possible
3545 */
3546 if (docalc)
3547 opt = bc_calc(opt);
3548
Jens Axboe7a958bd2009-11-13 12:33:54 +01003549 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003550}
3551
Steven Langd0c814e2011-10-28 08:37:13 +02003552static char **dup_and_sub_options(char **opts, int num_opts)
3553{
3554 int i;
3555 char **opts_copy = malloc(num_opts * sizeof(*opts));
3556 for (i = 0; i < num_opts; i++) {
3557 opts_copy[i] = option_dup_subs(opts[i]);
3558 if (!opts_copy[i])
3559 continue;
3560 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3561 }
3562 return opts_copy;
3563}
3564
Jens Axboe3b8b7132008-06-10 19:46:23 +02003565int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003566{
Steven Langde890a12011-11-09 14:03:34 +01003567 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003568 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003569
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003570 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003571 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003572
Steven Langde890a12011-11-09 14:03:34 +01003573 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3574 struct fio_option *o;
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003575 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3576 &o, td);
Steven Langd0c814e2011-10-28 08:37:13 +02003577
Steven Langde890a12011-11-09 14:03:34 +01003578 if (opts_copy[i]) {
3579 if (newret && !o) {
3580 unknown++;
3581 continue;
3582 }
Steven Langd0c814e2011-10-28 08:37:13 +02003583 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003584 opts_copy[i] = NULL;
3585 }
3586
3587 ret |= newret;
3588 }
3589
3590 if (unknown) {
3591 ret |= ioengine_load(td);
3592 if (td->eo) {
3593 sort_options(opts_copy, td->io_ops->options, num_opts);
3594 opts = opts_copy;
3595 }
3596 for (i = 0; i < num_opts; i++) {
3597 struct fio_option *o = NULL;
3598 int newret = 1;
3599 if (!opts_copy[i])
3600 continue;
3601
3602 if (td->eo)
3603 newret = parse_option(opts_copy[i], opts[i],
3604 td->io_ops->options, &o,
3605 td->eo);
3606
3607 ret |= newret;
3608 if (!o)
3609 log_err("Bad option <%s>\n", opts[i]);
3610
3611 free(opts_copy[i]);
3612 opts_copy[i] = NULL;
3613 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003614 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003615
Steven Langd0c814e2011-10-28 08:37:13 +02003616 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003617 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003618}
3619
3620int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3621{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003622 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003623}
3624
Steven Langde890a12011-11-09 14:03:34 +01003625int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3626 char *val)
3627{
3628 return parse_cmd_option(opt, val, td->io_ops->options, td);
3629}
3630
Jens Axboe214e1ec2007-03-15 10:48:13 +01003631void fio_fill_default_options(struct thread_data *td)
3632{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003633 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003634}
3635
3636int fio_show_option_help(const char *opt)
3637{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003638 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003639}
Jens Axboed23bb322007-03-23 15:57:56 +01003640
Steven Langde890a12011-11-09 14:03:34 +01003641void options_mem_dupe(void *data, struct fio_option *options)
3642{
3643 struct fio_option *o;
3644 char **ptr;
3645
3646 for (o = &options[0]; o->name; o++) {
3647 if (o->type != FIO_OPT_STR_STORE)
3648 continue;
3649
3650 ptr = td_var(data, o->off1);
3651 if (*ptr)
3652 *ptr = strdup(*ptr);
3653 }
3654}
3655
Jens Axboe7e356b22011-10-14 10:55:16 +02003656/*
3657 * dupe FIO_OPT_STR_STORE options
3658 */
Steven Langde890a12011-11-09 14:03:34 +01003659void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003660{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003661 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003662
3663 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003664 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003665
Steven Langde890a12011-11-09 14:03:34 +01003666 td->eo = malloc(td->io_ops->option_struct_size);
3667 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3668 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003669 }
3670}
3671
Jens Axboed6978a32009-07-18 21:04:09 +02003672unsigned int fio_get_kb_base(void *data)
3673{
3674 struct thread_data *td = data;
3675 unsigned int kb_base = 0;
3676
3677 if (td)
3678 kb_base = td->o.kb_base;
3679 if (!kb_base)
3680 kb_base = 1024;
3681
3682 return kb_base;
3683}
Jens Axboe9f988e22010-03-04 10:42:38 +01003684
Jens Axboe07b32322010-03-05 09:48:44 +01003685int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003686{
Jens Axboe07b32322010-03-05 09:48:44 +01003687 struct fio_option *__o;
3688 int opt_index = 0;
3689
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003690 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003691 while (__o->name) {
3692 opt_index++;
3693 __o++;
3694 }
3695
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003696 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe07b32322010-03-05 09:48:44 +01003697 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003698}
Jens Axboee2de69d2010-03-04 14:05:48 +01003699
Jens Axboe07b32322010-03-05 09:48:44 +01003700void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003701{
Jens Axboe07b32322010-03-05 09:48:44 +01003702 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003703
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003704 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003705 while (o->name) {
3706 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3707 o->type = FIO_OPT_INVALID;
3708 o->prof_name = NULL;
3709 }
3710 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003711 }
3712}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003713
3714void add_opt_posval(const char *optname, const char *ival, const char *help)
3715{
3716 struct fio_option *o;
3717 unsigned int i;
3718
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003719 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003720 if (!o)
3721 return;
3722
3723 for (i = 0; i < PARSE_MAX_VP; i++) {
3724 if (o->posval[i].ival)
3725 continue;
3726
3727 o->posval[i].ival = ival;
3728 o->posval[i].help = help;
3729 break;
3730 }
3731}
3732
3733void del_opt_posval(const char *optname, const char *ival)
3734{
3735 struct fio_option *o;
3736 unsigned int i;
3737
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003738 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003739 if (!o)
3740 return;
3741
3742 for (i = 0; i < PARSE_MAX_VP; i++) {
3743 if (!o->posval[i].ival)
3744 continue;
3745 if (strcmp(o->posval[i].ival, ival))
3746 continue;
3747
3748 o->posval[i].ival = NULL;
3749 o->posval[i].help = NULL;
3750 }
3751}
Jens Axboe7e356b22011-10-14 10:55:16 +02003752
3753void fio_options_free(struct thread_data *td)
3754{
Jens Axboe81c6b6c2013-04-10 19:30:50 +02003755 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003756 if (td->eo && td->io_ops && td->io_ops->options) {
3757 options_free(td->io_ops->options, td->eo);
3758 free(td->eo);
3759 td->eo = NULL;
3760 }
Jens Axboe7e356b22011-10-14 10:55:16 +02003761}