blob: 8681c218bf51e4c1068216af33a9c4a972119e0c [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;
Jens Axboe720e84a2009-04-21 08:29:55 +0200163}
164
165static int str_bssplit_cb(void *data, const char *input)
166{
167 struct thread_data *td = data;
168 char *str, *p, *odir;
169 int ret = 0;
170
171 p = str = strdup(input);
172
173 strip_blank_front(&str);
174 strip_blank_end(str);
175
176 odir = strchr(str, ',');
177 if (odir) {
178 ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
179 if (!ret) {
180 *odir = '\0';
181 ret = bssplit_ddir(td, DDIR_READ, str);
182 }
183 } else {
184 char *op;
185
186 op = strdup(str);
187
188 ret = bssplit_ddir(td, DDIR_READ, str);
189 if (!ret)
190 ret = bssplit_ddir(td, DDIR_WRITE, op);
191
192 free(op);
193 }
Jens Axboe564ca972007-12-14 12:21:19 +0100194
195 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200196 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100197}
198
Jens Axboe211097b2007-03-22 18:56:45 +0100199static int str_rw_cb(void *data, const char *str)
200{
201 struct thread_data *td = data;
202 char *nr = get_opt_postfix(str);
203
Jens Axboe5736c102010-07-20 12:03:25 -0600204 td->o.ddir_seq_nr = 1;
Jens Axboe059b0802011-08-25 09:09:37 +0200205 td->o.ddir_seq_add = 0;
206
207 if (!nr)
208 return 0;
209
210 if (td_random(td))
Jens Axboe5736c102010-07-20 12:03:25 -0600211 td->o.ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200212 else {
213 long long val;
214
Jens Axboe6925dd32011-09-07 22:10:11 +0200215 if (str_to_decimal(nr, &val, 1, td)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200216 log_err("fio: rw postfix parsing failed\n");
217 free(nr);
218 return 1;
219 }
220
221 td->o.ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100222 }
Jens Axboe211097b2007-03-22 18:56:45 +0100223
Jens Axboe059b0802011-08-25 09:09:37 +0200224 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100225 return 0;
226}
227
Jens Axboe214e1ec2007-03-15 10:48:13 +0100228static int str_mem_cb(void *data, const char *mem)
229{
230 struct thread_data *td = data;
231
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100232 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100233 td->mmapfile = get_opt_postfix(mem);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100234 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100235 log_err("fio: mmaphuge:/path/to/file\n");
236 return 1;
237 }
238 }
239
240 return 0;
241}
242
Jens Axboe5d7c5d32010-06-21 15:08:17 +0200243static int str_verify_cb(void *data, const char *mem)
244{
245 struct thread_data *td = data;
246
Jens Axboee3aaafc2012-02-22 20:28:17 +0100247 if (td->o.verify == VERIFY_CRC32C_INTEL ||
248 td->o.verify == VERIFY_CRC32C) {
249 crc32c_intel_probe();
Jens Axboe5d7c5d32010-06-21 15:08:17 +0200250 }
251
252 return 0;
253}
254
Jens Axboec223da82010-03-24 13:23:53 +0100255static int fio_clock_source_cb(void *data, const char *str)
256{
257 struct thread_data *td = data;
258
259 fio_clock_source = td->o.clocksource;
260 fio_time_init();
261 return 0;
262}
263
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400264static int str_lockmem_cb(void fio_unused *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100265{
266 mlock_size = *val;
267 return 0;
268}
269
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400270static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200271{
272 struct thread_data *td = data;
273
274 td->o.rwmix[DDIR_READ] = *val;
275 td->o.rwmix[DDIR_WRITE] = 100 - *val;
276 return 0;
277}
278
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400279static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200280{
281 struct thread_data *td = data;
282
283 td->o.rwmix[DDIR_WRITE] = *val;
284 td->o.rwmix[DDIR_READ] = 100 - *val;
285 return 0;
286}
287
Jens Axboe214e1ec2007-03-15 10:48:13 +0100288#ifdef FIO_HAVE_IOPRIO
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400289static int str_prioclass_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100290{
291 struct thread_data *td = data;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200292 unsigned short mask;
293
294 /*
295 * mask off old class bits, str_prio_cb() may have set a default class
296 */
297 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
298 td->ioprio &= mask;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100299
300 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
Jens Axboeac684782007-11-08 08:29:07 +0100301 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100302 return 0;
303}
304
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400305static int str_prio_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100306{
307 struct thread_data *td = data;
308
309 td->ioprio |= *val;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200310
311 /*
312 * If no class is set, assume BE
313 */
314 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
315 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
316
Jens Axboeac684782007-11-08 08:29:07 +0100317 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100318 return 0;
319}
320#endif
321
322static int str_exitall_cb(void)
323{
324 exitall_on_terminate = 1;
325 return 0;
326}
327
Jens Axboe214e1ec2007-03-15 10:48:13 +0100328#ifdef FIO_HAVE_CPU_AFFINITY
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400329static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100330{
331 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200332 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100333 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100334 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100335
Jens Axboed2ce18b2008-12-12 20:51:40 +0100336 ret = fio_cpuset_init(&td->o.cpumask);
337 if (ret < 0) {
338 log_err("fio: cpuset_init failed\n");
339 td_verror(td, ret, "fio_cpuset_init");
340 return 1;
341 }
342
Jens Axboec00a2282011-07-08 20:56:06 +0200343 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200344
Jens Axboe62a72732008-12-08 11:37:01 +0100345 for (i = 0; i < sizeof(int) * 8; i++) {
346 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100347 if (i > max_cpu) {
348 log_err("fio: CPU %d too large (max=%ld)\n", i,
349 max_cpu);
350 return 1;
351 }
Jens Axboe62a72732008-12-08 11:37:01 +0100352 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100353 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100354 }
355 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200356
Jens Axboe375b2692007-05-22 09:13:02 +0200357 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100358 return 0;
359}
360
Jens Axboee8462bd2009-07-06 12:59:04 +0200361static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
362 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200363{
Jens Axboed2e268b2007-06-15 10:33:49 +0200364 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100365 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100366 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200367
Jens Axboee8462bd2009-07-06 12:59:04 +0200368 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100369 if (ret < 0) {
370 log_err("fio: cpuset_init failed\n");
371 td_verror(td, ret, "fio_cpuset_init");
372 return 1;
373 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200374
375 p = str = strdup(input);
376
377 strip_blank_front(&str);
378 strip_blank_end(str);
379
Jens Axboec00a2282011-07-08 20:56:06 +0200380 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100381
Jens Axboed2e268b2007-06-15 10:33:49 +0200382 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100383 char *str2, *cpu2;
384 int icpu, icpu2;
385
Jens Axboed2e268b2007-06-15 10:33:49 +0200386 if (!strlen(cpu))
387 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100388
389 str2 = cpu;
390 icpu2 = -1;
391 while ((cpu2 = strsep(&str2, "-")) != NULL) {
392 if (!strlen(cpu2))
393 break;
394
395 icpu2 = atoi(cpu2);
396 }
397
398 icpu = atoi(cpu);
399 if (icpu2 == -1)
400 icpu2 = icpu;
401 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100402 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100403 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100404 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100405 ret = 1;
406 break;
407 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100408 if (icpu > max_cpu) {
409 log_err("fio: CPU %d too large (max=%ld)\n",
410 icpu, max_cpu);
411 ret = 1;
412 break;
413 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200414
Jens Axboe62a72732008-12-08 11:37:01 +0100415 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200416 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100417 icpu++;
418 }
Jens Axboe19608d62008-12-08 15:03:12 +0100419 if (ret)
420 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200421 }
422
423 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100424 if (!ret)
425 td->o.cpumask_set = 1;
426 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200427}
Jens Axboee8462bd2009-07-06 12:59:04 +0200428
429static int str_cpus_allowed_cb(void *data, const char *input)
430{
431 struct thread_data *td = data;
432 int ret;
433
434 ret = set_cpus_allowed(td, &td->o.cpumask, input);
435 if (!ret)
436 td->o.cpumask_set = 1;
437
438 return ret;
439}
440
441static int str_verify_cpus_allowed_cb(void *data, const char *input)
442{
443 struct thread_data *td = data;
444 int ret;
445
446 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
447 if (!ret)
448 td->o.verify_cpumask_set = 1;
449
450 return ret;
451}
Jens Axboed2e268b2007-06-15 10:33:49 +0200452#endif
453
Jens Axboe0d29de82010-09-01 13:54:15 +0200454#ifdef FIO_HAVE_TRIM
455static int str_verify_trim_cb(void *data, unsigned long long *val)
456{
457 struct thread_data *td = data;
458
459 td->o.trim_percentage = *val;
460 return 0;
461}
462#endif
463
Jens Axboe214e1ec2007-03-15 10:48:13 +0100464static int str_fst_cb(void *data, const char *str)
465{
466 struct thread_data *td = data;
467 char *nr = get_opt_postfix(str);
468
469 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100470 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100471 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100472 free(nr);
473 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100474
475 return 0;
476}
477
Jens Axboe3ae06372010-03-19 19:17:15 +0100478#ifdef FIO_HAVE_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100479static int str_sfr_cb(void *data, const char *str)
480{
481 struct thread_data *td = data;
482 char *nr = get_opt_postfix(str);
483
484 td->sync_file_range_nr = 1;
485 if (nr) {
486 td->sync_file_range_nr = atoi(nr);
487 free(nr);
488 }
489
490 return 0;
491}
Jens Axboe3ae06372010-03-19 19:17:15 +0100492#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100493
Jens Axboe921c7662008-03-26 09:17:55 +0100494static int check_dir(struct thread_data *td, char *fname)
495{
Jens Axboe3f0ca9b2011-05-24 21:36:24 +0200496#if 0
Jens Axboe921c7662008-03-26 09:17:55 +0100497 char file[PATH_MAX], *dir;
Jens Axboebc838912008-04-07 09:00:54 +0200498 int elen = 0;
Jens Axboe921c7662008-03-26 09:17:55 +0100499
Jens Axboebc838912008-04-07 09:00:54 +0200500 if (td->o.directory) {
501 strcpy(file, td->o.directory);
Jens Axboefcef0b32008-05-26 14:53:24 +0200502 strcat(file, "/");
Jens Axboebc838912008-04-07 09:00:54 +0200503 elen = strlen(file);
504 }
505
Jens Axboefcef0b32008-05-26 14:53:24 +0200506 sprintf(file + elen, "%s", fname);
Jens Axboe921c7662008-03-26 09:17:55 +0100507 dir = dirname(file);
508
Jens Axboefcef0b32008-05-26 14:53:24 +0200509 {
510 struct stat sb;
511 /*
512 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
513 * yet, so we can't do this check right here...
514 */
Jens Axboe921c7662008-03-26 09:17:55 +0100515 if (lstat(dir, &sb) < 0) {
516 int ret = errno;
517
518 log_err("fio: %s is not a directory\n", dir);
519 td_verror(td, ret, "lstat");
520 return 1;
521 }
522
523 if (!S_ISDIR(sb.st_mode)) {
524 log_err("fio: %s is not a directory\n", dir);
525 return 1;
526 }
Jens Axboefcef0b32008-05-26 14:53:24 +0200527 }
528#endif
Jens Axboe921c7662008-03-26 09:17:55 +0100529
530 return 0;
531}
532
Jens Axboe8e827d32009-08-04 09:51:48 +0200533/*
534 * Return next file in the string. Files are separated with ':'. If the ':'
535 * is escaped with a '\', then that ':' is part of the filename and does not
536 * indicate a new file.
537 */
538static char *get_next_file_name(char **ptr)
539{
540 char *str = *ptr;
541 char *p, *start;
542
543 if (!str || !strlen(str))
544 return NULL;
545
546 start = str;
547 do {
548 /*
549 * No colon, we are done
550 */
551 p = strchr(str, ':');
552 if (!p) {
553 *ptr = NULL;
554 break;
555 }
556
557 /*
558 * We got a colon, but it's the first character. Skip and
559 * continue
560 */
561 if (p == start) {
562 str = ++start;
563 continue;
564 }
565
566 if (*(p - 1) != '\\') {
567 *p = '\0';
568 *ptr = p + 1;
569 break;
570 }
571
572 memmove(p - 1, p, strlen(p) + 1);
573 str = p;
574 } while (1);
575
576 return start;
577}
578
Jens Axboe214e1ec2007-03-15 10:48:13 +0100579static int str_filename_cb(void *data, const char *input)
580{
581 struct thread_data *td = data;
582 char *fname, *str, *p;
583
584 p = str = strdup(input);
585
586 strip_blank_front(&str);
587 strip_blank_end(str);
588
589 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100590 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100591
Jens Axboe8e827d32009-08-04 09:51:48 +0200592 while ((fname = get_next_file_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100593 if (!strlen(fname))
594 break;
Jens Axboe921c7662008-03-26 09:17:55 +0100595 if (check_dir(td, fname)) {
596 free(p);
597 return 1;
598 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100599 add_file(td, fname);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100600 td->o.nr_files++;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100601 }
602
603 free(p);
604 return 0;
605}
606
607static int str_directory_cb(void *data, const char fio_unused *str)
608{
609 struct thread_data *td = data;
610 struct stat sb;
611
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100612 if (lstat(td->o.directory, &sb) < 0) {
Jens Axboe921c7662008-03-26 09:17:55 +0100613 int ret = errno;
614
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100615 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe921c7662008-03-26 09:17:55 +0100616 td_verror(td, ret, "lstat");
Jens Axboe214e1ec2007-03-15 10:48:13 +0100617 return 1;
618 }
619 if (!S_ISDIR(sb.st_mode)) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100620 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100621 return 1;
622 }
623
624 return 0;
625}
626
627static int str_opendir_cb(void *data, const char fio_unused *str)
628{
629 struct thread_data *td = data;
630
631 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100632 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100633
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100634 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100635}
636
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400637static int str_verify_offset_cb(void *data, unsigned long long *off)
Shawn Lewis546a9142007-07-28 21:11:37 +0200638{
639 struct thread_data *td = data;
Jens Axboea59e1702007-07-30 08:53:27 +0200640
Shawn Lewis546a9142007-07-28 21:11:37 +0200641 if (*off && *off < sizeof(struct verify_header)) {
Jens Axboea59e1702007-07-30 08:53:27 +0200642 log_err("fio: verify_offset too small\n");
Shawn Lewis546a9142007-07-28 21:11:37 +0200643 return 1;
644 }
Jens Axboea59e1702007-07-30 08:53:27 +0200645
646 td->o.verify_offset = *off;
Shawn Lewis546a9142007-07-28 21:11:37 +0200647 return 0;
648}
649
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100650static int str_verify_pattern_cb(void *data, const char *input)
Jens Axboe90059d62007-07-30 09:33:12 +0200651{
652 struct thread_data *td = data;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100653 long off;
654 int i = 0, j = 0, len, k, base = 10;
655 char* loc1, * loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200656
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100657 loc1 = strstr(input, "0x");
658 loc2 = strstr(input, "0X");
659 if (loc1 || loc2)
660 base = 16;
661 off = strtol(input, NULL, base);
662 if (off != LONG_MAX || errno != ERANGE) {
663 while (off) {
664 td->o.verify_pattern[i] = off & 0xff;
665 off >>= 8;
666 i++;
667 }
668 } else {
669 len = strlen(input);
670 k = len - 1;
671 if (base == 16) {
672 if (loc1)
673 j = loc1 - input + 2;
674 else
675 j = loc2 - input + 2;
676 } else
677 return 1;
678 if (len - j < MAX_PATTERN_SIZE * 2) {
679 while (k >= j) {
680 off = converthexchartoint(input[k--]);
681 if (k >= j)
682 off += (converthexchartoint(input[k--])
683 * 16);
684 td->o.verify_pattern[i++] = (char) off;
685 }
686 }
687 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100688
689 /*
690 * Fill the pattern all the way to the end. This greatly reduces
691 * the number of memcpy's we have to do when verifying the IO.
692 */
693 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
694 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
695 i *= 2;
696 }
Steven Lang9a2a86d2012-02-07 09:42:59 +0100697 if (i == 1) {
698 /*
699 * The code in verify_io_u_pattern assumes a single byte pattern
700 * fills the whole verify pattern buffer.
701 */
702 memset(td->o.verify_pattern, td->o.verify_pattern[0],
703 MAX_PATTERN_SIZE);
704 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100705
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100706 td->o.verify_pattern_bytes = i;
Steven Langefcd9dc2012-02-02 20:22:04 +0100707
Jens Axboe92bf48d2011-01-14 21:20:42 +0100708 /*
709 * VERIFY_META could already be set
710 */
711 if (td->o.verify == VERIFY_NONE)
712 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +0100713
Jens Axboe90059d62007-07-30 09:33:12 +0200714 return 0;
715}
Jens Axboe214e1ec2007-03-15 10:48:13 +0100716
Jens Axboe4d4e80f2008-03-04 10:18:56 +0100717static int str_lockfile_cb(void *data, const char *str)
718{
719 struct thread_data *td = data;
720 char *nr = get_opt_postfix(str);
721
722 td->o.lockfile_batch = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100723 if (nr) {
Jens Axboe4d4e80f2008-03-04 10:18:56 +0100724 td->o.lockfile_batch = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100725 free(nr);
726 }
Jens Axboe4d4e80f2008-03-04 10:18:56 +0100727
728 return 0;
729}
730
Jens Axboee3cedca2008-11-19 19:57:52 +0100731static int str_write_bw_log_cb(void *data, const char *str)
732{
733 struct thread_data *td = data;
734
735 if (str)
736 td->o.bw_log_file = strdup(str);
737
738 td->o.write_bw_log = 1;
739 return 0;
740}
741
742static int str_write_lat_log_cb(void *data, const char *str)
743{
744 struct thread_data *td = data;
745
746 if (str)
747 td->o.lat_log_file = strdup(str);
748
749 td->o.write_lat_log = 1;
750 return 0;
751}
752
Jens Axboec8eeb9d2011-10-05 14:02:22 +0200753static int str_write_iops_log_cb(void *data, const char *str)
754{
755 struct thread_data *td = data;
756
757 if (str)
758 td->o.iops_log_file = strdup(str);
759
760 td->o.write_iops_log = 1;
761 return 0;
762}
763
Jens Axboe993bf482008-11-14 13:04:53 +0100764static int str_gtod_reduce_cb(void *data, int *il)
765{
766 struct thread_data *td = data;
767 int val = *il;
768
Jens Axboe02af0982010-06-24 09:59:34 +0200769 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +0100770 td->o.disable_clat = !!val;
771 td->o.disable_slat = !!val;
772 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +0200773 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +0100774 if (val)
775 td->tv_cache_mask = 63;
776
777 return 0;
778}
779
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400780static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +0100781{
782 struct thread_data *td = data;
783 int val = *il;
784
785 td->o.gtod_cpu = val;
786 td->o.gtod_offload = 1;
787 return 0;
788}
789
Jens Axboe7bb59102011-07-12 19:47:03 +0200790static int str_size_cb(void *data, unsigned long long *__val)
791{
792 struct thread_data *td = data;
793 unsigned long long v = *__val;
794
795 if (parse_is_percent(v)) {
796 td->o.size = 0;
797 td->o.size_percent = -1ULL - v;
798 } else
799 td->o.size = v;
800
801 return 0;
802}
803
Jens Axboe896cac22009-07-01 10:38:35 +0200804static int rw_verify(struct fio_option *o, void *data)
805{
806 struct thread_data *td = data;
807
808 if (read_only && td_write(td)) {
809 log_err("fio: job <%s> has write bit set, but fio is in"
810 " read-only mode\n", td->o.name);
811 return 1;
812 }
813
814 return 0;
815}
816
Jens Axboe276ca4f2009-07-01 10:43:05 +0200817static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +0200818{
Jens Axboe276ca4f2009-07-01 10:43:05 +0200819#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +0200820 struct thread_data *td = data;
821
Jens Axboe29d43ff2009-07-01 10:42:18 +0200822 if (td->o.gtod_cpu) {
823 log_err("fio: platform must support CPU affinity for"
824 "gettimeofday() offloading\n");
825 return 1;
826 }
827#endif
828
829 return 0;
830}
831
Jens Axboe90fef2d2009-07-17 22:33:32 +0200832static int kb_base_verify(struct fio_option *o, void *data)
833{
834 struct thread_data *td = data;
835
836 if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
837 log_err("fio: kb_base set to nonsensical value: %u\n",
838 td->o.kb_base);
839 return 1;
840 }
841
842 return 0;
843}
844
Jens Axboe214e1ec2007-03-15 10:48:13 +0100845/*
Jens Axboe9af4a242012-03-16 10:13:49 +0100846 * Option grouping
847 */
848static struct opt_group fio_opt_groups[] = {
849 {
Jens Axboee8b0e952012-03-19 14:37:08 +0100850 .name = "General",
851 .mask = FIO_OPT_C_GENERAL,
852 },
853 {
854 .name = "I/O",
855 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +0100856 },
857 {
858 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +0100859 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +0100860 },
861 {
Jens Axboee8b0e952012-03-19 14:37:08 +0100862 .name = "Statistics",
863 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +0100864 },
865 {
Jens Axboee8b0e952012-03-19 14:37:08 +0100866 .name = "Logging",
867 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +0100868 },
869 {
870 .name = NULL,
871 },
872};
873
Jens Axboee8b0e952012-03-19 14:37:08 +0100874static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
875 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +0100876{
877 struct opt_group *og;
878 int i;
879
Jens Axboee8b0e952012-03-19 14:37:08 +0100880 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +0100881 return NULL;
882
Jens Axboee8b0e952012-03-19 14:37:08 +0100883 for (i = 0; ogs[i].name; i++) {
884 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +0100885
886 if (*mask & og->mask) {
887 *mask &= ~(og->mask);
888 return og;
889 }
890 }
891
892 return NULL;
893}
894
Jens Axboee8b0e952012-03-19 14:37:08 +0100895struct opt_group *opt_group_from_mask(unsigned int *mask)
896{
897 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
898}
899
900static struct opt_group fio_opt_cat_groups[] = {
901 {
902 .name = "Rate",
903 .mask = FIO_OPT_G_RATE,
904 },
905 {
906 .name = "Zone",
907 .mask = FIO_OPT_G_ZONE,
908 },
909 {
910 .name = "Read/write mix",
911 .mask = FIO_OPT_G_RWMIX,
912 },
913 {
914 .name = "Verify",
915 .mask = FIO_OPT_G_VERIFY,
916 },
917 {
918 .name = "Trim",
919 .mask = FIO_OPT_G_TRIM,
920 },
921 {
922 .name = "I/O Logging",
923 .mask = FIO_OPT_G_IOLOG,
924 },
925 {
926 .name = "I/O Depth",
927 .mask = FIO_OPT_G_IO_DEPTH,
928 },
929 {
930 .name = "I/O Flow",
931 .mask = FIO_OPT_G_IO_FLOW,
932 },
933 {
Jens Axboe06260372012-03-19 15:16:08 +0100934 .name = "Description",
935 .mask = FIO_OPT_G_DESC,
936 },
937 {
938 .name = "Filename",
939 .mask = FIO_OPT_G_FILENAME,
940 },
941 {
942 .name = "General I/O",
943 .mask = FIO_OPT_G_IO_BASIC,
944 },
945 {
Jens Axboee8b0e952012-03-19 14:37:08 +0100946 .name = NULL,
947 }
948};
949
950struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
951{
952 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
953}
954
Jens Axboe9af4a242012-03-16 10:13:49 +0100955/*
Jens Axboe214e1ec2007-03-15 10:48:13 +0100956 * Map of job/command line options
957 */
Jens Axboe9af4a242012-03-16 10:13:49 +0100958struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100959 {
960 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +0100961 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100962 .type = FIO_OPT_STR_STORE,
963 .off1 = td_var_offset(description),
964 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +0100965 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +0100966 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100967 },
968 {
969 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +0100970 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100971 .type = FIO_OPT_STR_STORE,
972 .off1 = td_var_offset(name),
973 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +0100974 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +0100975 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100976 },
977 {
Jens Axboe90fef2d2009-07-17 22:33:32 +0200978 .name = "kb_base",
Jens Axboee8b0e952012-03-19 14:37:08 +0100979 .lname = "KB Base",
Jens Axboe90fef2d2009-07-17 22:33:32 +0200980 .type = FIO_OPT_INT,
981 .off1 = td_var_offset(kb_base),
Jens Axboe90fef2d2009-07-17 22:33:32 +0200982 .verify = kb_base_verify,
Jens Axboea639f0b2009-07-18 08:25:35 +0200983 .prio = 1,
Jens Axboe90fef2d2009-07-17 22:33:32 +0200984 .def = "1024",
Jens Axboea639f0b2009-07-18 08:25:35 +0200985 .help = "How many bytes per KB for reporting (1000 or 1024)",
Jens Axboee8b0e952012-03-19 14:37:08 +0100986 .category = FIO_OPT_C_GENERAL,
987 .group = FIO_OPT_G_INVALID,
988 },
989 {
990 .name = "filename",
991 .lname = "Filename(s)",
992 .type = FIO_OPT_STR_STORE,
993 .off1 = td_var_offset(filename),
994 .cb = str_filename_cb,
995 .prio = -1, /* must come after "directory" */
996 .help = "File(s) to use for the workload",
997 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +0100998 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +0100999 },
1000 {
1001 .name = "directory",
1002 .lname = "Directory",
1003 .type = FIO_OPT_STR_STORE,
1004 .off1 = td_var_offset(directory),
1005 .cb = str_directory_cb,
1006 .help = "Directory to store files in",
1007 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001008 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001009 },
1010 {
Jens Axboe29c13492008-03-01 19:25:20 +01001011 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001012 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001013 .type = FIO_OPT_STR,
1014 .cb = str_lockfile_cb,
1015 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001016 .help = "Lock file when doing IO to it",
1017 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001018 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001019 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01001020 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001021 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001022 .posval = {
1023 { .ival = "none",
1024 .oval = FILE_LOCK_NONE,
1025 .help = "No file locking",
1026 },
1027 { .ival = "exclusive",
1028 .oval = FILE_LOCK_EXCLUSIVE,
1029 .help = "Exclusive file lock",
1030 },
1031 {
1032 .ival = "readwrite",
1033 .oval = FILE_LOCK_READWRITE,
1034 .help = "Read vs write lock",
1035 },
1036 },
Jens Axboe29c13492008-03-01 19:25:20 +01001037 },
1038 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001039 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001040 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001041 .type = FIO_OPT_STR_STORE,
1042 .off1 = td_var_offset(opendir),
1043 .cb = str_opendir_cb,
1044 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001045 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001046 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001047 },
1048 {
1049 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001050 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001051 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001052 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001053 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001054 .off1 = td_var_offset(td_ddir),
1055 .help = "IO direction",
1056 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001057 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001058 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001059 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001060 .posval = {
1061 { .ival = "read",
1062 .oval = TD_DDIR_READ,
1063 .help = "Sequential read",
1064 },
1065 { .ival = "write",
1066 .oval = TD_DDIR_WRITE,
1067 .help = "Sequential write",
1068 },
1069 { .ival = "randread",
1070 .oval = TD_DDIR_RANDREAD,
1071 .help = "Random read",
1072 },
1073 { .ival = "randwrite",
1074 .oval = TD_DDIR_RANDWRITE,
1075 .help = "Random write",
1076 },
1077 { .ival = "rw",
1078 .oval = TD_DDIR_RW,
1079 .help = "Sequential read and write mix",
1080 },
1081 { .ival = "randrw",
1082 .oval = TD_DDIR_RANDRW,
1083 .help = "Random read and write mix"
1084 },
1085 },
1086 },
1087 {
Jens Axboe38dad622010-07-20 14:46:00 -06001088 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001089 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001090 .type = FIO_OPT_STR,
1091 .off1 = td_var_offset(rw_seq),
1092 .help = "IO offset generator modifier",
1093 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001094 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001095 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001096 .posval = {
1097 { .ival = "sequential",
1098 .oval = RW_SEQ_SEQ,
1099 .help = "Generate sequential offsets",
1100 },
1101 { .ival = "identical",
1102 .oval = RW_SEQ_IDENT,
1103 .help = "Generate identical offsets",
1104 },
1105 },
1106 },
1107
1108 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001109 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001110 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001111 .type = FIO_OPT_STR_STORE,
1112 .off1 = td_var_offset(ioengine),
1113 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001114 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001115 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001116 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001117 .posval = {
1118 { .ival = "sync",
1119 .help = "Use read/write",
1120 },
gurudas paia31041e2007-10-23 15:12:30 +02001121 { .ival = "psync",
1122 .help = "Use pread/pwrite",
1123 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001124 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001125 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001126 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001127#ifdef FIO_HAVE_LIBAIO
1128 { .ival = "libaio",
1129 .help = "Linux native asynchronous IO",
1130 },
1131#endif
1132#ifdef FIO_HAVE_POSIXAIO
1133 { .ival = "posixaio",
1134 .help = "POSIX asynchronous IO",
1135 },
1136#endif
Jens Axboe417f0062008-06-02 11:59:30 +02001137#ifdef FIO_HAVE_SOLARISAIO
1138 { .ival = "solarisaio",
1139 .help = "Solaris native asynchronous IO",
1140 },
1141#endif
Bruce Cran03e20d62011-01-02 20:14:54 +01001142#ifdef FIO_HAVE_WINDOWSAIO
1143 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001144 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001145 },
Jens Axboe3be80072011-01-19 11:07:28 -07001146#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001147 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001148 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001149 },
1150#ifdef FIO_HAVE_SPLICE
1151 { .ival = "splice",
1152 .help = "splice/vmsplice based IO",
1153 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001154 { .ival = "netsplice",
1155 .help = "splice/vmsplice to/from the network",
1156 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001157#endif
1158#ifdef FIO_HAVE_SGIO
1159 { .ival = "sg",
1160 .help = "SCSI generic v3 IO",
1161 },
1162#endif
1163 { .ival = "null",
1164 .help = "Testing engine (no data transfer)",
1165 },
1166 { .ival = "net",
1167 .help = "Network IO",
1168 },
1169#ifdef FIO_HAVE_SYSLET
1170 { .ival = "syslet-rw",
1171 .help = "syslet enabled async pread/pwrite IO",
1172 },
1173#endif
1174 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001175 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001176 },
Jens Axboeb8c82a42007-03-21 08:48:26 +01001177#ifdef FIO_HAVE_GUASI
1178 { .ival = "guasi",
1179 .help = "GUASI IO engine",
1180 },
1181#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001182#ifdef FIO_HAVE_BINJECT
1183 { .ival = "binject",
1184 .help = "binject direct inject block engine",
1185 },
1186#endif
ren yufei21b8aee2011-08-01 10:01:57 +02001187#ifdef FIO_HAVE_RDMA
1188 { .ival = "rdma",
1189 .help = "RDMA IO engine",
1190 },
1191#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001192 { .ival = "external",
1193 .help = "Load external engine (append name)",
1194 },
1195 },
1196 },
1197 {
1198 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001199 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001200 .type = FIO_OPT_INT,
1201 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001202 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001203 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001204 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001205 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001206 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001207 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001208 },
1209 {
1210 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001211 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001212 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001213 .type = FIO_OPT_INT,
1214 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001215 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001216 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001217 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001218 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001219 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001220 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001221 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001222 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001223 },
1224 {
Jens Axboe49504212008-06-05 09:03:30 +02001225 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001226 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001227 .type = FIO_OPT_INT,
1228 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001229 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001230 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001231 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001232 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001233 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001234 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001235 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001236 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001237 },
1238 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001239 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001240 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001241 .type = FIO_OPT_INT,
1242 .off1 = td_var_offset(iodepth_low),
1243 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001244 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001245 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001246 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001247 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001248 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001249 },
1250 {
1251 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001252 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001253 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001254 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001255 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001256 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001257 .category = FIO_OPT_C_IO,
1258 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001259 },
1260 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001261 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001262 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001263 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001264 .type = FIO_OPT_BOOL,
1265 .off1 = td_var_offset(fill_device),
1266 .help = "Write until an ENOSPC error occurs",
1267 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001268 .category = FIO_OPT_C_FILE,
1269 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001270 },
1271 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001272 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001273 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001274 .type = FIO_OPT_STR_VAL,
1275 .off1 = td_var_offset(file_size_low),
1276 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001277 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001278 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001279 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001280 .category = FIO_OPT_C_FILE,
1281 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001282 },
1283 {
Jens Axboe67a10002007-07-31 23:12:16 +02001284 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001285 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001286 .alias = "fileoffset",
1287 .type = FIO_OPT_STR_VAL,
1288 .off1 = td_var_offset(start_offset),
1289 .help = "Start IO from this offset",
1290 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001291 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001292 .category = FIO_OPT_C_IO,
1293 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001294 },
1295 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001296 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001297 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001298 .type = FIO_OPT_STR_VAL,
1299 .off1 = td_var_offset(offset_increment),
1300 .help = "What is the increment from one offset to the next",
1301 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001302 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001303 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001304 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001305 .category = FIO_OPT_C_IO,
1306 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001307 },
1308 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001309 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001310 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001311 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001312 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001313 .off1 = td_var_offset(bs[DDIR_READ]),
1314 .off2 = td_var_offset(bs[DDIR_WRITE]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001315 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001316 .help = "Block size unit",
1317 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001318 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001319 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001320 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001321 .category = FIO_OPT_C_IO,
1322 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001323 },
1324 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001325 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001326 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001327 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001328 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001329 .off1 = td_var_offset(ba[DDIR_READ]),
1330 .off2 = td_var_offset(ba[DDIR_WRITE]),
1331 .minval = 1,
1332 .help = "IO block offset alignment",
1333 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001334 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001335 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001336 .category = FIO_OPT_C_IO,
1337 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001338 },
1339 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001340 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001341 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001342 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001343 .type = FIO_OPT_RANGE,
1344 .off1 = td_var_offset(min_bs[DDIR_READ]),
1345 .off2 = td_var_offset(max_bs[DDIR_READ]),
1346 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1347 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001348 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001349 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001350 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001351 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001352 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001353 .category = FIO_OPT_C_IO,
1354 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001355 },
1356 {
Jens Axboe564ca972007-12-14 12:21:19 +01001357 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001358 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001359 .type = FIO_OPT_STR,
1360 .cb = str_bssplit_cb,
1361 .help = "Set a specific mix of block sizes",
1362 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001363 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001364 .category = FIO_OPT_C_IO,
1365 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001366 },
1367 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001368 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001369 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001370 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001371 .type = FIO_OPT_STR_SET,
1372 .off1 = td_var_offset(bs_unaligned),
1373 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001374 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001375 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001376 .category = FIO_OPT_C_IO,
1377 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001378 },
1379 {
1380 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001381 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001382 .type = FIO_OPT_BOOL,
1383 .off1 = td_var_offset(rand_repeatable),
1384 .help = "Use repeatable random IO pattern",
1385 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001386 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001387 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001388 .category = FIO_OPT_C_IO,
1389 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001390 },
1391 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001392 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001393 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001394 .type = FIO_OPT_BOOL,
1395 .off1 = td_var_offset(use_os_rand),
1396 .help = "Set to use OS random generator",
1397 .def = "0",
1398 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001399 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001400 .category = FIO_OPT_C_IO,
1401 .group = FIO_OPT_G_INVALID,
Jens Axboe2615cc42011-03-28 09:35:09 +02001402 },
1403 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001404 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001405 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001406 .type = FIO_OPT_STR_SET,
1407 .off1 = td_var_offset(norandommap),
1408 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001409 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001410 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001411 .category = FIO_OPT_C_IO,
1412 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001413 },
1414 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001415 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001416 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001417 .type = FIO_OPT_BOOL,
1418 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001419 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001420 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001421 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001422 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001423 .category = FIO_OPT_C_IO,
1424 .group = FIO_OPT_G_INVALID,
Jens Axboe2b386d22008-03-26 10:32:57 +01001425 },
1426 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001427 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001428 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001429 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001430 .type = FIO_OPT_INT,
1431 .off1 = td_var_offset(nr_files),
1432 .help = "Split job workload between this number of files",
1433 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001434 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001435 .category = FIO_OPT_C_FILE,
1436 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001437 },
1438 {
1439 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001440 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001441 .type = FIO_OPT_INT,
1442 .off1 = td_var_offset(open_files),
1443 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001444 .category = FIO_OPT_C_FILE,
1445 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001446 },
1447 {
1448 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001449 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001450 .type = FIO_OPT_STR,
1451 .cb = str_fst_cb,
1452 .off1 = td_var_offset(file_service_type),
1453 .help = "How to select which file to service next",
1454 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001455 .category = FIO_OPT_C_FILE,
1456 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001457 .posval = {
1458 { .ival = "random",
1459 .oval = FIO_FSERVICE_RANDOM,
1460 .help = "Choose a file at random",
1461 },
1462 { .ival = "roundrobin",
1463 .oval = FIO_FSERVICE_RR,
1464 .help = "Round robin select files",
1465 },
Jens Axboea086c252009-03-04 08:27:37 +01001466 { .ival = "sequential",
1467 .oval = FIO_FSERVICE_SEQ,
1468 .help = "Finish one file before moving to the next",
1469 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001470 },
Jens Axboe67a10002007-07-31 23:12:16 +02001471 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001472 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001473 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001474#ifdef FIO_HAVE_FALLOCATE
1475 {
1476 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001477 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001478 .type = FIO_OPT_STR,
1479 .off1 = td_var_offset(fallocate_mode),
1480 .help = "Whether pre-allocation is performed when laying out files",
1481 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001482 .category = FIO_OPT_C_FILE,
1483 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001484 .posval = {
1485 { .ival = "none",
1486 .oval = FIO_FALLOCATE_NONE,
1487 .help = "Do not pre-allocate space",
1488 },
1489 { .ival = "posix",
1490 .oval = FIO_FALLOCATE_POSIX,
1491 .help = "Use posix_fallocate()",
1492 },
1493#ifdef FIO_HAVE_LINUX_FALLOCATE
1494 { .ival = "keep",
1495 .oval = FIO_FALLOCATE_KEEP_SIZE,
1496 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1497 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001498#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001499 /* Compatibility with former boolean values */
1500 { .ival = "0",
1501 .oval = FIO_FALLOCATE_NONE,
1502 .help = "Alias for 'none'",
1503 },
1504 { .ival = "1",
1505 .oval = FIO_FALLOCATE_POSIX,
1506 .help = "Alias for 'posix'",
1507 },
1508 },
1509 },
1510#endif /* FIO_HAVE_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001511 {
1512 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01001513 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001514 .type = FIO_OPT_BOOL,
1515 .off1 = td_var_offset(fadvise_hint),
1516 .help = "Use fadvise() to advise the kernel on IO pattern",
1517 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001518 .category = FIO_OPT_C_FILE,
1519 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001520 },
1521 {
1522 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001523 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001524 .type = FIO_OPT_INT,
1525 .off1 = td_var_offset(fsync_blocks),
1526 .help = "Issue fsync for writes every given number of blocks",
1527 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001528 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001529 .category = FIO_OPT_C_FILE,
1530 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001531 },
1532 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001533 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001534 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001535 .type = FIO_OPT_INT,
1536 .off1 = td_var_offset(fdatasync_blocks),
1537 .help = "Issue fdatasync for writes every given number of blocks",
1538 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001539 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001540 .category = FIO_OPT_C_FILE,
1541 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001542 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001543 {
1544 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01001545 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001546 .type = FIO_OPT_INT,
1547 .off1 = td_var_offset(barrier_blocks),
1548 .help = "Make every Nth write a barrier write",
1549 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001550 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001551 .category = FIO_OPT_C_IO,
1552 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001553 },
Jens Axboe44f29692010-03-09 20:09:44 +01001554#ifdef FIO_HAVE_SYNC_FILE_RANGE
1555 {
1556 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01001557 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01001558 .posval = {
1559 { .ival = "wait_before",
1560 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1561 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001562 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001563 },
1564 { .ival = "write",
1565 .oval = SYNC_FILE_RANGE_WRITE,
1566 .help = "SYNC_FILE_RANGE_WRITE",
Jens Axboe3843deb2010-03-09 20:41:15 +01001567 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001568 },
1569 {
1570 .ival = "wait_after",
1571 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1572 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Jens Axboe3843deb2010-03-09 20:41:15 +01001573 .or = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01001574 },
1575 },
Jens Axboe3843deb2010-03-09 20:41:15 +01001576 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01001577 .cb = str_sfr_cb,
1578 .off1 = td_var_offset(sync_file_range),
1579 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01001580 .category = FIO_OPT_C_FILE,
1581 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01001582 },
1583#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02001584 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001585 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01001586 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001587 .type = FIO_OPT_BOOL,
1588 .off1 = td_var_offset(odirect),
1589 .help = "Use O_DIRECT IO (negates buffered)",
1590 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001591 .category = FIO_OPT_C_IO,
1592 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001593 },
1594 {
1595 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01001596 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001597 .type = FIO_OPT_BOOL,
1598 .off1 = td_var_offset(odirect),
1599 .neg = 1,
1600 .help = "Use buffered IO (negates direct)",
1601 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001602 .category = FIO_OPT_C_IO,
1603 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001604 },
1605 {
1606 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01001607 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001608 .type = FIO_OPT_BOOL,
1609 .off1 = td_var_offset(overwrite),
1610 .help = "When writing, set whether to overwrite current data",
1611 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001612 .category = FIO_OPT_C_FILE,
1613 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001614 },
1615 {
1616 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01001617 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001618 .type = FIO_OPT_INT,
1619 .off1 = td_var_offset(loops),
1620 .help = "Number of times to run the job",
1621 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001622 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001623 .category = FIO_OPT_C_GENERAL,
1624 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001625 },
1626 {
1627 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001628 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001629 .type = FIO_OPT_INT,
1630 .off1 = td_var_offset(numjobs),
1631 .help = "Duplicate this job this many times",
1632 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001633 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001634 .category = FIO_OPT_C_GENERAL,
1635 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001636 },
1637 {
1638 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01001639 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02001640 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001641 .off1 = td_var_offset(start_delay),
1642 .help = "Only start job when this period has passed",
1643 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001644 .category = FIO_OPT_C_GENERAL,
1645 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001646 },
1647 {
1648 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01001649 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001650 .alias = "timeout",
1651 .type = FIO_OPT_STR_VAL_TIME,
1652 .off1 = td_var_offset(timeout),
1653 .help = "Stop workload when this amount of time has passed",
1654 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001655 .category = FIO_OPT_C_GENERAL,
1656 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001657 },
1658 {
Jens Axboecf4464c2007-04-17 20:14:42 +02001659 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01001660 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02001661 .type = FIO_OPT_STR_SET,
1662 .off1 = td_var_offset(time_based),
1663 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01001664 .category = FIO_OPT_C_GENERAL,
1665 .group = FIO_OPT_G_INVALID,
Jens Axboecf4464c2007-04-17 20:14:42 +02001666 },
1667 {
Jens Axboe721938a2008-09-10 09:46:16 +02001668 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001669 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02001670 .type = FIO_OPT_STR_VAL_TIME,
1671 .off1 = td_var_offset(ramp_time),
1672 .help = "Ramp up time before measuring performance",
Jens Axboee8b0e952012-03-19 14:37:08 +01001673 .category = FIO_OPT_C_GENERAL,
1674 .group = FIO_OPT_G_INVALID,
Jens Axboe721938a2008-09-10 09:46:16 +02001675 },
1676 {
Jens Axboec223da82010-03-24 13:23:53 +01001677 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01001678 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01001679 .type = FIO_OPT_STR,
1680 .cb = fio_clock_source_cb,
1681 .off1 = td_var_offset(clocksource),
1682 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01001683 .category = FIO_OPT_C_GENERAL,
1684 .group = FIO_OPT_G_INVALID,
Jens Axboec223da82010-03-24 13:23:53 +01001685 .posval = {
1686 { .ival = "gettimeofday",
1687 .oval = CS_GTOD,
1688 .help = "Use gettimeofday(2) for timing",
1689 },
1690 { .ival = "clock_gettime",
1691 .oval = CS_CGETTIME,
1692 .help = "Use clock_gettime(2) for timing",
1693 },
1694#ifdef ARCH_HAVE_CPU_CLOCK
1695 { .ival = "cpu",
1696 .oval = CS_CPUCLOCK,
1697 .help = "Use CPU private clock",
1698 },
1699#endif
1700 },
1701 },
1702 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001703 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001704 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01001705 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001706 .type = FIO_OPT_STR,
1707 .cb = str_mem_cb,
1708 .off1 = td_var_offset(mem_type),
1709 .help = "Backing type for IO buffers",
1710 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01001711 .category = FIO_OPT_C_IO,
1712 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001713 .posval = {
1714 { .ival = "malloc",
1715 .oval = MEM_MALLOC,
1716 .help = "Use malloc(3) for IO buffers",
1717 },
Jens Axboeb370e462007-03-19 10:51:49 +01001718 { .ival = "shm",
1719 .oval = MEM_SHM,
1720 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001721 },
1722#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01001723 { .ival = "shmhuge",
1724 .oval = MEM_SHMHUGE,
1725 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001726 },
1727#endif
Jens Axboeb370e462007-03-19 10:51:49 +01001728 { .ival = "mmap",
1729 .oval = MEM_MMAP,
1730 .help = "Use mmap(2) (file or anon) for IO buffers",
1731 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01001732#ifdef FIO_HAVE_HUGETLB
1733 { .ival = "mmaphuge",
1734 .oval = MEM_MMAPHUGE,
1735 .help = "Like mmap, but use huge pages",
1736 },
1737#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001738 },
1739 },
1740 {
Jens Axboed529ee12009-07-01 10:33:03 +02001741 .name = "iomem_align",
1742 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01001743 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02001744 .type = FIO_OPT_INT,
1745 .off1 = td_var_offset(mem_align),
1746 .minval = 0,
1747 .help = "IO memory buffer offset alignment",
1748 .def = "0",
1749 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01001750 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001751 .category = FIO_OPT_C_IO,
1752 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02001753 },
1754 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001755 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01001756 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001757 .type = FIO_OPT_STR,
1758 .off1 = td_var_offset(verify),
1759 .help = "Verify data written",
Jens Axboe5d7c5d32010-06-21 15:08:17 +02001760 .cb = str_verify_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001761 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001762 .category = FIO_OPT_C_IO,
1763 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001764 .posval = {
1765 { .ival = "0",
1766 .oval = VERIFY_NONE,
1767 .help = "Don't do IO verification",
1768 },
Jens Axboefcca4b52007-07-27 15:42:00 +02001769 { .ival = "md5",
1770 .oval = VERIFY_MD5,
1771 .help = "Use md5 checksums for verification",
1772 },
Jens Axboed77a7af2007-07-27 15:35:06 +02001773 { .ival = "crc64",
1774 .oval = VERIFY_CRC64,
1775 .help = "Use crc64 checksums for verification",
1776 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001777 { .ival = "crc32",
1778 .oval = VERIFY_CRC32,
1779 .help = "Use crc32 checksums for verification",
1780 },
Jens Axboeaf497e62008-08-04 15:40:35 +02001781 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01001782 .oval = VERIFY_CRC32C,
1783 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02001784 },
Jens Axboebac39e02008-06-11 20:46:19 +02001785 { .ival = "crc32c",
1786 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01001787 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02001788 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02001789 { .ival = "crc16",
1790 .oval = VERIFY_CRC16,
1791 .help = "Use crc16 checksums for verification",
1792 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02001793 { .ival = "crc7",
1794 .oval = VERIFY_CRC7,
1795 .help = "Use crc7 checksums for verification",
1796 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02001797 { .ival = "sha1",
1798 .oval = VERIFY_SHA1,
1799 .help = "Use sha1 checksums for verification",
1800 },
Jens Axboecd14cc12007-07-30 10:59:33 +02001801 { .ival = "sha256",
1802 .oval = VERIFY_SHA256,
1803 .help = "Use sha256 checksums for verification",
1804 },
1805 { .ival = "sha512",
1806 .oval = VERIFY_SHA512,
1807 .help = "Use sha512 checksums for verification",
1808 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02001809 { .ival = "meta",
1810 .oval = VERIFY_META,
1811 .help = "Use io information",
1812 },
Jens Axboe36690c92007-03-26 10:23:34 +02001813 {
1814 .ival = "null",
1815 .oval = VERIFY_NULL,
1816 .help = "Pretend to verify",
1817 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001818 },
1819 },
1820 {
Jens Axboe005c5652007-08-02 22:21:36 +02001821 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01001822 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02001823 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02001824 .off1 = td_var_offset(do_verify),
1825 .help = "Run verification stage after write",
1826 .def = "1",
1827 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001828 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001829 .category = FIO_OPT_C_IO,
1830 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02001831 },
1832 {
Jens Axboe160b9662007-03-27 10:59:49 +02001833 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01001834 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02001835 .type = FIO_OPT_BOOL,
1836 .off1 = td_var_offset(verifysort),
1837 .help = "Sort written verify blocks for read back",
1838 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02001839 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001840 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001841 .category = FIO_OPT_C_IO,
1842 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02001843 },
1844 {
Jens Axboea59e1702007-07-30 08:53:27 +02001845 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01001846 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02001847 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02001848 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02001849 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02001850 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02001851 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001852 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001853 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01001854 .category = FIO_OPT_C_IO,
1855 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02001856 },
1857 {
Jens Axboea59e1702007-07-30 08:53:27 +02001858 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001859 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02001860 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02001861 .help = "Offset verify header location by N bytes",
Shawn Lewis546a9142007-07-28 21:11:37 +02001862 .def = "0",
Jens Axboe5ec10ea2008-03-06 15:42:00 +01001863 .cb = str_verify_offset_cb,
Jens Axboeafdf9352007-07-31 16:14:34 +02001864 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001865 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001866 .category = FIO_OPT_C_IO,
1867 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02001868 },
1869 {
Shawn Lewise28218f2008-01-16 11:01:33 +01001870 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01001871 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01001872 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01001873 .cb = str_verify_pattern_cb,
1874 .help = "Fill pattern for IO buffers",
1875 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001876 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001877 .category = FIO_OPT_C_IO,
1878 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01001879 },
1880 {
Jens Axboea12a3b42007-08-09 10:20:54 +02001881 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01001882 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02001883 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02001884 .off1 = td_var_offset(verify_fatal),
1885 .def = "0",
1886 .help = "Exit on a single verify failure, don't continue",
1887 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001888 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001889 .category = FIO_OPT_C_IO,
1890 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02001891 },
1892 {
Jens Axboeb463e932011-01-12 09:03:23 +01001893 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01001894 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01001895 .type = FIO_OPT_BOOL,
1896 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02001897 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01001898 .help = "Dump contents of good and bad blocks on failure",
1899 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001900 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001901 .category = FIO_OPT_C_IO,
1902 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01001903 },
1904 {
Jens Axboee8462bd2009-07-06 12:59:04 +02001905 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01001906 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02001907 .type = FIO_OPT_INT,
1908 .off1 = td_var_offset(verify_async),
1909 .def = "0",
1910 .help = "Number of async verifier threads to use",
1911 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001912 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001913 .category = FIO_OPT_C_IO,
1914 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02001915 },
Jens Axboe9e144182010-06-15 14:25:36 +02001916 {
1917 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01001918 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02001919 .type = FIO_OPT_STR_VAL,
1920 .off1 = td_var_offset(verify_backlog),
1921 .help = "Verify after this number of blocks are written",
1922 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001923 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001924 .category = FIO_OPT_C_IO,
1925 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02001926 },
1927 {
1928 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001929 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02001930 .type = FIO_OPT_INT,
1931 .off1 = td_var_offset(verify_batch),
1932 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02001933 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01001934 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001935 .category = FIO_OPT_C_IO,
1936 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02001937 },
Jens Axboee8462bd2009-07-06 12:59:04 +02001938#ifdef FIO_HAVE_CPU_AFFINITY
1939 {
1940 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01001941 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02001942 .type = FIO_OPT_STR,
1943 .cb = str_verify_cpus_allowed_cb,
1944 .help = "Set CPUs allowed for async verify threads",
1945 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01001946 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001947 .category = FIO_OPT_C_IO,
1948 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02001949 },
1950#endif
Jens Axboe0d29de82010-09-01 13:54:15 +02001951#ifdef FIO_HAVE_TRIM
1952 {
1953 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01001954 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02001955 .type = FIO_OPT_INT,
1956 .cb = str_verify_trim_cb,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001957 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02001958 .maxval = 100,
1959 .help = "Number of verify blocks to discard/trim",
1960 .parent = "verify",
1961 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001962 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01001963 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001964 .category = FIO_OPT_C_IO,
1965 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02001966 },
1967 {
1968 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01001969 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001970 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02001971 .help = "Verify that trim/discarded blocks are returned as zeroes",
1972 .off1 = td_var_offset(trim_zero),
1973 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01001974 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02001975 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001976 .category = FIO_OPT_C_IO,
1977 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02001978 },
1979 {
1980 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01001981 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02001982 .type = FIO_OPT_STR_VAL,
1983 .off1 = td_var_offset(trim_backlog),
1984 .help = "Trim after this number of blocks are written",
1985 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01001986 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001987 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001988 .category = FIO_OPT_C_IO,
1989 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02001990 },
1991 {
1992 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001993 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02001994 .type = FIO_OPT_INT,
1995 .off1 = td_var_offset(trim_batch),
1996 .help = "Trim this number of IO blocks",
1997 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01001998 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001999 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002000 .category = FIO_OPT_C_IO,
2001 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002002 },
2003#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002004 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002005 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002006 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002007 .type = FIO_OPT_STR_STORE,
2008 .off1 = td_var_offset(write_iolog_file),
2009 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002010 .category = FIO_OPT_C_IO,
2011 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002012 },
2013 {
2014 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002015 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002016 .type = FIO_OPT_STR_STORE,
2017 .off1 = td_var_offset(read_iolog_file),
2018 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002019 .category = FIO_OPT_C_IO,
2020 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002021 },
2022 {
David Nellans64bbb862010-08-24 22:13:30 +02002023 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002024 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002025 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002026 .off1 = td_var_offset(no_stall),
2027 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002028 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002029 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002030 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002031 .category = FIO_OPT_C_IO,
2032 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002033 },
2034 {
David Nellansd1c46c02010-08-31 21:20:47 +02002035 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002036 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002037 .type = FIO_OPT_STR_STORE,
2038 .off1 = td_var_offset(replay_redirect),
2039 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002040 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002041 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002042 .category = FIO_OPT_C_IO,
2043 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002044 },
2045 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002046 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002047 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002048 .type = FIO_OPT_STR_STORE,
2049 .off1 = td_var_offset(exec_prerun),
2050 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002051 .category = FIO_OPT_C_GENERAL,
2052 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002053 },
2054 {
2055 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002056 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002057 .type = FIO_OPT_STR_STORE,
2058 .off1 = td_var_offset(exec_postrun),
2059 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002060 .category = FIO_OPT_C_GENERAL,
2061 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002062 },
2063#ifdef FIO_HAVE_IOSCHED_SWITCH
2064 {
2065 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002066 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002067 .type = FIO_OPT_STR_STORE,
2068 .off1 = td_var_offset(ioscheduler),
2069 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002070 .category = FIO_OPT_C_FILE,
2071 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002072 },
2073#endif
2074 {
2075 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002076 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002077 .type = FIO_OPT_STR_VAL,
2078 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002079 .help = "Amount of data to read per zone",
2080 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002081 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002082 .category = FIO_OPT_C_IO,
2083 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002084 },
2085 {
2086 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002087 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002088 .type = FIO_OPT_STR_VAL,
2089 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002090 .help = "Give size of an IO zone",
2091 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002092 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002093 .category = FIO_OPT_C_IO,
2094 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002095 },
2096 {
2097 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002098 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002099 .type = FIO_OPT_STR_VAL,
2100 .off1 = td_var_offset(zone_skip),
2101 .help = "Space between IO zones",
2102 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002103 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002104 .category = FIO_OPT_C_IO,
2105 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002106 },
2107 {
2108 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002109 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002110 .type = FIO_OPT_STR_VAL,
2111 .cb = str_lockmem_cb,
2112 .help = "Lock down this amount of memory",
2113 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002114 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002115 .category = FIO_OPT_C_GENERAL,
2116 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002117 },
2118 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002119 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002120 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002121 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002122 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002123 .maxval = 100,
2124 .help = "Percentage of mixed workload that is reads",
2125 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002126 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01002127 .category = FIO_OPT_C_IO,
2128 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002129 },
2130 {
2131 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002132 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002133 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002134 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002135 .maxval = 100,
2136 .help = "Percentage of mixed workload that is writes",
2137 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002138 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01002139 .category = FIO_OPT_C_IO,
2140 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002141 },
2142 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002143 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002144 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002145 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002146 .category = FIO_OPT_C_IO,
2147 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002148 },
2149 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002150 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002151 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002152 .type = FIO_OPT_INT,
2153 .off1 = td_var_offset(nice),
2154 .help = "Set job CPU nice value",
2155 .minval = -19,
2156 .maxval = 20,
2157 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002158 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002159 .category = FIO_OPT_C_GENERAL,
2160 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002161 },
2162#ifdef FIO_HAVE_IOPRIO
2163 {
2164 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002165 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002166 .type = FIO_OPT_INT,
2167 .cb = str_prio_cb,
2168 .help = "Set job IO priority value",
2169 .minval = 0,
2170 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002171 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002172 .category = FIO_OPT_C_GENERAL,
2173 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002174 },
2175 {
2176 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002177 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002178 .type = FIO_OPT_INT,
2179 .cb = str_prioclass_cb,
2180 .help = "Set job IO priority class",
2181 .minval = 0,
2182 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002183 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002184 .category = FIO_OPT_C_GENERAL,
2185 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002186 },
2187#endif
2188 {
2189 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002190 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002191 .type = FIO_OPT_INT,
2192 .off1 = td_var_offset(thinktime),
2193 .help = "Idle time between IO buffers (usec)",
2194 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002195 .category = FIO_OPT_C_IO,
2196 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002197 },
2198 {
2199 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002200 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002201 .type = FIO_OPT_INT,
2202 .off1 = td_var_offset(thinktime_spin),
2203 .help = "Start think time by spinning this amount (usec)",
2204 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002205 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002206 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002207 .category = FIO_OPT_C_IO,
2208 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002209 },
2210 {
2211 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002212 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002213 .type = FIO_OPT_INT,
2214 .off1 = td_var_offset(thinktime_blocks),
2215 .help = "IO buffer period between 'thinktime'",
2216 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002217 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002218 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002219 .category = FIO_OPT_C_IO,
2220 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002221 },
2222 {
2223 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002224 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002225 .type = FIO_OPT_INT,
Jens Axboe581e7142009-06-09 12:47:16 +02002226 .off1 = td_var_offset(rate[0]),
2227 .off2 = td_var_offset(rate[1]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002228 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002231 },
2232 {
2233 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002234 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002235 .type = FIO_OPT_INT,
Jens Axboe581e7142009-06-09 12:47:16 +02002236 .off1 = td_var_offset(ratemin[0]),
2237 .off2 = td_var_offset(ratemin[1]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002238 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002239 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002240 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002241 .category = FIO_OPT_C_IO,
2242 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002243 },
2244 {
2245 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002246 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002247 .type = FIO_OPT_INT,
Jens Axboe581e7142009-06-09 12:47:16 +02002248 .off1 = td_var_offset(rate_iops[0]),
2249 .off2 = td_var_offset(rate_iops[1]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002250 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002251 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002252 .category = FIO_OPT_C_IO,
2253 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002254 },
2255 {
2256 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002257 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002258 .type = FIO_OPT_INT,
Jens Axboe581e7142009-06-09 12:47:16 +02002259 .off1 = td_var_offset(rate_iops_min[0]),
2260 .off2 = td_var_offset(rate_iops_min[1]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002261 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002262 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002263 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002264 .category = FIO_OPT_C_IO,
2265 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002266 },
2267 {
2268 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002269 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002270 .type = FIO_OPT_INT,
2271 .off1 = td_var_offset(ratecycle),
2272 .help = "Window average for rate limits (msec)",
2273 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002274 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002275 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002276 .category = FIO_OPT_C_IO,
2277 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002278 },
2279 {
2280 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002281 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002282 .type = FIO_OPT_BOOL,
2283 .off1 = td_var_offset(invalidate_cache),
2284 .help = "Invalidate buffer/page cache prior to running job",
2285 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002286 .category = FIO_OPT_C_IO,
2287 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002288 },
2289 {
2290 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002291 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002292 .type = FIO_OPT_BOOL,
2293 .off1 = td_var_offset(sync_io),
2294 .help = "Use O_SYNC for buffered writes",
2295 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002296 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002297 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002298 .category = FIO_OPT_C_IO,
2299 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002300 },
2301 {
2302 .name = "bwavgtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002303 .lname = "Bandwidth average time",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002304 .type = FIO_OPT_INT,
2305 .off1 = td_var_offset(bw_avg_time),
Jens Axboe5ec10ea2008-03-06 15:42:00 +01002306 .help = "Time window over which to calculate bandwidth"
2307 " (msec)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002308 .def = "500",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002309 .parent = "write_bw_log",
Jens Axboed71c1542012-03-16 20:16:59 +01002310 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002311 .interval = 100,
Jens Axboee8b0e952012-03-19 14:37:08 +01002312 .category = FIO_OPT_C_LOG,
2313 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002314 },
2315 {
2316 .name = "iopsavgtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002317 .lname = "IOPS average time",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002318 .type = FIO_OPT_INT,
2319 .off1 = td_var_offset(iops_avg_time),
2320 .help = "Time window over which to calculate IOPS (msec)",
2321 .def = "500",
2322 .parent = "write_iops_log",
Jens Axboed71c1542012-03-16 20:16:59 +01002323 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002324 .interval = 100,
Jens Axboee8b0e952012-03-19 14:37:08 +01002325 .category = FIO_OPT_C_LOG,
2326 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002327 },
2328 {
2329 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002330 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002331 .type = FIO_OPT_BOOL,
2332 .off1 = td_var_offset(create_serialize),
2333 .help = "Serialize creating of job files",
2334 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002335 .category = FIO_OPT_C_FILE,
2336 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002337 },
2338 {
2339 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002340 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002341 .type = FIO_OPT_BOOL,
2342 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002343 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002344 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002345 .category = FIO_OPT_C_FILE,
2346 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002347 },
2348 {
Jens Axboe814452b2009-03-04 12:53:13 +01002349 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002350 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002351 .type = FIO_OPT_BOOL,
2352 .off1 = td_var_offset(create_on_open),
2353 .help = "Create files when they are opened for IO",
2354 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002355 .category = FIO_OPT_C_FILE,
2356 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002357 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002358 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002359 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002360 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002361 .type = FIO_OPT_BOOL,
2362 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002363 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002364 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002365 .category = FIO_OPT_C_FILE,
2366 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002367 },
Jens Axboe814452b2009-03-04 12:53:13 +01002368 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002369 .name = "cpuload",
Jens Axboee8b0e952012-03-19 14:37:08 +01002370 .lname = "CPU load",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002371 .type = FIO_OPT_INT,
2372 .off1 = td_var_offset(cpuload),
2373 .help = "Use this percentage of CPU",
Jens Axboee8b0e952012-03-19 14:37:08 +01002374 .category = FIO_OPT_C_GENERAL,
2375 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002376 },
2377 {
2378 .name = "cpuchunks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002379 .lname = "CPU chunk",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002380 .type = FIO_OPT_INT,
2381 .off1 = td_var_offset(cpucycle),
2382 .help = "Length of the CPU burn cycles (usecs)",
2383 .def = "50000",
Jens Axboe67a10002007-07-31 23:12:16 +02002384 .parent = "cpuload",
Jens Axboed71c1542012-03-16 20:16:59 +01002385 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002386 .category = FIO_OPT_C_GENERAL,
2387 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002388 },
2389#ifdef FIO_HAVE_CPU_AFFINITY
2390 {
2391 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002392 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002393 .type = FIO_OPT_INT,
2394 .cb = str_cpumask_cb,
2395 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002396 .category = FIO_OPT_C_GENERAL,
2397 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002398 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002399 {
2400 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002401 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002402 .type = FIO_OPT_STR,
2403 .cb = str_cpus_allowed_cb,
2404 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002405 .category = FIO_OPT_C_GENERAL,
2406 .group = FIO_OPT_G_INVALID,
Jens Axboed2e268b2007-06-15 10:33:49 +02002407 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002408#endif
2409 {
2410 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002411 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002412 .type = FIO_OPT_BOOL,
2413 .off1 = td_var_offset(end_fsync),
2414 .help = "Include fsync at the end of job",
2415 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002416 .category = FIO_OPT_C_FILE,
2417 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002418 },
2419 {
2420 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01002421 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002422 .type = FIO_OPT_BOOL,
2423 .off1 = td_var_offset(fsync_on_close),
2424 .help = "fsync files on close",
2425 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002426 .category = FIO_OPT_C_FILE,
2427 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002428 },
2429 {
2430 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01002431 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002432 .type = FIO_OPT_BOOL,
2433 .off1 = td_var_offset(unlink),
2434 .help = "Unlink created files after job has completed",
2435 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002436 .category = FIO_OPT_C_FILE,
2437 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002438 },
2439 {
2440 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002441 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002442 .type = FIO_OPT_STR_SET,
2443 .cb = str_exitall_cb,
2444 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01002445 .category = FIO_OPT_C_GENERAL,
2446 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002447 },
2448 {
2449 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002450 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02002451 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002452 .type = FIO_OPT_STR_SET,
2453 .off1 = td_var_offset(stonewall),
2454 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01002455 .category = FIO_OPT_C_GENERAL,
2456 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002457 },
2458 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01002459 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01002460 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01002461 .type = FIO_OPT_STR_SET,
2462 .off1 = td_var_offset(new_group),
2463 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01002464 .category = FIO_OPT_C_GENERAL,
2465 .group = FIO_OPT_G_INVALID,
Jens Axboeb3d62a72007-03-20 14:23:26 +01002466 },
2467 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002468 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002469 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002470 .type = FIO_OPT_STR_SET,
2471 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002472 .help = "Use threads instead of processes",
Jens Axboee8b0e952012-03-19 14:37:08 +01002473 .category = FIO_OPT_C_GENERAL,
2474 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002475 },
2476 {
2477 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01002478 .lname = "Write bandwidth log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002479 .type = FIO_OPT_STR,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002480 .off1 = td_var_offset(write_bw_log),
Jens Axboee3cedca2008-11-19 19:57:52 +01002481 .cb = str_write_bw_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002482 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01002483 .category = FIO_OPT_C_LOG,
2484 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002485 },
2486 {
2487 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01002488 .lname = "Write latency log",
Jens Axboee3cedca2008-11-19 19:57:52 +01002489 .type = FIO_OPT_STR,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002490 .off1 = td_var_offset(write_lat_log),
Jens Axboee3cedca2008-11-19 19:57:52 +01002491 .cb = str_write_lat_log_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002492 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01002493 .category = FIO_OPT_C_LOG,
2494 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002495 },
2496 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002497 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01002498 .lname = "Write IOPS log",
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002499 .type = FIO_OPT_STR,
2500 .off1 = td_var_offset(write_iops_log),
2501 .cb = str_write_iops_log_cb,
2502 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01002503 .category = FIO_OPT_C_LOG,
2504 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02002505 },
2506 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002507 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01002508 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002509 .type = FIO_OPT_INT,
2510 .off1 = td_var_offset(log_avg_msec),
2511 .help = "Average bw/iops/lat logs over this period of time",
2512 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002513 .category = FIO_OPT_C_LOG,
2514 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01002515 },
2516 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002517 .name = "hugepage-size",
Jens Axboee8b0e952012-03-19 14:37:08 +01002518 .lname = "Hugepage size",
Jens Axboee01b22b2009-06-09 15:43:25 +02002519 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002520 .off1 = td_var_offset(hugepage_size),
2521 .help = "When using hugepages, specify size of each page",
Jens Axboe81179ee2011-10-04 12:42:06 +02002522 .def = __fio_stringify(FIO_HUGE_PAGE),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002523 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002524 .category = FIO_OPT_C_GENERAL,
2525 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002526 },
2527 {
2528 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01002529 .lname = "Group reporting",
2530 .type = FIO_OPT_BOOL,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002531 .off1 = td_var_offset(group_reporting),
2532 .help = "Do reporting on a per-group basis",
Jens Axboee8b0e952012-03-19 14:37:08 +01002533 .def = "1",
2534 .category = FIO_OPT_C_GENERAL,
2535 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002536 },
2537 {
Jens Axboee9459e52007-04-17 15:46:32 +02002538 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01002539 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02002540 .type = FIO_OPT_STR_SET,
2541 .off1 = td_var_offset(zero_buffers),
2542 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01002543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_INVALID,
Jens Axboee9459e52007-04-17 15:46:32 +02002545 },
Jens Axboe5973caf2008-05-21 19:52:35 +02002546 {
2547 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01002548 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02002549 .type = FIO_OPT_STR_SET,
2550 .off1 = td_var_offset(refill_buffers),
2551 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01002552 .category = FIO_OPT_C_IO,
2553 .group = FIO_OPT_G_INVALID,
Jens Axboe5973caf2008-05-21 19:52:35 +02002554 },
Yu-ju Hong83349192011-08-13 00:53:44 +02002555 {
Jens Axboefd684182011-09-19 09:24:44 +02002556 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01002557 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02002558 .type = FIO_OPT_BOOL,
2559 .off1 = td_var_offset(scramble_buffers),
2560 .help = "Slightly scramble buffers on every IO submit",
2561 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002562 .category = FIO_OPT_C_IO,
2563 .group = FIO_OPT_G_INVALID,
Jens Axboefd684182011-09-19 09:24:44 +02002564 },
2565 {
Jens Axboe9c426842012-03-02 21:02:12 +01002566 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002567 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01002568 .type = FIO_OPT_INT,
2569 .off1 = td_var_offset(compress_percentage),
2570 .maxval = 100,
2571 .minval = 1,
2572 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002573 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01002574 .category = FIO_OPT_C_IO,
2575 .group = FIO_OPT_G_INVALID,
Jens Axboe9c426842012-03-02 21:02:12 +01002576 },
2577 {
Jens Axboef97a43a2012-03-09 19:06:24 +01002578 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01002579 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01002580 .type = FIO_OPT_INT,
2581 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01002582 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002583 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01002584 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002585 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01002586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_INVALID,
Jens Axboef97a43a2012-03-09 19:06:24 +01002588 },
2589 {
Yu-ju Hong83349192011-08-13 00:53:44 +02002590 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01002591 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02002592 .type = FIO_OPT_BOOL,
2593 .off1 = td_var_offset(clat_percentiles),
2594 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02002595 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002596 .category = FIO_OPT_C_STAT,
2597 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002598 },
2599 {
2600 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01002601 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02002602 .type = FIO_OPT_FLOAT_LIST,
2603 .off1 = td_var_offset(percentile_list),
2604 .off2 = td_var_offset(overwrite_plist),
2605 .help = "Specify a custom list of percentiles to report",
2606 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2607 .minfp = 0.0,
2608 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01002609 .category = FIO_OPT_C_STAT,
2610 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02002611 },
2612
Jens Axboe0a839f32007-04-26 09:02:34 +02002613#ifdef FIO_HAVE_DISK_UTIL
2614 {
2615 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01002616 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02002617 .type = FIO_OPT_BOOL,
2618 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02002619 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02002620 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002621 .category = FIO_OPT_C_STAT,
2622 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02002623 },
2624#endif
Jens Axboee9459e52007-04-17 15:46:32 +02002625 {
Jens Axboe993bf482008-11-14 13:04:53 +01002626 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01002627 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01002628 .type = FIO_OPT_BOOL,
2629 .help = "Greatly reduce number of gettimeofday() calls",
2630 .cb = str_gtod_reduce_cb,
2631 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002632 .category = FIO_OPT_C_STAT,
2633 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01002634 },
2635 {
Jens Axboe02af0982010-06-24 09:59:34 +02002636 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01002637 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02002638 .type = FIO_OPT_BOOL,
2639 .off1 = td_var_offset(disable_lat),
2640 .help = "Disable latency numbers",
2641 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01002642 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02002643 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002644 .category = FIO_OPT_C_STAT,
2645 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02002646 },
2647 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02002648 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01002649 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02002650 .type = FIO_OPT_BOOL,
2651 .off1 = td_var_offset(disable_clat),
2652 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01002653 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01002654 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002655 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002656 .category = FIO_OPT_C_STAT,
2657 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002658 },
2659 {
2660 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01002661 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02002662 .type = FIO_OPT_BOOL,
2663 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01002664 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01002665 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01002666 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002667 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002668 .category = FIO_OPT_C_STAT,
2669 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002670 },
2671 {
2672 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01002673 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02002674 .type = FIO_OPT_BOOL,
2675 .off1 = td_var_offset(disable_bw),
2676 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01002677 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01002678 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002679 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002680 .category = FIO_OPT_C_STAT,
2681 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02002682 },
2683 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01002684 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01002685 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01002686 .type = FIO_OPT_INT,
2687 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01002688 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02002689 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01002690 .category = FIO_OPT_C_GENERAL,
2691 .group = FIO_OPT_G_INVALID,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01002692 },
2693 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02002694 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01002695 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01002696 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02002697 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01002698 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01002699 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01002700 .category = FIO_OPT_C_GENERAL,
2701 .group = FIO_OPT_G_INVALID,
Steven Lang06842022011-11-17 09:45:17 +01002702 .posval = {
2703 { .ival = "none",
2704 .oval = ERROR_TYPE_NONE,
2705 .help = "Exit when an error is encountered",
2706 },
2707 { .ival = "read",
2708 .oval = ERROR_TYPE_READ,
2709 .help = "Continue on read errors only",
2710 },
2711 { .ival = "write",
2712 .oval = ERROR_TYPE_WRITE,
2713 .help = "Continue on write errors only",
2714 },
2715 { .ival = "io",
2716 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
2717 .help = "Continue on any IO errors",
2718 },
2719 { .ival = "verify",
2720 .oval = ERROR_TYPE_VERIFY,
2721 .help = "Continue on verify errors only",
2722 },
2723 { .ival = "all",
2724 .oval = ERROR_TYPE_ANY,
2725 .help = "Continue on all io and verify errors",
2726 },
2727 { .ival = "0",
2728 .oval = ERROR_TYPE_NONE,
2729 .help = "Alias for 'none'",
2730 },
2731 { .ival = "1",
2732 .oval = ERROR_TYPE_ANY,
2733 .help = "Alias for 'all'",
2734 },
2735 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02002736 },
2737 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01002738 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01002739 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01002740 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01002741 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01002742 .help = "Select a specific builtin performance test",
Jens Axboee8b0e952012-03-19 14:37:08 +01002743 .category = FIO_OPT_C_GENERAL,
2744 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01002745 },
2746 {
Jens Axboea696fa22009-12-04 10:05:02 +01002747 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01002748 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01002749 .type = FIO_OPT_STR_STORE,
2750 .off1 = td_var_offset(cgroup),
2751 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01002752 .category = FIO_OPT_C_GENERAL,
2753 .group = FIO_OPT_G_INVALID,
Jens Axboea696fa22009-12-04 10:05:02 +01002754 },
2755 {
2756 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01002757 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01002758 .type = FIO_OPT_INT,
2759 .off1 = td_var_offset(cgroup_weight),
2760 .help = "Use given weight for cgroup",
2761 .minval = 100,
2762 .maxval = 1000,
Jens Axboee8b0e952012-03-19 14:37:08 +01002763 .category = FIO_OPT_C_GENERAL,
2764 .group = FIO_OPT_G_INVALID,
Jens Axboea696fa22009-12-04 10:05:02 +01002765 },
2766 {
Vivek Goyal7de87092010-03-31 22:55:15 +02002767 .name = "cgroup_nodelete",
Jens Axboee8b0e952012-03-19 14:37:08 +01002768 .lname = "Cgroup no-delete",
Vivek Goyal7de87092010-03-31 22:55:15 +02002769 .type = FIO_OPT_BOOL,
2770 .off1 = td_var_offset(cgroup_nodelete),
2771 .help = "Do not delete cgroups after job completion",
2772 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002773 .category = FIO_OPT_C_GENERAL,
2774 .group = FIO_OPT_G_INVALID,
Vivek Goyal7de87092010-03-31 22:55:15 +02002775 },
2776 {
Jens Axboee0b0d892009-12-08 10:10:14 +01002777 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01002778 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01002779 .type = FIO_OPT_INT,
2780 .off1 = td_var_offset(uid),
2781 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01002782 .category = FIO_OPT_C_GENERAL,
2783 .group = FIO_OPT_G_INVALID,
Jens Axboee0b0d892009-12-08 10:10:14 +01002784 },
2785 {
2786 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01002787 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01002788 .type = FIO_OPT_INT,
2789 .off1 = td_var_offset(gid),
2790 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01002791 .category = FIO_OPT_C_GENERAL,
2792 .group = FIO_OPT_G_INVALID,
Jens Axboee0b0d892009-12-08 10:10:14 +01002793 },
2794 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002795 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01002796 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002797 .type = FIO_OPT_INT,
2798 .off1 = td_var_offset(flow_id),
2799 .help = "The flow index ID to use",
2800 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002803 },
2804 {
2805 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002807 .type = FIO_OPT_INT,
2808 .off1 = td_var_offset(flow),
2809 .help = "Weight for flow control of this job",
2810 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01002811 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002812 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002813 .category = FIO_OPT_C_IO,
2814 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002815 },
2816 {
2817 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01002818 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002819 .type = FIO_OPT_INT,
2820 .off1 = td_var_offset(flow_watermark),
2821 .help = "High watermark for flow control. This option"
2822 " should be set to the same value for all threads"
2823 " with non-zero flow.",
2824 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01002825 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002826 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01002827 .category = FIO_OPT_C_IO,
2828 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002829 },
2830 {
2831 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01002832 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002833 .type = FIO_OPT_INT,
2834 .off1 = td_var_offset(flow_sleep),
2835 .help = "How many microseconds to sleep after being held"
2836 " back by the flow control mechanism",
2837 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01002838 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002839 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002840 .category = FIO_OPT_C_IO,
2841 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01002842 },
2843 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002844 .name = NULL,
2845 },
2846};
2847
Jens Axboe17af15d2010-04-13 10:38:16 +02002848static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01002849 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01002850{
Jens Axboe17af15d2010-04-13 10:38:16 +02002851 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01002852 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01002853 if (o->type == FIO_OPT_STR_SET)
2854 lopt->has_arg = no_argument;
2855 else
2856 lopt->has_arg = required_argument;
2857}
2858
Steven Langde890a12011-11-09 14:03:34 +01002859static void options_to_lopts(struct fio_option *opts,
2860 struct option *long_options,
2861 int i, int option_type)
2862{
2863 struct fio_option *o = &opts[0];
2864 while (o->name) {
2865 add_to_lopt(&long_options[i], o, o->name, option_type);
2866 if (o->alias) {
2867 i++;
2868 add_to_lopt(&long_options[i], o, o->alias, option_type);
2869 }
2870
2871 i++;
2872 o++;
2873 assert(i < FIO_NR_OPTIONS);
2874 }
2875}
2876
2877void fio_options_set_ioengine_opts(struct option *long_options,
2878 struct thread_data *td)
2879{
2880 unsigned int i;
2881
2882 i = 0;
2883 while (long_options[i].name) {
2884 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
2885 memset(&long_options[i], 0, sizeof(*long_options));
2886 break;
2887 }
2888 i++;
2889 }
2890
2891 /*
2892 * Just clear out the prior ioengine options.
2893 */
2894 if (!td || !td->eo)
2895 return;
2896
2897 options_to_lopts(td->io_ops->options, long_options, i,
2898 FIO_GETOPT_IOENGINE);
2899}
2900
Jens Axboe214e1ec2007-03-15 10:48:13 +01002901void fio_options_dup_and_init(struct option *long_options)
2902{
Jens Axboe214e1ec2007-03-15 10:48:13 +01002903 unsigned int i;
2904
Jens Axboe9af4a242012-03-16 10:13:49 +01002905 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01002906
2907 i = 0;
2908 while (long_options[i].name)
2909 i++;
2910
Jens Axboe9af4a242012-03-16 10:13:49 +01002911 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01002912}
2913
Jens Axboe74929ac2009-08-05 11:42:37 +02002914struct fio_keyword {
2915 const char *word;
2916 const char *desc;
2917 char *replace;
2918};
2919
2920static struct fio_keyword fio_keywords[] = {
2921 {
2922 .word = "$pagesize",
2923 .desc = "Page size in the system",
2924 },
2925 {
2926 .word = "$mb_memory",
2927 .desc = "Megabytes of memory online",
2928 },
2929 {
2930 .word = "$ncpus",
2931 .desc = "Number of CPUs online in the system",
2932 },
2933 {
2934 .word = NULL,
2935 },
2936};
2937
2938void fio_keywords_init(void)
2939{
Jens Axboe3b2e1462009-12-15 08:58:10 +01002940 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02002941 char buf[128];
2942 long l;
2943
2944 sprintf(buf, "%lu", page_size);
2945 fio_keywords[0].replace = strdup(buf);
2946
Jens Axboe8eb016d2011-07-11 10:24:20 +02002947 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01002948 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02002949 fio_keywords[1].replace = strdup(buf);
2950
Jens Axboec00a2282011-07-08 20:56:06 +02002951 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02002952 sprintf(buf, "%lu", l);
2953 fio_keywords[2].replace = strdup(buf);
2954}
2955
Jens Axboe892a6ff2009-11-13 12:19:49 +01002956#define BC_APP "bc"
2957
2958static char *bc_calc(char *str)
2959{
Steven Langd0c814e2011-10-28 08:37:13 +02002960 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01002961 FILE *f;
2962 int ret;
2963
2964 /*
2965 * No math, just return string
2966 */
Steven Langd0c814e2011-10-28 08:37:13 +02002967 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
2968 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01002969 return str;
2970
2971 /*
2972 * Split option from value, we only need to calculate the value
2973 */
2974 tmp = strchr(str, '=');
2975 if (!tmp)
2976 return str;
2977
2978 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01002979
Steven Langd0c814e2011-10-28 08:37:13 +02002980 /*
2981 * Prevent buffer overflows; such a case isn't reasonable anyway
2982 */
2983 if (strlen(str) >= 128 || strlen(tmp) > 100)
2984 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01002985
2986 sprintf(buf, "which %s > /dev/null", BC_APP);
2987 if (system(buf)) {
2988 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01002989 return NULL;
2990 }
2991
Steven Langd0c814e2011-10-28 08:37:13 +02002992 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01002993 f = popen(buf, "r");
2994 if (!f) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01002995 return NULL;
2996 }
2997
Steven Langd0c814e2011-10-28 08:37:13 +02002998 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01002999 if (ret <= 0) {
Jens Axboe892a6ff2009-11-13 12:19:49 +01003000 return NULL;
3001 }
3002
Jens Axboe892a6ff2009-11-13 12:19:49 +01003003 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003004 buf[(tmp - str) + ret - 1] = '\0';
3005 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003006 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003007 return strdup(buf);
3008}
3009
3010/*
3011 * Return a copy of the input string with substrings of the form ${VARNAME}
3012 * substituted with the value of the environment variable VARNAME. The
3013 * substitution always occurs, even if VARNAME is empty or the corresponding
3014 * environment variable undefined.
3015 */
3016static char *option_dup_subs(const char *opt)
3017{
3018 char out[OPT_LEN_MAX+1];
3019 char in[OPT_LEN_MAX+1];
3020 char *outptr = out;
3021 char *inptr = in;
3022 char *ch1, *ch2, *env;
3023 ssize_t nchr = OPT_LEN_MAX;
3024 size_t envlen;
3025
3026 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3027 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3028 return NULL;
3029 }
3030
3031 in[OPT_LEN_MAX] = '\0';
3032 strncpy(in, opt, OPT_LEN_MAX);
3033
3034 while (*inptr && nchr > 0) {
3035 if (inptr[0] == '$' && inptr[1] == '{') {
3036 ch2 = strchr(inptr, '}');
3037 if (ch2 && inptr+1 < ch2) {
3038 ch1 = inptr+2;
3039 inptr = ch2+1;
3040 *ch2 = '\0';
3041
3042 env = getenv(ch1);
3043 if (env) {
3044 envlen = strlen(env);
3045 if (envlen <= nchr) {
3046 memcpy(outptr, env, envlen);
3047 outptr += envlen;
3048 nchr -= envlen;
3049 }
3050 }
3051
3052 continue;
3053 }
3054 }
3055
3056 *outptr++ = *inptr++;
3057 --nchr;
3058 }
3059
3060 *outptr = '\0';
3061 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003062}
3063
Jens Axboe74929ac2009-08-05 11:42:37 +02003064/*
3065 * Look for reserved variable names and replace them with real values
3066 */
3067static char *fio_keyword_replace(char *opt)
3068{
3069 char *s;
3070 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003071 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003072
3073 for (i = 0; fio_keywords[i].word != NULL; i++) {
3074 struct fio_keyword *kw = &fio_keywords[i];
3075
3076 while ((s = strstr(opt, kw->word)) != NULL) {
3077 char *new = malloc(strlen(opt) + 1);
3078 char *o_org = opt;
3079 int olen = s - opt;
3080 int len;
3081
3082 /*
3083 * Copy part of the string before the keyword and
3084 * sprintf() the replacement after it.
3085 */
3086 memcpy(new, opt, olen);
3087 len = sprintf(new + olen, "%s", kw->replace);
3088
3089 /*
3090 * If there's more in the original string, copy that
3091 * in too
3092 */
3093 opt += strlen(kw->word) + olen;
3094 if (strlen(opt))
3095 memcpy(new + olen + len, opt, opt - o_org - 1);
3096
3097 /*
3098 * replace opt and free the old opt
3099 */
3100 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003101 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003102
Steven Langd0c814e2011-10-28 08:37:13 +02003103 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003104 }
3105 }
3106
Steven Langd0c814e2011-10-28 08:37:13 +02003107 /*
3108 * Check for potential math and invoke bc, if possible
3109 */
3110 if (docalc)
3111 opt = bc_calc(opt);
3112
Jens Axboe7a958bd2009-11-13 12:33:54 +01003113 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003114}
3115
Steven Langd0c814e2011-10-28 08:37:13 +02003116static char **dup_and_sub_options(char **opts, int num_opts)
3117{
3118 int i;
3119 char **opts_copy = malloc(num_opts * sizeof(*opts));
3120 for (i = 0; i < num_opts; i++) {
3121 opts_copy[i] = option_dup_subs(opts[i]);
3122 if (!opts_copy[i])
3123 continue;
3124 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3125 }
3126 return opts_copy;
3127}
3128
Jens Axboe3b8b7132008-06-10 19:46:23 +02003129int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003130{
Steven Langde890a12011-11-09 14:03:34 +01003131 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003132 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003133
Jens Axboe9af4a242012-03-16 10:13:49 +01003134 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003135 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003136
Steven Langde890a12011-11-09 14:03:34 +01003137 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3138 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003139 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3140 &o, td);
Steven Langd0c814e2011-10-28 08:37:13 +02003141
Steven Langde890a12011-11-09 14:03:34 +01003142 if (opts_copy[i]) {
3143 if (newret && !o) {
3144 unknown++;
3145 continue;
3146 }
Steven Langd0c814e2011-10-28 08:37:13 +02003147 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003148 opts_copy[i] = NULL;
3149 }
3150
3151 ret |= newret;
3152 }
3153
3154 if (unknown) {
3155 ret |= ioengine_load(td);
3156 if (td->eo) {
3157 sort_options(opts_copy, td->io_ops->options, num_opts);
3158 opts = opts_copy;
3159 }
3160 for (i = 0; i < num_opts; i++) {
3161 struct fio_option *o = NULL;
3162 int newret = 1;
3163 if (!opts_copy[i])
3164 continue;
3165
3166 if (td->eo)
3167 newret = parse_option(opts_copy[i], opts[i],
3168 td->io_ops->options, &o,
3169 td->eo);
3170
3171 ret |= newret;
3172 if (!o)
3173 log_err("Bad option <%s>\n", opts[i]);
3174
3175 free(opts_copy[i]);
3176 opts_copy[i] = NULL;
3177 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003178 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003179
Steven Langd0c814e2011-10-28 08:37:13 +02003180 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003181 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003182}
3183
3184int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3185{
Jens Axboe9af4a242012-03-16 10:13:49 +01003186 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003187}
3188
Steven Langde890a12011-11-09 14:03:34 +01003189int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3190 char *val)
3191{
3192 return parse_cmd_option(opt, val, td->io_ops->options, td);
3193}
3194
Jens Axboe214e1ec2007-03-15 10:48:13 +01003195void fio_fill_default_options(struct thread_data *td)
3196{
Jens Axboe9af4a242012-03-16 10:13:49 +01003197 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003198}
3199
3200int fio_show_option_help(const char *opt)
3201{
Jens Axboe9af4a242012-03-16 10:13:49 +01003202 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003203}
Jens Axboed23bb322007-03-23 15:57:56 +01003204
Steven Langde890a12011-11-09 14:03:34 +01003205void options_mem_dupe(void *data, struct fio_option *options)
3206{
3207 struct fio_option *o;
3208 char **ptr;
3209
3210 for (o = &options[0]; o->name; o++) {
3211 if (o->type != FIO_OPT_STR_STORE)
3212 continue;
3213
3214 ptr = td_var(data, o->off1);
3215 if (*ptr)
3216 *ptr = strdup(*ptr);
3217 }
3218}
3219
Jens Axboe7e356b22011-10-14 10:55:16 +02003220/*
3221 * dupe FIO_OPT_STR_STORE options
3222 */
Steven Langde890a12011-11-09 14:03:34 +01003223void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003224{
Jens Axboe9af4a242012-03-16 10:13:49 +01003225 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003226
3227 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003228 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003229
Steven Langde890a12011-11-09 14:03:34 +01003230 td->eo = malloc(td->io_ops->option_struct_size);
3231 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3232 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003233 }
3234}
3235
Jens Axboed6978a32009-07-18 21:04:09 +02003236unsigned int fio_get_kb_base(void *data)
3237{
3238 struct thread_data *td = data;
3239 unsigned int kb_base = 0;
3240
3241 if (td)
3242 kb_base = td->o.kb_base;
3243 if (!kb_base)
3244 kb_base = 1024;
3245
3246 return kb_base;
3247}
Jens Axboe9f988e22010-03-04 10:42:38 +01003248
Jens Axboe07b32322010-03-05 09:48:44 +01003249int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003250{
Jens Axboe07b32322010-03-05 09:48:44 +01003251 struct fio_option *__o;
3252 int opt_index = 0;
3253
Jens Axboe9af4a242012-03-16 10:13:49 +01003254 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003255 while (__o->name) {
3256 opt_index++;
3257 __o++;
3258 }
3259
Jens Axboe9af4a242012-03-16 10:13:49 +01003260 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe07b32322010-03-05 09:48:44 +01003261 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003262}
Jens Axboee2de69d2010-03-04 14:05:48 +01003263
Jens Axboe07b32322010-03-05 09:48:44 +01003264void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003265{
Jens Axboe07b32322010-03-05 09:48:44 +01003266 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003267
Jens Axboe9af4a242012-03-16 10:13:49 +01003268 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003269 while (o->name) {
3270 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3271 o->type = FIO_OPT_INVALID;
3272 o->prof_name = NULL;
3273 }
3274 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003275 }
3276}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003277
3278void add_opt_posval(const char *optname, const char *ival, const char *help)
3279{
3280 struct fio_option *o;
3281 unsigned int i;
3282
Jens Axboe9af4a242012-03-16 10:13:49 +01003283 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003284 if (!o)
3285 return;
3286
3287 for (i = 0; i < PARSE_MAX_VP; i++) {
3288 if (o->posval[i].ival)
3289 continue;
3290
3291 o->posval[i].ival = ival;
3292 o->posval[i].help = help;
3293 break;
3294 }
3295}
3296
3297void del_opt_posval(const char *optname, const char *ival)
3298{
3299 struct fio_option *o;
3300 unsigned int i;
3301
Jens Axboe9af4a242012-03-16 10:13:49 +01003302 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003303 if (!o)
3304 return;
3305
3306 for (i = 0; i < PARSE_MAX_VP; i++) {
3307 if (!o->posval[i].ival)
3308 continue;
3309 if (strcmp(o->posval[i].ival, ival))
3310 continue;
3311
3312 o->posval[i].ival = NULL;
3313 o->posval[i].help = NULL;
3314 }
3315}
Jens Axboe7e356b22011-10-14 10:55:16 +02003316
3317void fio_options_free(struct thread_data *td)
3318{
Jens Axboe9af4a242012-03-16 10:13:49 +01003319 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003320 if (td->eo && td->io_ops && td->io_ops->options) {
3321 options_free(td->io_ops->options, td->eo);
3322 free(td->eo);
3323 td->eo = NULL;
3324 }
Jens Axboe7e356b22011-10-14 10:55:16 +02003325}