blob: ce955133eff6ddc3beda8ddcdd8af02725b7b621 [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
Jens Axboe3c3ed072012-03-27 09:12:39 +020040 switch (a) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +010041 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 }
Jens Axboe3c3ed072012-03-27 09:12:39 +020053 return a - base;
Radha Ramachandran0e92f872009-10-27 20:14:27 +010054}
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 Axboe83ea4222012-03-28 14:01:46 +020064static int bssplit_ddir(struct thread_options *o, 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 Axboe83ea4222012-03-28 14:01:46 +020072 o->bssplit_nr[ddir] = 4;
Jens Axboe720e84a2009-04-21 08:29:55 +020073 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 Axboe83ea4222012-03-28 14:01:46 +020087 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, 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 Axboe0de5b262014-02-21 15:26:01 -0800105 if (str_to_decimal(fname, &val, 1, o, 0)) {
Jens Axboe564ca972007-12-14 12:21:19 +0100106 log_err("fio: bssplit conversion failed\n");
Hong Zhiguod8b97c82013-10-08 08:48:47 -0600107 free(bssplit);
Jens Axboe564ca972007-12-14 12:21:19 +0100108 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 Axboe83ea4222012-03-28 14:01:46 +0200121 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 Axboe83ea4222012-03-28 14:01:46 +0200127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200128 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
Jens Axboef3cc9892014-09-15 18:51:32 -0600136 if (perc > 100 && perc_missing > 1) {
Jens Axboe564ca972007-12-14 12:21:19 +0100137 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 Axboef3cc9892014-09-15 18:51:32 -0600146 if (perc_missing == 1)
147 perc = 100;
Jens Axboe83ea4222012-03-28 14:01:46 +0200148 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200149 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100150
151 if (bsp->perc == (unsigned char) -1)
152 bsp->perc = (100 - perc) / perc_missing;
153 }
154 }
155
Jens Axboe83ea4222012-03-28 14:01:46 +0200156 o->min_bs[ddir] = min_bs;
157 o->max_bs[ddir] = max_bs;
Jens Axboe564ca972007-12-14 12:21:19 +0100158
159 /*
160 * now sort based on percentages, for ease of lookup
161 */
Jens Axboe83ea4222012-03-28 14:01:46 +0200162 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
163 o->bssplit[ddir] = bssplit;
Jens Axboe720e84a2009-04-21 08:29:55 +0200164 return 0;
Jens Axboe720e84a2009-04-21 08:29:55 +0200165}
166
167static int str_bssplit_cb(void *data, const char *input)
168{
169 struct thread_data *td = data;
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200170 char *str, *p, *odir, *ddir;
Jens Axboe720e84a2009-04-21 08:29:55 +0200171 int ret = 0;
172
Jens Axboe52c0cea2013-09-06 10:07:37 -0600173 if (parse_dryrun())
174 return 0;
175
Jens Axboe720e84a2009-04-21 08:29:55 +0200176 p = str = strdup(input);
177
178 strip_blank_front(&str);
179 strip_blank_end(str);
180
181 odir = strchr(str, ',');
182 if (odir) {
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200183 ddir = strchr(odir + 1, ',');
184 if (ddir) {
Jens Axboed79db122012-09-24 08:51:24 +0200185 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200186 if (!ret)
187 *ddir = '\0';
188 } else {
189 char *op;
190
191 op = strdup(odir + 1);
Jens Axboed79db122012-09-24 08:51:24 +0200192 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200193
194 free(op);
195 }
Jens Axboed79db122012-09-24 08:51:24 +0200196 if (!ret)
197 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
Jens Axboe720e84a2009-04-21 08:29:55 +0200198 if (!ret) {
199 *odir = '\0';
Jens Axboe83ea4222012-03-28 14:01:46 +0200200 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200201 }
202 } else {
203 char *op;
204
205 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200206 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
Jens Axboe720e84a2009-04-21 08:29:55 +0200207 free(op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200208
209 if (!ret) {
210 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200211 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200212 free(op);
213 }
Jens Axboed79db122012-09-24 08:51:24 +0200214 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200215 }
Jens Axboe564ca972007-12-14 12:21:19 +0100216
217 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200218 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100219}
220
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400221static int str2error(char *str)
222{
Jens Axboea94eb992012-09-24 18:46:34 +0200223 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400224 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
225 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
226 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
227 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
228 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
229 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
Jens Axboea94eb992012-09-24 18:46:34 +0200230 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400231 int i = 0, num = sizeof(err) / sizeof(void *);
232
Jens Axboea94eb992012-09-24 18:46:34 +0200233 while (i < num) {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400234 if (!strcmp(err[i], str))
235 return i + 1;
236 i++;
237 }
238 return 0;
239}
240
241static int ignore_error_type(struct thread_data *td, int etype, char *str)
242{
243 unsigned int i;
244 int *error;
245 char *fname;
246
247 if (etype >= ERROR_TYPE_CNT) {
248 log_err("Illegal error type\n");
249 return 1;
250 }
251
252 td->o.ignore_error_nr[etype] = 4;
253 error = malloc(4 * sizeof(struct bssplit));
254
255 i = 0;
256 while ((fname = strsep(&str, ":")) != NULL) {
257
258 if (!strlen(fname))
259 break;
260
261 /*
262 * grow struct buffer, if needed
263 */
264 if (i == td->o.ignore_error_nr[etype]) {
265 td->o.ignore_error_nr[etype] <<= 1;
266 error = realloc(error, td->o.ignore_error_nr[etype]
267 * sizeof(int));
268 }
269 if (fname[0] == 'E') {
270 error[i] = str2error(fname);
271 } else {
272 error[i] = atoi(fname);
273 if (error[i] < 0)
Jens Axboe1616e022014-04-14 08:59:17 -0600274 error[i] = -error[i];
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400275 }
276 if (!error[i]) {
277 log_err("Unknown error %s, please use number value \n",
278 fname);
Erwan Velu0fddbf72013-07-22 23:46:10 +0200279 free(error);
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400280 return 1;
281 }
282 i++;
283 }
284 if (i) {
285 td->o.continue_on_error |= 1 << etype;
286 td->o.ignore_error_nr[etype] = i;
287 td->o.ignore_error[etype] = error;
Jens Axboec7b086b2014-04-11 11:20:29 -0600288 } else
289 free(error);
290
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400291 return 0;
292
293}
294
295static int str_ignore_error_cb(void *data, const char *input)
296{
297 struct thread_data *td = data;
298 char *str, *p, *n;
299 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600300
301 if (parse_dryrun())
302 return 0;
303
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400304 p = str = strdup(input);
305
306 strip_blank_front(&str);
307 strip_blank_end(str);
308
309 while (p) {
310 n = strchr(p, ',');
311 if (n)
312 *n++ = '\0';
313 ret = ignore_error_type(td, type, p);
314 if (ret)
315 break;
316 p = n;
317 type++;
318 }
319 free(str);
320 return ret;
321}
322
Jens Axboe211097b2007-03-22 18:56:45 +0100323static int str_rw_cb(void *data, const char *str)
324{
325 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200326 struct thread_options *o = &td->o;
Jens Axboe27ca9492014-04-11 11:25:32 -0600327 char *nr;
Jens Axboe211097b2007-03-22 18:56:45 +0100328
Jens Axboe52c0cea2013-09-06 10:07:37 -0600329 if (parse_dryrun())
330 return 0;
331
Jens Axboe83ea4222012-03-28 14:01:46 +0200332 o->ddir_seq_nr = 1;
333 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200334
Jens Axboe27ca9492014-04-11 11:25:32 -0600335 nr = get_opt_postfix(str);
Jens Axboe059b0802011-08-25 09:09:37 +0200336 if (!nr)
337 return 0;
338
339 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200340 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200341 else {
342 long long val;
343
Jens Axboe0de5b262014-02-21 15:26:01 -0800344 if (str_to_decimal(nr, &val, 1, o, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200345 log_err("fio: rw postfix parsing failed\n");
346 free(nr);
347 return 1;
348 }
349
Jens Axboe83ea4222012-03-28 14:01:46 +0200350 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100351 }
Jens Axboe211097b2007-03-22 18:56:45 +0100352
Jens Axboe059b0802011-08-25 09:09:37 +0200353 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100354 return 0;
355}
356
Jens Axboe214e1ec2007-03-15 10:48:13 +0100357static int str_mem_cb(void *data, const char *mem)
358{
359 struct thread_data *td = data;
360
Shaohua Lid9759b12013-01-17 13:28:15 +0100361 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700362 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100363
364 return 0;
365}
366
Jens Axboec223da82010-03-24 13:23:53 +0100367static int fio_clock_source_cb(void *data, const char *str)
368{
369 struct thread_data *td = data;
370
371 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100372 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100373 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100374 return 0;
375}
376
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400377static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200378{
379 struct thread_data *td = data;
380
381 td->o.rwmix[DDIR_READ] = *val;
382 td->o.rwmix[DDIR_WRITE] = 100 - *val;
383 return 0;
384}
385
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400386static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200387{
388 struct thread_data *td = data;
389
390 td->o.rwmix[DDIR_WRITE] = *val;
391 td->o.rwmix[DDIR_READ] = 100 - *val;
392 return 0;
393}
394
Jens Axboe214e1ec2007-03-15 10:48:13 +0100395static int str_exitall_cb(void)
396{
397 exitall_on_terminate = 1;
398 return 0;
399}
400
Jens Axboe214e1ec2007-03-15 10:48:13 +0100401#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800402int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800403{
Jens Axboe50b58602014-02-28 15:08:25 -0800404 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800405 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800406
Jens Axboe50b58602014-02-28 15:08:25 -0800407 cpus_in_mask = fio_cpu_count(mask);
408 cpu_index = cpu_index % cpus_in_mask;
409
410 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800411 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800412 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800413 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800414
415 if (cpu_index != index)
416 fio_cpu_clear(mask, i);
417
418 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800419 }
420
421 return fio_cpu_count(mask);
422}
423
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400424static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100425{
426 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200427 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100428 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100429 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100430
Jens Axboe52c0cea2013-09-06 10:07:37 -0600431 if (parse_dryrun())
432 return 0;
433
Jens Axboed2ce18b2008-12-12 20:51:40 +0100434 ret = fio_cpuset_init(&td->o.cpumask);
435 if (ret < 0) {
436 log_err("fio: cpuset_init failed\n");
437 td_verror(td, ret, "fio_cpuset_init");
438 return 1;
439 }
440
Jens Axboec00a2282011-07-08 20:56:06 +0200441 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200442
Jens Axboe62a72732008-12-08 11:37:01 +0100443 for (i = 0; i < sizeof(int) * 8; i++) {
444 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100445 if (i > max_cpu) {
446 log_err("fio: CPU %d too large (max=%ld)\n", i,
447 max_cpu);
448 return 1;
449 }
Jens Axboe62a72732008-12-08 11:37:01 +0100450 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100451 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100452 }
453 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200454
Jens Axboe375b2692007-05-22 09:13:02 +0200455 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100456 return 0;
457}
458
Jens Axboee8462bd2009-07-06 12:59:04 +0200459static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
460 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200461{
Jens Axboed2e268b2007-06-15 10:33:49 +0200462 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100463 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100464 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200465
Jens Axboee8462bd2009-07-06 12:59:04 +0200466 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100467 if (ret < 0) {
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
470 return 1;
471 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200472
473 p = str = strdup(input);
474
475 strip_blank_front(&str);
476 strip_blank_end(str);
477
Jens Axboec00a2282011-07-08 20:56:06 +0200478 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100479
Jens Axboed2e268b2007-06-15 10:33:49 +0200480 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100481 char *str2, *cpu2;
482 int icpu, icpu2;
483
Jens Axboed2e268b2007-06-15 10:33:49 +0200484 if (!strlen(cpu))
485 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100486
487 str2 = cpu;
488 icpu2 = -1;
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
490 if (!strlen(cpu2))
491 break;
492
493 icpu2 = atoi(cpu2);
494 }
495
496 icpu = atoi(cpu);
497 if (icpu2 == -1)
498 icpu2 = icpu;
499 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100500 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100501 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100502 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100503 ret = 1;
504 break;
505 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
508 icpu, max_cpu);
509 ret = 1;
510 break;
511 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200512
Jens Axboe62a72732008-12-08 11:37:01 +0100513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200514 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100515 icpu++;
516 }
Jens Axboe19608d62008-12-08 15:03:12 +0100517 if (ret)
518 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200519 }
520
521 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100522 if (!ret)
523 td->o.cpumask_set = 1;
524 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200525}
Jens Axboee8462bd2009-07-06 12:59:04 +0200526
527static int str_cpus_allowed_cb(void *data, const char *input)
528{
529 struct thread_data *td = data;
530 int ret;
531
Jens Axboe52c0cea2013-09-06 10:07:37 -0600532 if (parse_dryrun())
533 return 0;
534
Jens Axboee8462bd2009-07-06 12:59:04 +0200535 ret = set_cpus_allowed(td, &td->o.cpumask, input);
536 if (!ret)
537 td->o.cpumask_set = 1;
538
539 return ret;
540}
541
542static int str_verify_cpus_allowed_cb(void *data, const char *input)
543{
544 struct thread_data *td = data;
545 int ret;
546
547 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
548 if (!ret)
549 td->o.verify_cpumask_set = 1;
550
551 return ret;
552}
Jens Axboed2e268b2007-06-15 10:33:49 +0200553#endif
554
Jens Axboe67bf9822013-01-10 11:23:19 +0100555#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400556static int str_numa_cpunodes_cb(void *data, char *input)
557{
558 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200559 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400560
Jens Axboe52c0cea2013-09-06 10:07:37 -0600561 if (parse_dryrun())
562 return 0;
563
Yufei Rend0b937e2012-10-19 23:11:52 -0400564 /* numa_parse_nodestring() parses a character string list
565 * of nodes into a bit mask. The bit mask is allocated by
566 * numa_allocate_nodemask(), so it should be freed by
567 * numa_free_nodemask().
568 */
Daniel Gollub43522842014-05-01 17:07:49 +0200569 verify_bitmask = numa_parse_nodestring(input);
570 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400571 log_err("fio: numa_parse_nodestring failed\n");
572 td_verror(td, 1, "str_numa_cpunodes_cb");
573 return 1;
574 }
Daniel Gollub43522842014-05-01 17:07:49 +0200575 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400576
Daniel Gollub43522842014-05-01 17:07:49 +0200577 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400578 td->o.numa_cpumask_set = 1;
579 return 0;
580}
581
582static int str_numa_mpol_cb(void *data, char *input)
583{
584 struct thread_data *td = data;
585 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600586 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400587 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600588 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200589 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400590
Jens Axboe52c0cea2013-09-06 10:07:37 -0600591 if (parse_dryrun())
592 return 0;
593
594 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400595 if (nodelist) {
596 /* NUL-terminate mode */
597 *nodelist++ = '\0';
598 }
599
600 for (i = 0; i <= MPOL_LOCAL; i++) {
601 if (!strcmp(input, policy_types[i])) {
602 td->o.numa_mem_mode = i;
603 break;
604 }
605 }
606 if (i > MPOL_LOCAL) {
607 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
608 goto out;
609 }
610
611 switch (td->o.numa_mem_mode) {
612 case MPOL_PREFERRED:
613 /*
614 * Insist on a nodelist of one node only
615 */
616 if (nodelist) {
617 char *rest = nodelist;
618 while (isdigit(*rest))
619 rest++;
620 if (*rest) {
621 log_err("fio: one node only for \'prefer\'\n");
622 goto out;
623 }
624 } else {
625 log_err("fio: one node is needed for \'prefer\'\n");
626 goto out;
627 }
628 break;
629 case MPOL_INTERLEAVE:
630 /*
631 * Default to online nodes with memory if no nodelist
632 */
633 if (!nodelist)
634 nodelist = strdup("all");
635 break;
636 case MPOL_LOCAL:
637 case MPOL_DEFAULT:
638 /*
639 * Don't allow a nodelist
640 */
641 if (nodelist) {
642 log_err("fio: NO nodelist for \'local\'\n");
643 goto out;
644 }
645 break;
646 case MPOL_BIND:
647 /*
648 * Insist on a nodelist
649 */
650 if (!nodelist) {
651 log_err("fio: a nodelist is needed for \'bind\'\n");
652 goto out;
653 }
654 break;
655 }
656
657
658 /* numa_parse_nodestring() parses a character string list
659 * of nodes into a bit mask. The bit mask is allocated by
660 * numa_allocate_nodemask(), so it should be freed by
661 * numa_free_nodemask().
662 */
663 switch (td->o.numa_mem_mode) {
664 case MPOL_PREFERRED:
665 td->o.numa_mem_prefer_node = atoi(nodelist);
666 break;
667 case MPOL_INTERLEAVE:
668 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200669 verify_bitmask = numa_parse_nodestring(nodelist);
670 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400671 log_err("fio: numa_parse_nodestring failed\n");
672 td_verror(td, 1, "str_numa_memnodes_cb");
673 return 1;
674 }
Daniel Gollub43522842014-05-01 17:07:49 +0200675 td->o.numa_memnodes = strdup(nodelist);
676 numa_free_nodemask(verify_bitmask);
Manish Mandlik44e2ab52014-08-14 11:45:16 -0600677
Yufei Rend0b937e2012-10-19 23:11:52 -0400678 break;
679 case MPOL_LOCAL:
680 case MPOL_DEFAULT:
681 default:
682 break;
683 }
684
685 td->o.numa_memmask_set = 1;
686 return 0;
687
688out:
689 return 1;
690}
691#endif
692
Jens Axboe214e1ec2007-03-15 10:48:13 +0100693static int str_fst_cb(void *data, const char *str)
694{
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
697
698 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100699 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100700 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100701 free(nr);
702 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100703
704 return 0;
705}
706
Jens Axboe67bf9822013-01-10 11:23:19 +0100707#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100708static int str_sfr_cb(void *data, const char *str)
709{
710 struct thread_data *td = data;
711 char *nr = get_opt_postfix(str);
712
713 td->sync_file_range_nr = 1;
714 if (nr) {
715 td->sync_file_range_nr = atoi(nr);
716 free(nr);
717 }
718
719 return 0;
720}
Jens Axboe3ae06372010-03-19 19:17:15 +0100721#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100722
Jens Axboee25839d2012-11-06 10:49:42 +0100723static int str_random_distribution_cb(void *data, const char *str)
724{
725 struct thread_data *td = data;
726 double val;
727 char *nr;
728
Jens Axboe52c0cea2013-09-06 10:07:37 -0600729 if (parse_dryrun())
730 return 0;
731
Jens Axboe925fee32012-11-06 13:50:32 +0100732 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
733 val = 1.1;
734 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
735 val = 0.2;
736 else
Jens Axboee25839d2012-11-06 10:49:42 +0100737 return 0;
738
739 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100740 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100741 log_err("fio: random postfix parsing failed\n");
742 free(nr);
743 return 1;
744 }
745
Jens Axboe078189c2012-11-07 13:47:22 +0100746 free(nr);
747
Jens Axboe18ded912012-11-08 08:36:00 +0100748 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
749 if (val == 1.00) {
750 log_err("fio: zipf theta must different than 1.0\n");
751 return 1;
752 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700753 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100754 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100755 if (val <= 0.00 || val >= 1.00) {
756 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
757 return 1;
758 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700759 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100760 }
Jens Axboe925fee32012-11-06 13:50:32 +0100761
Jens Axboee25839d2012-11-06 10:49:42 +0100762 return 0;
763}
764
Jens Axboe8e827d32009-08-04 09:51:48 +0200765/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800766 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200767 * is escaped with a '\', then that ':' is part of the filename and does not
768 * indicate a new file.
769 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800770static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200771{
772 char *str = *ptr;
773 char *p, *start;
774
775 if (!str || !strlen(str))
776 return NULL;
777
778 start = str;
779 do {
780 /*
781 * No colon, we are done
782 */
783 p = strchr(str, ':');
784 if (!p) {
785 *ptr = NULL;
786 break;
787 }
788
789 /*
790 * We got a colon, but it's the first character. Skip and
791 * continue
792 */
793 if (p == start) {
794 str = ++start;
795 continue;
796 }
797
798 if (*(p - 1) != '\\') {
799 *p = '\0';
800 *ptr = p + 1;
801 break;
802 }
803
804 memmove(p - 1, p, strlen(p) + 1);
805 str = p;
806 } while (1);
807
808 return start;
809}
810
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800811
812static int get_max_name_idx(char *input)
813{
814 unsigned int cur_idx;
815 char *str, *p;
816
817 p = str = strdup(input);
818 for (cur_idx = 0; ; cur_idx++)
819 if (get_next_name(&str) == NULL)
820 break;
821
822 free(p);
823 return cur_idx;
824}
825
826/*
827 * Returns the directory at the index, indexes > entires will be
828 * assigned via modulo division of the index
829 */
830int set_name_idx(char *target, char *input, int index)
831{
832 unsigned int cur_idx;
833 int len;
834 char *fname, *str, *p;
835
836 p = str = strdup(input);
837
838 index %= get_max_name_idx(input);
839 for (cur_idx = 0; cur_idx <= index; cur_idx++)
840 fname = get_next_name(&str);
841
842 len = sprintf(target, "%s/", fname);
843 free(p);
844
845 return len;
846}
847
Jens Axboe214e1ec2007-03-15 10:48:13 +0100848static int str_filename_cb(void *data, const char *input)
849{
850 struct thread_data *td = data;
851 char *fname, *str, *p;
852
853 p = str = strdup(input);
854
855 strip_blank_front(&str);
856 strip_blank_end(str);
857
858 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100859 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100860
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800861 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100862 if (!strlen(fname))
863 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800864 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100865 }
866
867 free(p);
868 return 0;
869}
870
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800871static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100872{
873 struct thread_data *td = data;
874 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800875 char *dirname, *str, *p;
876 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100877
Jens Axboef9633d72013-09-06 09:59:56 -0600878 if (parse_dryrun())
879 return 0;
880
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800881 p = str = strdup(td->o.directory);
882 while ((dirname = get_next_name(&str)) != NULL) {
883 if (lstat(dirname, &sb) < 0) {
884 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100885
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800886 log_err("fio: %s is not a directory\n", dirname);
887 td_verror(td, ret, "lstat");
888 goto out;
889 }
890 if (!S_ISDIR(sb.st_mode)) {
891 log_err("fio: %s is not a directory\n", dirname);
892 ret = 1;
893 goto out;
894 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100895 }
896
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800897out:
898 free(p);
899 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100900}
901
Jens Axboef2a28032014-02-11 09:12:06 -0700902static int str_lockfile_cb(void *data, const char fio_unused *str)
903{
904 struct thread_data *td = data;
905
906 if (td->files_index) {
907 log_err("fio: lockfile= option must precede filename=\n");
908 return 1;
909 }
910
911 return 0;
912}
913
Jens Axboe214e1ec2007-03-15 10:48:13 +0100914static int str_opendir_cb(void *data, const char fio_unused *str)
915{
916 struct thread_data *td = data;
917
Jens Axboe52c0cea2013-09-06 10:07:37 -0600918 if (parse_dryrun())
919 return 0;
920
Jens Axboe214e1ec2007-03-15 10:48:13 +0100921 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100922 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100923
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100924 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100925}
926
Jens Axboece35b1e2014-01-14 15:35:58 -0700927static int pattern_cb(char *pattern, unsigned int max_size,
928 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200929{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100930 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700931 int i = 0, j = 0, len, k, base = 10;
932 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200933 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200934
Jens Axboe5de855d2014-08-22 14:02:02 -0500935 /*
936 * Check if it's a string input
937 */
938 loc1 = strchr(input, '\"');
939 if (loc1) {
940 do {
941 loc1++;
942 if (*loc1 == '\0' || *loc1 == '\"')
943 break;
944
945 pattern[i] = *loc1;
946 i++;
947 } while (i < max_size);
948
949 if (!i)
950 return 1;
951
952 goto fill;
953 }
954
955 /*
956 * No string, find out if it's decimal or hexidecimal
957 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100958 loc1 = strstr(input, "0x");
959 loc2 = strstr(input, "0X");
960 if (loc1 || loc2)
961 base = 16;
962 off = strtol(input, NULL, base);
963 if (off != LONG_MAX || errno != ERANGE) {
964 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700965 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100966 off >>= 8;
967 i++;
968 }
969 } else {
970 len = strlen(input);
971 k = len - 1;
972 if (base == 16) {
973 if (loc1)
974 j = loc1 - input + 2;
975 else
976 j = loc2 - input + 2;
977 } else
978 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700979 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100980 while (k >= j) {
981 off = converthexchartoint(input[k--]);
982 if (k >= j)
983 off += (converthexchartoint(input[k--])
984 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700985 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100986 }
987 }
988 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100989
990 /*
991 * Fill the pattern all the way to the end. This greatly reduces
992 * the number of memcpy's we have to do when verifying the IO.
993 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500994fill:
Jens Axboee078de42013-04-24 23:07:17 -0600995 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700996 while (i > 1 && i * 2 <= max_size) {
997 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100998 i *= 2;
999 }
Jens Axboee078de42013-04-24 23:07:17 -06001000
1001 /*
1002 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -07001003 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -06001004 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001005 while (i > 1 && i < max_size) {
1006 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -06001007
Jens Axboece35b1e2014-01-14 15:35:58 -07001008 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -06001009 i += b;
1010 }
1011
Steven Lang9a2a86d2012-02-07 09:42:59 +01001012 if (i == 1) {
1013 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -05001014 * The code in verify_io_u_pattern assumes a single byte
1015 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +01001016 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001017 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +01001018 }
Steven Langefcd9dc2012-02-02 20:22:04 +01001019
Jens Axboece35b1e2014-01-14 15:35:58 -07001020 *pattern_bytes = i;
1021 return 0;
1022}
1023
1024static int str_buffer_pattern_cb(void *data, const char *input)
1025{
1026 struct thread_data *td = data;
1027 int ret;
1028
1029 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1030 &td->o.buffer_pattern_bytes);
1031
Jens Axboedf91a1f2014-08-22 10:22:03 -05001032 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboece35b1e2014-01-14 15:35:58 -07001033 td->o.refill_buffers = 0;
1034 td->o.scramble_buffers = 0;
1035 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001036 } else {
1037 log_err("fio: failed parsing pattern `%s`\n", input);
1038 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001039 }
1040
1041 return ret;
1042}
1043
Jens Axboebedc9dc2014-03-17 12:51:09 -06001044static int str_buffer_compress_cb(void *data, unsigned long long *il)
1045{
1046 struct thread_data *td = data;
1047
1048 td->flags |= TD_F_COMPRESS;
1049 td->o.compress_percentage = *il;
1050 return 0;
1051}
1052
Jens Axboece35b1e2014-01-14 15:35:58 -07001053static int str_verify_pattern_cb(void *data, const char *input)
1054{
1055 struct thread_data *td = data;
1056 int ret;
1057
1058 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1059 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001060
Jens Axboe92bf48d2011-01-14 21:20:42 +01001061 /*
1062 * VERIFY_META could already be set
1063 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001064 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001065 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001066
Jens Axboece35b1e2014-01-14 15:35:58 -07001067 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001068}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001069
Jens Axboe993bf482008-11-14 13:04:53 +01001070static int str_gtod_reduce_cb(void *data, int *il)
1071{
1072 struct thread_data *td = data;
1073 int val = *il;
1074
Jens Axboe02af0982010-06-24 09:59:34 +02001075 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001076 td->o.disable_clat = !!val;
1077 td->o.disable_slat = !!val;
1078 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001079 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001080 if (val)
1081 td->tv_cache_mask = 63;
1082
1083 return 0;
1084}
1085
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001086static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001087{
1088 struct thread_data *td = data;
1089 int val = *il;
1090
1091 td->o.gtod_cpu = val;
1092 td->o.gtod_offload = 1;
1093 return 0;
1094}
1095
Jens Axboe7bb59102011-07-12 19:47:03 +02001096static int str_size_cb(void *data, unsigned long long *__val)
1097{
1098 struct thread_data *td = data;
1099 unsigned long long v = *__val;
1100
1101 if (parse_is_percent(v)) {
1102 td->o.size = 0;
1103 td->o.size_percent = -1ULL - v;
1104 } else
1105 td->o.size = v;
1106
1107 return 0;
1108}
1109
Jens Axboe896cac22009-07-01 10:38:35 +02001110static int rw_verify(struct fio_option *o, void *data)
1111{
1112 struct thread_data *td = data;
1113
1114 if (read_only && td_write(td)) {
1115 log_err("fio: job <%s> has write bit set, but fio is in"
1116 " read-only mode\n", td->o.name);
1117 return 1;
1118 }
1119
1120 return 0;
1121}
1122
Jens Axboe276ca4f2009-07-01 10:43:05 +02001123static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001124{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001125#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001126 struct thread_data *td = data;
1127
Jens Axboe29d43ff2009-07-01 10:42:18 +02001128 if (td->o.gtod_cpu) {
1129 log_err("fio: platform must support CPU affinity for"
1130 "gettimeofday() offloading\n");
1131 return 1;
1132 }
1133#endif
1134
1135 return 0;
1136}
1137
Jens Axboe214e1ec2007-03-15 10:48:13 +01001138/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001139 * Option grouping
1140 */
1141static struct opt_group fio_opt_groups[] = {
1142 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001143 .name = "General",
1144 .mask = FIO_OPT_C_GENERAL,
1145 },
1146 {
1147 .name = "I/O",
1148 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001149 },
1150 {
1151 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001152 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001153 },
1154 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001155 .name = "Statistics",
1156 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001157 },
1158 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001159 .name = "Logging",
1160 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001161 },
1162 {
Jens Axboe13fca822012-03-31 13:55:54 +02001163 .name = "Profiles",
1164 .mask = FIO_OPT_C_PROFILE,
1165 },
1166 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001167 .name = NULL,
1168 },
1169};
1170
Jens Axboee8b0e952012-03-19 14:37:08 +01001171static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1172 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001173{
1174 struct opt_group *og;
1175 int i;
1176
Jens Axboee8b0e952012-03-19 14:37:08 +01001177 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001178 return NULL;
1179
Jens Axboee8b0e952012-03-19 14:37:08 +01001180 for (i = 0; ogs[i].name; i++) {
1181 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001182
1183 if (*mask & og->mask) {
1184 *mask &= ~(og->mask);
1185 return og;
1186 }
1187 }
1188
1189 return NULL;
1190}
1191
Jens Axboee8b0e952012-03-19 14:37:08 +01001192struct opt_group *opt_group_from_mask(unsigned int *mask)
1193{
1194 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1195}
1196
1197static struct opt_group fio_opt_cat_groups[] = {
1198 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001199 .name = "Latency profiling",
1200 .mask = FIO_OPT_G_LATPROF,
1201 },
1202 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001203 .name = "Rate",
1204 .mask = FIO_OPT_G_RATE,
1205 },
1206 {
1207 .name = "Zone",
1208 .mask = FIO_OPT_G_ZONE,
1209 },
1210 {
1211 .name = "Read/write mix",
1212 .mask = FIO_OPT_G_RWMIX,
1213 },
1214 {
1215 .name = "Verify",
1216 .mask = FIO_OPT_G_VERIFY,
1217 },
1218 {
1219 .name = "Trim",
1220 .mask = FIO_OPT_G_TRIM,
1221 },
1222 {
1223 .name = "I/O Logging",
1224 .mask = FIO_OPT_G_IOLOG,
1225 },
1226 {
1227 .name = "I/O Depth",
1228 .mask = FIO_OPT_G_IO_DEPTH,
1229 },
1230 {
1231 .name = "I/O Flow",
1232 .mask = FIO_OPT_G_IO_FLOW,
1233 },
1234 {
Jens Axboe06260372012-03-19 15:16:08 +01001235 .name = "Description",
1236 .mask = FIO_OPT_G_DESC,
1237 },
1238 {
1239 .name = "Filename",
1240 .mask = FIO_OPT_G_FILENAME,
1241 },
1242 {
1243 .name = "General I/O",
1244 .mask = FIO_OPT_G_IO_BASIC,
1245 },
1246 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001247 .name = "Cgroups",
1248 .mask = FIO_OPT_G_CGROUP,
1249 },
1250 {
1251 .name = "Runtime",
1252 .mask = FIO_OPT_G_RUNTIME,
1253 },
1254 {
Jens Axboe10860052012-03-19 20:56:53 +01001255 .name = "Process",
1256 .mask = FIO_OPT_G_PROCESS,
1257 },
1258 {
1259 .name = "Job credentials / priority",
1260 .mask = FIO_OPT_G_CRED,
1261 },
1262 {
1263 .name = "Clock settings",
1264 .mask = FIO_OPT_G_CLOCK,
1265 },
1266 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001267 .name = "I/O Type",
1268 .mask = FIO_OPT_G_IO_TYPE,
1269 },
1270 {
1271 .name = "I/O Thinktime",
1272 .mask = FIO_OPT_G_THINKTIME,
1273 },
1274 {
1275 .name = "Randomizations",
1276 .mask = FIO_OPT_G_RANDOM,
1277 },
1278 {
1279 .name = "I/O buffers",
1280 .mask = FIO_OPT_G_IO_BUF,
1281 },
1282 {
Jens Axboe13fca822012-03-31 13:55:54 +02001283 .name = "Tiobench profile",
1284 .mask = FIO_OPT_G_TIOBENCH,
1285 },
1286
1287 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001288 .name = NULL,
1289 }
1290};
1291
1292struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1293{
1294 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1295}
1296
Jens Axboe9af4a242012-03-16 10:13:49 +01001297/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001298 * Map of job/command line options
1299 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001300struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001301 {
1302 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001303 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(description),
1306 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001307 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001308 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001309 },
1310 {
1311 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001312 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(name),
1315 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001316 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001317 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001318 },
1319 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001320 .name = "filename",
1321 .lname = "Filename(s)",
1322 .type = FIO_OPT_STR_STORE,
1323 .off1 = td_var_offset(filename),
1324 .cb = str_filename_cb,
1325 .prio = -1, /* must come after "directory" */
1326 .help = "File(s) to use for the workload",
1327 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001328 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001329 },
1330 {
1331 .name = "directory",
1332 .lname = "Directory",
1333 .type = FIO_OPT_STR_STORE,
1334 .off1 = td_var_offset(directory),
1335 .cb = str_directory_cb,
1336 .help = "Directory to store files in",
1337 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001338 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001339 },
1340 {
Jens Axboede98bd32013-04-05 11:09:20 +02001341 .name = "filename_format",
1342 .type = FIO_OPT_STR_STORE,
1343 .off1 = td_var_offset(filename_format),
1344 .prio = -1, /* must come after "directory" */
1345 .help = "Override default $jobname.$jobnum.$filenum naming",
1346 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001347 .category = FIO_OPT_C_FILE,
1348 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001349 },
1350 {
Jens Axboe29c13492008-03-01 19:25:20 +01001351 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001352 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001353 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001354 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001355 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001356 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001357 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001358 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001359 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001360 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001361 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001362 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001363 .posval = {
1364 { .ival = "none",
1365 .oval = FILE_LOCK_NONE,
1366 .help = "No file locking",
1367 },
1368 { .ival = "exclusive",
1369 .oval = FILE_LOCK_EXCLUSIVE,
1370 .help = "Exclusive file lock",
1371 },
1372 {
1373 .ival = "readwrite",
1374 .oval = FILE_LOCK_READWRITE,
1375 .help = "Read vs write lock",
1376 },
1377 },
Jens Axboe29c13492008-03-01 19:25:20 +01001378 },
1379 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001380 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001381 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001382 .type = FIO_OPT_STR_STORE,
1383 .off1 = td_var_offset(opendir),
1384 .cb = str_opendir_cb,
1385 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001386 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001387 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001388 },
1389 {
1390 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001391 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001392 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001393 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001394 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001395 .off1 = td_var_offset(td_ddir),
1396 .help = "IO direction",
1397 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001398 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001399 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001400 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001401 .posval = {
1402 { .ival = "read",
1403 .oval = TD_DDIR_READ,
1404 .help = "Sequential read",
1405 },
1406 { .ival = "write",
1407 .oval = TD_DDIR_WRITE,
1408 .help = "Sequential write",
1409 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001410 { .ival = "trim",
1411 .oval = TD_DDIR_TRIM,
1412 .help = "Sequential trim",
1413 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001414 { .ival = "randread",
1415 .oval = TD_DDIR_RANDREAD,
1416 .help = "Random read",
1417 },
1418 { .ival = "randwrite",
1419 .oval = TD_DDIR_RANDWRITE,
1420 .help = "Random write",
1421 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001422 { .ival = "randtrim",
1423 .oval = TD_DDIR_RANDTRIM,
1424 .help = "Random trim",
1425 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001426 { .ival = "rw",
1427 .oval = TD_DDIR_RW,
1428 .help = "Sequential read and write mix",
1429 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001430 { .ival = "readwrite",
1431 .oval = TD_DDIR_RW,
1432 .help = "Sequential read and write mix",
1433 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001434 { .ival = "randrw",
1435 .oval = TD_DDIR_RANDRW,
1436 .help = "Random read and write mix"
1437 },
1438 },
1439 },
1440 {
Jens Axboe38dad622010-07-20 14:46:00 -06001441 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001442 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001443 .type = FIO_OPT_STR,
1444 .off1 = td_var_offset(rw_seq),
1445 .help = "IO offset generator modifier",
1446 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001447 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001448 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001449 .posval = {
1450 { .ival = "sequential",
1451 .oval = RW_SEQ_SEQ,
1452 .help = "Generate sequential offsets",
1453 },
1454 { .ival = "identical",
1455 .oval = RW_SEQ_IDENT,
1456 .help = "Generate identical offsets",
1457 },
1458 },
1459 },
1460
1461 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001462 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001463 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001464 .type = FIO_OPT_STR_STORE,
1465 .off1 = td_var_offset(ioengine),
1466 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001467 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001468 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001469 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001470 .posval = {
1471 { .ival = "sync",
1472 .help = "Use read/write",
1473 },
gurudas paia31041e2007-10-23 15:12:30 +02001474 { .ival = "psync",
1475 .help = "Use pread/pwrite",
1476 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001477 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001478 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001479 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001480#ifdef CONFIG_PWRITEV
1481 { .ival = "pvsync",
1482 .help = "Use preadv/pwritev",
1483 },
1484#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001485#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001486 { .ival = "libaio",
1487 .help = "Linux native asynchronous IO",
1488 },
1489#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001490#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001491 { .ival = "posixaio",
1492 .help = "POSIX asynchronous IO",
1493 },
1494#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001495#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001496 { .ival = "solarisaio",
1497 .help = "Solaris native asynchronous IO",
1498 },
1499#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001500#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001501 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001502 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001503 },
Jens Axboe3be80072011-01-19 11:07:28 -07001504#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001505#ifdef CONFIG_RBD
1506 { .ival = "rbd",
1507 .help = "Rados Block Device asynchronous IO"
1508 },
1509#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001510 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001511 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001512 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001513#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001514 { .ival = "splice",
1515 .help = "splice/vmsplice based IO",
1516 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001517 { .ival = "netsplice",
1518 .help = "splice/vmsplice to/from the network",
1519 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001520#endif
1521#ifdef FIO_HAVE_SGIO
1522 { .ival = "sg",
1523 .help = "SCSI generic v3 IO",
1524 },
1525#endif
1526 { .ival = "null",
1527 .help = "Testing engine (no data transfer)",
1528 },
1529 { .ival = "net",
1530 .help = "Network IO",
1531 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001532 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001533 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001534 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001535#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001536 { .ival = "guasi",
1537 .help = "GUASI IO engine",
1538 },
1539#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001540#ifdef FIO_HAVE_BINJECT
1541 { .ival = "binject",
1542 .help = "binject direct inject block engine",
1543 },
1544#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001545#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001546 { .ival = "rdma",
1547 .help = "RDMA IO engine",
1548 },
1549#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001550#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001551 { .ival = "fusion-aw-sync",
1552 .help = "Fusion-io atomic write engine",
1553 },
1554#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001555#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001556 { .ival = "e4defrag",
1557 .help = "ext4 defrag engine",
1558 },
1559#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001560#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001561 { .ival = "falloc",
1562 .help = "fallocate() file based engine",
1563 },
1564#endif
chenh321fc5a2014-03-31 11:32:29 -04001565#ifdef CONFIG_GFAPI
1566 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001567 .help = "Glusterfs libgfapi(sync) based engine"
1568 },
1569 { .ival = "gfapi_async",
1570 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001571 },
1572#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001573#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001574 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001575 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1576 },
1577#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001578 { .ival = "external",
1579 .help = "Load external engine (append name)",
1580 },
1581 },
1582 },
1583 {
1584 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001585 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001586 .type = FIO_OPT_INT,
1587 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001588 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001589 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001590 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001591 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001592 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001593 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001594 },
1595 {
1596 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001597 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001598 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001599 .type = FIO_OPT_INT,
1600 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001601 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001602 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001603 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001604 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001605 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001606 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001607 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001608 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001609 },
1610 {
Jens Axboe49504212008-06-05 09:03:30 +02001611 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001612 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001613 .type = FIO_OPT_INT,
1614 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001615 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001616 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001617 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001618 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001619 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001620 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001621 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001622 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001623 },
1624 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001625 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001626 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001627 .type = FIO_OPT_INT,
1628 .off1 = td_var_offset(iodepth_low),
1629 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001630 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001631 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001632 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001633 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001634 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001635 },
1636 {
1637 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001638 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001639 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001640 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001641 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001642 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001643 .category = FIO_OPT_C_IO,
1644 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001645 },
1646 {
Jens Axboe77731b22014-04-28 12:08:47 -06001647 .name = "io_limit",
1648 .lname = "IO Limit",
1649 .type = FIO_OPT_STR_VAL,
1650 .off1 = td_var_offset(io_limit),
1651 .interval = 1024 * 1024,
1652 .category = FIO_OPT_C_IO,
1653 .group = FIO_OPT_G_INVALID,
1654 },
1655 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001656 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001657 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001658 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001659 .type = FIO_OPT_BOOL,
1660 .off1 = td_var_offset(fill_device),
1661 .help = "Write until an ENOSPC error occurs",
1662 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001663 .category = FIO_OPT_C_FILE,
1664 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001665 },
1666 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001667 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001668 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001669 .type = FIO_OPT_STR_VAL,
1670 .off1 = td_var_offset(file_size_low),
1671 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001672 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001673 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001674 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001675 .category = FIO_OPT_C_FILE,
1676 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001677 },
1678 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001679 .name = "file_append",
1680 .lname = "File append",
1681 .type = FIO_OPT_BOOL,
1682 .off1 = td_var_offset(file_append),
1683 .help = "IO will start at the end of the file(s)",
1684 .def = "0",
1685 .category = FIO_OPT_C_FILE,
1686 .group = FIO_OPT_G_INVALID,
1687 },
1688 {
Jens Axboe67a10002007-07-31 23:12:16 +02001689 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001690 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001691 .alias = "fileoffset",
1692 .type = FIO_OPT_STR_VAL,
1693 .off1 = td_var_offset(start_offset),
1694 .help = "Start IO from this offset",
1695 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001696 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001699 },
1700 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001701 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001702 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001703 .type = FIO_OPT_STR_VAL,
1704 .off1 = td_var_offset(offset_increment),
1705 .help = "What is the increment from one offset to the next",
1706 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001707 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001708 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001709 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001710 .category = FIO_OPT_C_IO,
1711 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001712 },
1713 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001714 .name = "number_ios",
1715 .lname = "Number of IOs to perform",
1716 .type = FIO_OPT_STR_VAL,
1717 .off1 = td_var_offset(number_ios),
1718 .help = "Force job completion of this number of IOs",
1719 .def = "0",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1722 },
1723 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001724 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001725 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001726 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001727 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001728 .off1 = td_var_offset(bs[DDIR_READ]),
1729 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001730 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001731 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001732 .help = "Block size unit",
1733 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001734 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001735 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001736 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001737 .category = FIO_OPT_C_IO,
1738 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001739 },
1740 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001741 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001742 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001743 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001744 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001745 .off1 = td_var_offset(ba[DDIR_READ]),
1746 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001747 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001748 .minval = 1,
1749 .help = "IO block offset alignment",
1750 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001751 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001752 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001753 .category = FIO_OPT_C_IO,
1754 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001755 },
1756 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001757 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001758 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001759 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001760 .type = FIO_OPT_RANGE,
1761 .off1 = td_var_offset(min_bs[DDIR_READ]),
1762 .off2 = td_var_offset(max_bs[DDIR_READ]),
1763 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1764 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001765 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1766 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001767 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001768 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001769 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001770 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001771 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001772 .category = FIO_OPT_C_IO,
1773 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001774 },
1775 {
Jens Axboe564ca972007-12-14 12:21:19 +01001776 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001777 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001778 .type = FIO_OPT_STR,
1779 .cb = str_bssplit_cb,
1780 .help = "Set a specific mix of block sizes",
1781 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001782 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001783 .category = FIO_OPT_C_IO,
1784 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001785 },
1786 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001787 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001788 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001789 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001790 .type = FIO_OPT_STR_SET,
1791 .off1 = td_var_offset(bs_unaligned),
1792 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001793 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001794 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001797 },
1798 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001799 .name = "bs_is_seq_rand",
1800 .lname = "Block size division is seq/random (not read/write)",
1801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(bs_is_seq_rand),
1803 .help = "Consider any blocksize setting to be sequential,ramdom",
1804 .def = "0",
1805 .parent = "blocksize",
1806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_INVALID,
1808 },
1809 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001810 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001811 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001812 .type = FIO_OPT_BOOL,
1813 .off1 = td_var_offset(rand_repeatable),
1814 .help = "Use repeatable random IO pattern",
1815 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001816 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001817 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001818 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001819 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001820 },
1821 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001822 .name = "randseed",
1823 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001824 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001825 .off1 = td_var_offset(rand_seed),
1826 .help = "Set the random generator seed value",
1827 .parent = "rw",
1828 .category = FIO_OPT_C_IO,
1829 .group = FIO_OPT_G_RANDOM,
1830 },
1831 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001832 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001833 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001834 .type = FIO_OPT_BOOL,
1835 .off1 = td_var_offset(use_os_rand),
1836 .help = "Set to use OS random generator",
1837 .def = "0",
1838 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001839 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001840 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001841 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001842 },
1843 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001844 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001845 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001846 .type = FIO_OPT_STR_SET,
1847 .off1 = td_var_offset(norandommap),
1848 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001849 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001850 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001851 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001852 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001853 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001854 },
1855 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001856 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001857 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001858 .type = FIO_OPT_BOOL,
1859 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001860 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001861 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001862 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001863 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001864 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001865 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001866 },
1867 {
Jens Axboe8055e412012-11-26 08:43:47 +01001868 .name = "random_generator",
1869 .type = FIO_OPT_STR,
1870 .off1 = td_var_offset(random_generator),
1871 .help = "Type of random number generator to use",
1872 .def = "tausworthe",
1873 .posval = {
1874 { .ival = "tausworthe",
1875 .oval = FIO_RAND_GEN_TAUSWORTHE,
1876 .help = "Strong Tausworthe generator",
1877 },
1878 { .ival = "lfsr",
1879 .oval = FIO_RAND_GEN_LFSR,
1880 .help = "Variable length LFSR",
1881 },
1882 },
Jens Axboe48107592012-12-04 09:43:11 +01001883 .category = FIO_OPT_C_IO,
1884 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001885 },
1886 {
Jens Axboee25839d2012-11-06 10:49:42 +01001887 .name = "random_distribution",
1888 .type = FIO_OPT_STR,
1889 .off1 = td_var_offset(random_distribution),
1890 .cb = str_random_distribution_cb,
1891 .help = "Random offset distribution generator",
1892 .def = "random",
1893 .posval = {
1894 { .ival = "random",
1895 .oval = FIO_RAND_DIST_RANDOM,
1896 .help = "Completely random",
1897 },
1898 { .ival = "zipf",
1899 .oval = FIO_RAND_DIST_ZIPF,
1900 .help = "Zipf distribution",
1901 },
Jens Axboe925fee32012-11-06 13:50:32 +01001902 { .ival = "pareto",
1903 .oval = FIO_RAND_DIST_PARETO,
1904 .help = "Pareto distribution",
1905 },
Jens Axboee25839d2012-11-06 10:49:42 +01001906 },
Jens Axboe48107592012-12-04 09:43:11 +01001907 .category = FIO_OPT_C_IO,
1908 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001909 },
1910 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001911 .name = "percentage_random",
1912 .lname = "Percentage Random",
1913 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001914 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1915 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1916 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001917 .maxval = 100,
1918 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001919 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001920 .interval = 5,
1921 .inverse = "percentage_sequential",
1922 .category = FIO_OPT_C_IO,
1923 .group = FIO_OPT_G_RANDOM,
1924 },
1925 {
1926 .name = "percentage_sequential",
1927 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001928 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001929 .category = FIO_OPT_C_IO,
1930 .group = FIO_OPT_G_RANDOM,
1931 },
1932 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001933 .name = "allrandrepeat",
1934 .type = FIO_OPT_BOOL,
1935 .off1 = td_var_offset(allrand_repeatable),
1936 .help = "Use repeatable random numbers for everything",
1937 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001938 .category = FIO_OPT_C_IO,
1939 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001940 },
1941 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001942 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001943 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001944 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001945 .type = FIO_OPT_INT,
1946 .off1 = td_var_offset(nr_files),
1947 .help = "Split job workload between this number of files",
1948 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001949 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001950 .category = FIO_OPT_C_FILE,
1951 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001952 },
1953 {
1954 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001955 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(open_files),
1958 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001959 .category = FIO_OPT_C_FILE,
1960 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001961 },
1962 {
1963 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001964 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001965 .type = FIO_OPT_STR,
1966 .cb = str_fst_cb,
1967 .off1 = td_var_offset(file_service_type),
1968 .help = "How to select which file to service next",
1969 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001970 .category = FIO_OPT_C_FILE,
1971 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001972 .posval = {
1973 { .ival = "random",
1974 .oval = FIO_FSERVICE_RANDOM,
1975 .help = "Choose a file at random",
1976 },
1977 { .ival = "roundrobin",
1978 .oval = FIO_FSERVICE_RR,
1979 .help = "Round robin select files",
1980 },
Jens Axboea086c252009-03-04 08:27:37 +01001981 { .ival = "sequential",
1982 .oval = FIO_FSERVICE_SEQ,
1983 .help = "Finish one file before moving to the next",
1984 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001985 },
Jens Axboe67a10002007-07-31 23:12:16 +02001986 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001987 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001988 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001989#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001990 {
1991 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001992 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001993 .type = FIO_OPT_STR,
1994 .off1 = td_var_offset(fallocate_mode),
1995 .help = "Whether pre-allocation is performed when laying out files",
1996 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001997 .category = FIO_OPT_C_FILE,
1998 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001999 .posval = {
2000 { .ival = "none",
2001 .oval = FIO_FALLOCATE_NONE,
2002 .help = "Do not pre-allocate space",
2003 },
2004 { .ival = "posix",
2005 .oval = FIO_FALLOCATE_POSIX,
2006 .help = "Use posix_fallocate()",
2007 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002008#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02002009 { .ival = "keep",
2010 .oval = FIO_FALLOCATE_KEEP_SIZE,
2011 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2012 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002013#endif
Eric Gourioua596f042011-06-17 09:11:45 +02002014 /* Compatibility with former boolean values */
2015 { .ival = "0",
2016 .oval = FIO_FALLOCATE_NONE,
2017 .help = "Alias for 'none'",
2018 },
2019 { .ival = "1",
2020 .oval = FIO_FALLOCATE_POSIX,
2021 .help = "Alias for 'posix'",
2022 },
2023 },
2024 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002025#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02002026 {
2027 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002028 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002029 .type = FIO_OPT_BOOL,
2030 .off1 = td_var_offset(fadvise_hint),
2031 .help = "Use fadvise() to advise the kernel on IO pattern",
2032 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002033 .category = FIO_OPT_C_FILE,
2034 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002035 },
2036 {
2037 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002038 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002039 .type = FIO_OPT_INT,
2040 .off1 = td_var_offset(fsync_blocks),
2041 .help = "Issue fsync for writes every given number of blocks",
2042 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002043 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002044 .category = FIO_OPT_C_FILE,
2045 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002046 },
2047 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002048 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002049 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002050 .type = FIO_OPT_INT,
2051 .off1 = td_var_offset(fdatasync_blocks),
2052 .help = "Issue fdatasync for writes every given number of blocks",
2053 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002054 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002055 .category = FIO_OPT_C_FILE,
2056 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002057 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002058 {
2059 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002060 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002061 .type = FIO_OPT_INT,
2062 .off1 = td_var_offset(barrier_blocks),
2063 .help = "Make every Nth write a barrier write",
2064 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002065 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002066 .category = FIO_OPT_C_IO,
2067 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002068 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002069#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002070 {
2071 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002072 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002073 .posval = {
2074 { .ival = "wait_before",
2075 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2076 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002077 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002078 },
2079 { .ival = "write",
2080 .oval = SYNC_FILE_RANGE_WRITE,
2081 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002082 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002083 },
2084 {
2085 .ival = "wait_after",
2086 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2087 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002088 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002089 },
2090 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002091 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002092 .cb = str_sfr_cb,
2093 .off1 = td_var_offset(sync_file_range),
2094 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002095 .category = FIO_OPT_C_FILE,
2096 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002097 },
2098#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002099 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002100 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002101 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(odirect),
2104 .help = "Use O_DIRECT IO (negates buffered)",
2105 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002106 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002107 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002108 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002109 },
2110 {
Chris Masond01612f2013-11-15 15:52:58 -07002111 .name = "atomic",
2112 .lname = "Atomic I/O",
2113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(oatomic),
2115 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2116 .def = "0",
2117 .category = FIO_OPT_C_IO,
2118 .group = FIO_OPT_G_IO_TYPE,
2119 },
2120 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002121 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002122 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002123 .type = FIO_OPT_BOOL,
2124 .off1 = td_var_offset(odirect),
2125 .neg = 1,
2126 .help = "Use buffered IO (negates direct)",
2127 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002128 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002129 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002130 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002131 },
2132 {
2133 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002134 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002135 .type = FIO_OPT_BOOL,
2136 .off1 = td_var_offset(overwrite),
2137 .help = "When writing, set whether to overwrite current data",
2138 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002139 .category = FIO_OPT_C_FILE,
2140 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002141 },
2142 {
2143 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002144 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002145 .type = FIO_OPT_INT,
2146 .off1 = td_var_offset(loops),
2147 .help = "Number of times to run the job",
2148 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002149 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002150 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002151 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002152 },
2153 {
2154 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002155 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002156 .type = FIO_OPT_INT,
2157 .off1 = td_var_offset(numjobs),
2158 .help = "Duplicate this job this many times",
2159 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002160 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002161 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002162 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002163 },
2164 {
2165 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002166 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002167 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002168 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002169 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002170 .help = "Only start job when this period has passed",
2171 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002172 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002173 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002174 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002175 },
2176 {
2177 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002178 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002179 .alias = "timeout",
2180 .type = FIO_OPT_STR_VAL_TIME,
2181 .off1 = td_var_offset(timeout),
2182 .help = "Stop workload when this amount of time has passed",
2183 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002184 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002185 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002186 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002187 },
2188 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002189 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002190 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002191 .type = FIO_OPT_STR_SET,
2192 .off1 = td_var_offset(time_based),
2193 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002194 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002195 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002196 },
2197 {
Juan Casse62167762013-09-17 14:06:13 -07002198 .name = "verify_only",
2199 .lname = "Verify only",
2200 .type = FIO_OPT_STR_SET,
2201 .off1 = td_var_offset(verify_only),
2202 .help = "Verifies previously written data is still valid",
2203 .category = FIO_OPT_C_GENERAL,
2204 .group = FIO_OPT_G_RUNTIME,
2205 },
2206 {
Jens Axboe721938a2008-09-10 09:46:16 +02002207 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002208 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002209 .type = FIO_OPT_STR_VAL_TIME,
2210 .off1 = td_var_offset(ramp_time),
2211 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002212 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002213 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002214 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002215 },
2216 {
Jens Axboec223da82010-03-24 13:23:53 +01002217 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002218 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002219 .type = FIO_OPT_STR,
2220 .cb = fio_clock_source_cb,
2221 .off1 = td_var_offset(clocksource),
2222 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002223 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002224 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002225 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002226#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002227 { .ival = "gettimeofday",
2228 .oval = CS_GTOD,
2229 .help = "Use gettimeofday(2) for timing",
2230 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002231#endif
2232#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002233 { .ival = "clock_gettime",
2234 .oval = CS_CGETTIME,
2235 .help = "Use clock_gettime(2) for timing",
2236 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002237#endif
Jens Axboec223da82010-03-24 13:23:53 +01002238#ifdef ARCH_HAVE_CPU_CLOCK
2239 { .ival = "cpu",
2240 .oval = CS_CPUCLOCK,
2241 .help = "Use CPU private clock",
2242 },
2243#endif
2244 },
2245 },
2246 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002247 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002248 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002249 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002250 .type = FIO_OPT_STR,
2251 .cb = str_mem_cb,
2252 .off1 = td_var_offset(mem_type),
2253 .help = "Backing type for IO buffers",
2254 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002257 .posval = {
2258 { .ival = "malloc",
2259 .oval = MEM_MALLOC,
2260 .help = "Use malloc(3) for IO buffers",
2261 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002262#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002263 { .ival = "shm",
2264 .oval = MEM_SHM,
2265 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002266 },
2267#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002268 { .ival = "shmhuge",
2269 .oval = MEM_SHMHUGE,
2270 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002271 },
2272#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002273#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002274 { .ival = "mmap",
2275 .oval = MEM_MMAP,
2276 .help = "Use mmap(2) (file or anon) for IO buffers",
2277 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002278#ifdef FIO_HAVE_HUGETLB
2279 { .ival = "mmaphuge",
2280 .oval = MEM_MMAPHUGE,
2281 .help = "Like mmap, but use huge pages",
2282 },
2283#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002284 },
2285 },
2286 {
Jens Axboed529ee12009-07-01 10:33:03 +02002287 .name = "iomem_align",
2288 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002289 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(mem_align),
2292 .minval = 0,
2293 .help = "IO memory buffer offset alignment",
2294 .def = "0",
2295 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002296 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002297 .category = FIO_OPT_C_IO,
2298 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002299 },
2300 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002301 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002302 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002303 .type = FIO_OPT_STR,
2304 .off1 = td_var_offset(verify),
2305 .help = "Verify data written",
2306 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002307 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002308 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002309 .posval = {
2310 { .ival = "0",
2311 .oval = VERIFY_NONE,
2312 .help = "Don't do IO verification",
2313 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002314 { .ival = "md5",
2315 .oval = VERIFY_MD5,
2316 .help = "Use md5 checksums for verification",
2317 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002318 { .ival = "crc64",
2319 .oval = VERIFY_CRC64,
2320 .help = "Use crc64 checksums for verification",
2321 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002322 { .ival = "crc32",
2323 .oval = VERIFY_CRC32,
2324 .help = "Use crc32 checksums for verification",
2325 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002326 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002327 .oval = VERIFY_CRC32C,
2328 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002329 },
Jens Axboebac39e02008-06-11 20:46:19 +02002330 { .ival = "crc32c",
2331 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002332 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002333 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002334 { .ival = "crc16",
2335 .oval = VERIFY_CRC16,
2336 .help = "Use crc16 checksums for verification",
2337 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002338 { .ival = "crc7",
2339 .oval = VERIFY_CRC7,
2340 .help = "Use crc7 checksums for verification",
2341 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002342 { .ival = "sha1",
2343 .oval = VERIFY_SHA1,
2344 .help = "Use sha1 checksums for verification",
2345 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002346 { .ival = "sha256",
2347 .oval = VERIFY_SHA256,
2348 .help = "Use sha256 checksums for verification",
2349 },
2350 { .ival = "sha512",
2351 .oval = VERIFY_SHA512,
2352 .help = "Use sha512 checksums for verification",
2353 },
Jens Axboe844ea602014-02-20 13:21:45 -08002354 { .ival = "xxhash",
2355 .oval = VERIFY_XXHASH,
2356 .help = "Use xxhash checksums for verification",
2357 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002358 { .ival = "meta",
2359 .oval = VERIFY_META,
2360 .help = "Use io information",
2361 },
Jens Axboe36690c92007-03-26 10:23:34 +02002362 {
2363 .ival = "null",
2364 .oval = VERIFY_NULL,
2365 .help = "Pretend to verify",
2366 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002367 },
2368 },
2369 {
Jens Axboe005c5652007-08-02 22:21:36 +02002370 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002371 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002372 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002373 .off1 = td_var_offset(do_verify),
2374 .help = "Run verification stage after write",
2375 .def = "1",
2376 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002377 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002380 },
2381 {
Jens Axboe160b9662007-03-27 10:59:49 +02002382 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002383 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002384 .type = FIO_OPT_BOOL,
2385 .off1 = td_var_offset(verifysort),
2386 .help = "Sort written verify blocks for read back",
2387 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002388 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002389 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002392 },
2393 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002394 .name = "verifysort_nr",
2395 .type = FIO_OPT_INT,
2396 .off1 = td_var_offset(verifysort_nr),
2397 .help = "Pre-load and sort verify blocks for a read workload",
2398 .minval = 0,
2399 .maxval = 131072,
2400 .def = "1024",
2401 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002402 .category = FIO_OPT_C_IO,
2403 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002404 },
2405 {
Jens Axboea59e1702007-07-30 08:53:27 +02002406 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002407 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002408 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002409 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002410 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002411 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002412 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002413 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002414 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002417 },
2418 {
Jens Axboea59e1702007-07-30 08:53:27 +02002419 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002420 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002421 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002422 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002423 .off1 = td_var_offset(verify_offset),
2424 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002425 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002426 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002429 },
2430 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002431 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002432 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002433 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002434 .cb = str_verify_pattern_cb,
2435 .help = "Fill pattern for IO buffers",
2436 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002437 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002438 .category = FIO_OPT_C_IO,
2439 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002440 },
2441 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002442 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002443 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002444 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002445 .off1 = td_var_offset(verify_fatal),
2446 .def = "0",
2447 .help = "Exit on a single verify failure, don't continue",
2448 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002449 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002452 },
2453 {
Jens Axboeb463e932011-01-12 09:03:23 +01002454 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002455 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002456 .type = FIO_OPT_BOOL,
2457 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002458 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002459 .help = "Dump contents of good and bad blocks on failure",
2460 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002461 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002464 },
2465 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002466 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002467 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002468 .type = FIO_OPT_INT,
2469 .off1 = td_var_offset(verify_async),
2470 .def = "0",
2471 .help = "Number of async verifier threads to use",
2472 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002473 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002474 .category = FIO_OPT_C_IO,
2475 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002476 },
Jens Axboe9e144182010-06-15 14:25:36 +02002477 {
2478 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002479 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002480 .type = FIO_OPT_STR_VAL,
2481 .off1 = td_var_offset(verify_backlog),
2482 .help = "Verify after this number of blocks are written",
2483 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002484 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002487 },
2488 {
2489 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002490 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002491 .type = FIO_OPT_INT,
2492 .off1 = td_var_offset(verify_batch),
2493 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002494 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002495 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002498 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002499#ifdef FIO_HAVE_CPU_AFFINITY
2500 {
2501 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002502 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002503 .type = FIO_OPT_STR,
2504 .cb = str_verify_cpus_allowed_cb,
2505 .help = "Set CPUs allowed for async verify threads",
2506 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002507 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002510 },
2511#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002512 {
2513 .name = "experimental_verify",
2514 .off1 = td_var_offset(experimental_verify),
2515 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002516 .help = "Enable experimental verification",
Jens Axboe836fcc02013-01-24 09:08:45 -07002517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002519 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002520#ifdef FIO_HAVE_TRIM
2521 {
2522 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002523 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002524 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002525 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002526 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002527 .maxval = 100,
2528 .help = "Number of verify blocks to discard/trim",
2529 .parent = "verify",
2530 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002531 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002532 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002535 },
2536 {
2537 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002538 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002539 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002540 .help = "Verify that trim/discarded blocks are returned as zeroes",
2541 .off1 = td_var_offset(trim_zero),
2542 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002543 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002544 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002545 .category = FIO_OPT_C_IO,
2546 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002547 },
2548 {
2549 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002550 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002551 .type = FIO_OPT_STR_VAL,
2552 .off1 = td_var_offset(trim_backlog),
2553 .help = "Trim after this number of blocks are written",
2554 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002555 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002556 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002557 .category = FIO_OPT_C_IO,
2558 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002559 },
2560 {
2561 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002562 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(trim_batch),
2565 .help = "Trim this number of IO blocks",
2566 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002567 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002568 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002571 },
2572#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002573 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002574 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002575 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002576 .type = FIO_OPT_STR_STORE,
2577 .off1 = td_var_offset(write_iolog_file),
2578 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002581 },
2582 {
2583 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002584 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002585 .type = FIO_OPT_STR_STORE,
2586 .off1 = td_var_offset(read_iolog_file),
2587 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002590 },
2591 {
David Nellans64bbb862010-08-24 22:13:30 +02002592 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002593 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002594 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002595 .off1 = td_var_offset(no_stall),
2596 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002597 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002598 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002599 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002600 .category = FIO_OPT_C_IO,
2601 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002602 },
2603 {
David Nellansd1c46c02010-08-31 21:20:47 +02002604 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002605 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002606 .type = FIO_OPT_STR_STORE,
2607 .off1 = td_var_offset(replay_redirect),
2608 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002609 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002610 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002613 },
2614 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002615 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002616 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002617 .type = FIO_OPT_STR_STORE,
2618 .off1 = td_var_offset(exec_prerun),
2619 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002620 .category = FIO_OPT_C_GENERAL,
2621 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002622 },
2623 {
2624 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002625 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002626 .type = FIO_OPT_STR_STORE,
2627 .off1 = td_var_offset(exec_postrun),
2628 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002629 .category = FIO_OPT_C_GENERAL,
2630 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002631 },
2632#ifdef FIO_HAVE_IOSCHED_SWITCH
2633 {
2634 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002635 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002636 .type = FIO_OPT_STR_STORE,
2637 .off1 = td_var_offset(ioscheduler),
2638 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002639 .category = FIO_OPT_C_FILE,
2640 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002641 },
2642#endif
2643 {
2644 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002645 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002646 .type = FIO_OPT_STR_VAL,
2647 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002648 .help = "Amount of data to read per zone",
2649 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002650 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002651 .category = FIO_OPT_C_IO,
2652 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002653 },
2654 {
2655 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002656 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002657 .type = FIO_OPT_STR_VAL,
2658 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002659 .help = "Give size of an IO zone",
2660 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002661 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002664 },
2665 {
2666 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002667 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_skip),
2670 .help = "Space between IO zones",
2671 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002672 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002675 },
2676 {
2677 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002678 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002679 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002680 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002681 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002682 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002683 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002684 .category = FIO_OPT_C_GENERAL,
2685 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002686 },
2687 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002689 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002690 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002691 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002692 .maxval = 100,
2693 .help = "Percentage of mixed workload that is reads",
2694 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002695 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002696 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002699 },
2700 {
2701 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002702 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002703 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002704 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002705 .maxval = 100,
2706 .help = "Percentage of mixed workload that is writes",
2707 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002708 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002709 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002712 },
2713 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002714 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002715 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002716 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002717 .category = FIO_OPT_C_IO,
2718 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002719 },
2720 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002721 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002722 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002723 .type = FIO_OPT_INT,
2724 .off1 = td_var_offset(nice),
2725 .help = "Set job CPU nice value",
2726 .minval = -19,
2727 .maxval = 20,
2728 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002729 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002730 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002731 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002732 },
2733#ifdef FIO_HAVE_IOPRIO
2734 {
2735 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002736 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002737 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002738 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002739 .help = "Set job IO priority value",
2740 .minval = 0,
2741 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002742 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002743 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002744 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002745 },
2746 {
2747 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002748 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002749 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002750 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002751 .help = "Set job IO priority class",
2752 .minval = 0,
2753 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002754 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002755 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002756 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002757 },
2758#endif
2759 {
2760 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002761 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002762 .type = FIO_OPT_INT,
2763 .off1 = td_var_offset(thinktime),
2764 .help = "Idle time between IO buffers (usec)",
2765 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002766 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002767 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002768 },
2769 {
2770 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002771 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002772 .type = FIO_OPT_INT,
2773 .off1 = td_var_offset(thinktime_spin),
2774 .help = "Start think time by spinning this amount (usec)",
2775 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002776 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002777 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002778 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002779 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002780 },
2781 {
2782 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002783 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002784 .type = FIO_OPT_INT,
2785 .off1 = td_var_offset(thinktime_blocks),
2786 .help = "IO buffer period between 'thinktime'",
2787 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002788 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002789 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002790 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002791 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002792 },
2793 {
2794 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002795 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002796 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002797 .off1 = td_var_offset(rate[DDIR_READ]),
2798 .off2 = td_var_offset(rate[DDIR_WRITE]),
2799 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002800 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002803 },
2804 {
2805 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002807 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002808 .off1 = td_var_offset(ratemin[DDIR_READ]),
2809 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2810 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002811 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002812 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002813 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002816 },
2817 {
2818 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002819 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002820 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002821 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2822 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2823 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002824 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002825 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002826 .category = FIO_OPT_C_IO,
2827 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002828 },
2829 {
2830 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002831 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002832 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002833 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2834 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2835 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002836 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002837 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002838 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002839 .category = FIO_OPT_C_IO,
2840 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002841 },
2842 {
2843 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002844 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002845 .type = FIO_OPT_INT,
2846 .off1 = td_var_offset(ratecycle),
2847 .help = "Window average for rate limits (msec)",
2848 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002849 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002850 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002853 },
2854 {
Jens Axboe15501532012-10-24 16:37:45 +02002855 .name = "max_latency",
2856 .type = FIO_OPT_INT,
2857 .off1 = td_var_offset(max_latency),
2858 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe1e5324e2012-11-14 14:25:31 -07002859 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002860 .group = FIO_OPT_G_LATPROF,
2861 },
2862 {
2863 .name = "latency_target",
2864 .lname = "Latency Target (usec)",
2865 .type = FIO_OPT_STR_VAL_TIME,
2866 .off1 = td_var_offset(latency_target),
2867 .help = "Ramp to max queue depth supporting this latency",
2868 .category = FIO_OPT_C_IO,
2869 .group = FIO_OPT_G_LATPROF,
2870 },
2871 {
2872 .name = "latency_window",
2873 .lname = "Latency Window (usec)",
2874 .type = FIO_OPT_STR_VAL_TIME,
2875 .off1 = td_var_offset(latency_window),
2876 .help = "Time to sustain latency_target",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_LATPROF,
2879 },
2880 {
2881 .name = "latency_percentile",
2882 .lname = "Latency Percentile",
2883 .type = FIO_OPT_FLOAT_LIST,
2884 .off1 = td_var_offset(latency_percentile),
2885 .help = "Percentile of IOs must be below latency_target",
2886 .def = "100",
2887 .maxlen = 1,
2888 .minfp = 0.0,
2889 .maxfp = 100.0,
2890 .category = FIO_OPT_C_IO,
2891 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002892 },
2893 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002894 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002895 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002896 .type = FIO_OPT_BOOL,
2897 .off1 = td_var_offset(invalidate_cache),
2898 .help = "Invalidate buffer/page cache prior to running job",
2899 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002900 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002901 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002902 },
2903 {
2904 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002905 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002906 .type = FIO_OPT_BOOL,
2907 .off1 = td_var_offset(sync_io),
2908 .help = "Use O_SYNC for buffered writes",
2909 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002910 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002911 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002912 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002913 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002914 },
2915 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002916 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002917 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002918 .type = FIO_OPT_BOOL,
2919 .off1 = td_var_offset(create_serialize),
2920 .help = "Serialize creating of job files",
2921 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002922 .category = FIO_OPT_C_FILE,
2923 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002924 },
2925 {
2926 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002927 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002928 .type = FIO_OPT_BOOL,
2929 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002930 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002931 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002932 .category = FIO_OPT_C_FILE,
2933 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002934 },
2935 {
Jens Axboe814452b2009-03-04 12:53:13 +01002936 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002937 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002938 .type = FIO_OPT_BOOL,
2939 .off1 = td_var_offset(create_on_open),
2940 .help = "Create files when they are opened for IO",
2941 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002942 .category = FIO_OPT_C_FILE,
2943 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002944 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002945 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002946 .name = "create_only",
2947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_only),
2949 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002950 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002951 .def = "0",
2952 },
2953 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002954 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002955 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002956 .type = FIO_OPT_BOOL,
2957 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002958 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002959 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002960 .category = FIO_OPT_C_FILE,
2961 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002962 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002963#ifdef FIO_HAVE_CPU_AFFINITY
2964 {
2965 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002967 .type = FIO_OPT_INT,
2968 .cb = str_cpumask_cb,
2969 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002970 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002971 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002972 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002973 {
2974 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002975 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002976 .type = FIO_OPT_STR,
2977 .cb = str_cpus_allowed_cb,
2978 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002979 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002980 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002981 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002982 {
2983 .name = "cpus_allowed_policy",
2984 .lname = "CPUs allowed distribution policy",
2985 .type = FIO_OPT_STR,
2986 .off1 = td_var_offset(cpus_allowed_policy),
2987 .help = "Distribution policy for cpus_allowed",
2988 .parent = "cpus_allowed",
2989 .prio = 1,
2990 .posval = {
2991 { .ival = "shared",
2992 .oval = FIO_CPUS_SHARED,
2993 .help = "Mask shared between threads",
2994 },
2995 { .ival = "split",
2996 .oval = FIO_CPUS_SPLIT,
2997 .help = "Mask split between threads",
2998 },
2999 },
3000 .category = FIO_OPT_C_GENERAL,
3001 .group = FIO_OPT_G_CRED,
3002 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003003#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003004#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003005 {
3006 .name = "numa_cpu_nodes",
3007 .type = FIO_OPT_STR,
3008 .cb = str_numa_cpunodes_cb,
3009 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003010 .category = FIO_OPT_C_GENERAL,
3011 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003012 },
3013 {
3014 .name = "numa_mem_policy",
3015 .type = FIO_OPT_STR,
3016 .cb = str_numa_mpol_cb,
3017 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003020 },
3021#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003022 {
3023 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003024 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003025 .type = FIO_OPT_BOOL,
3026 .off1 = td_var_offset(end_fsync),
3027 .help = "Include fsync at the end of job",
3028 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003029 .category = FIO_OPT_C_FILE,
3030 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003031 },
3032 {
3033 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003034 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003035 .type = FIO_OPT_BOOL,
3036 .off1 = td_var_offset(fsync_on_close),
3037 .help = "fsync files on close",
3038 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003039 .category = FIO_OPT_C_FILE,
3040 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003041 },
3042 {
3043 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003044 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003045 .type = FIO_OPT_BOOL,
3046 .off1 = td_var_offset(unlink),
3047 .help = "Unlink created files after job has completed",
3048 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003049 .category = FIO_OPT_C_FILE,
3050 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003051 },
3052 {
3053 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003054 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003055 .type = FIO_OPT_STR_SET,
3056 .cb = str_exitall_cb,
3057 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003058 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003059 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003060 },
3061 {
3062 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003063 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003064 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003065 .type = FIO_OPT_STR_SET,
3066 .off1 = td_var_offset(stonewall),
3067 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003068 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003069 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003070 },
3071 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003072 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003073 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003074 .type = FIO_OPT_STR_SET,
3075 .off1 = td_var_offset(new_group),
3076 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003077 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003078 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003079 },
3080 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003081 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003082 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003083 .type = FIO_OPT_STR_SET,
3084 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003085 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003086#ifdef CONFIG_NO_SHM
3087 .def = "1",
3088 .no_warn_def = 1,
3089#endif
Jens Axboee8b0e952012-03-19 14:37:08 +01003090 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003091 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003092 },
3093 {
3094 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003095 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003096 .type = FIO_OPT_STR_STORE,
3097 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003098 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003099 .category = FIO_OPT_C_LOG,
3100 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003101 },
3102 {
3103 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003104 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003105 .type = FIO_OPT_STR_STORE,
3106 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003107 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003108 .category = FIO_OPT_C_LOG,
3109 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003110 },
3111 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003112 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003113 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003114 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003115 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003116 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003117 .category = FIO_OPT_C_LOG,
3118 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003119 },
3120 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003121 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003122 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003123 .type = FIO_OPT_INT,
3124 .off1 = td_var_offset(log_avg_msec),
3125 .help = "Average bw/iops/lat logs over this period of time",
3126 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003127 .category = FIO_OPT_C_LOG,
3128 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003129 },
3130 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003131 .name = "log_offset",
3132 .lname = "Log offset of IO",
3133 .type = FIO_OPT_BOOL,
3134 .off1 = td_var_offset(log_offset),
3135 .help = "Include offset of IO for each log entry",
3136 .def = "0",
3137 .category = FIO_OPT_C_LOG,
3138 .group = FIO_OPT_G_INVALID,
3139 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003140#ifdef CONFIG_ZLIB
3141 {
3142 .name = "log_compression",
3143 .lname = "Log compression",
3144 .type = FIO_OPT_INT,
3145 .off1 = td_var_offset(log_gz),
3146 .help = "Log in compressed chunks of this size",
3147 .minval = 32 * 1024 * 1024ULL,
3148 .maxval = 512 * 1024 * 1024ULL,
3149 .category = FIO_OPT_C_LOG,
3150 .group = FIO_OPT_G_INVALID,
3151 },
Jens Axboebac4af12014-07-03 13:42:28 -06003152 {
3153 .name = "log_store_compressed",
3154 .lname = "Log store compressed",
3155 .type = FIO_OPT_BOOL,
3156 .off1 = td_var_offset(log_gz_store),
3157 .help = "Store logs in a compressed format",
3158 .category = FIO_OPT_C_LOG,
3159 .group = FIO_OPT_G_INVALID,
3160 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003161#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003162 {
Jens Axboec504ee52012-03-20 11:29:09 +01003163 .name = "bwavgtime",
3164 .lname = "Bandwidth average time",
3165 .type = FIO_OPT_INT,
3166 .off1 = td_var_offset(bw_avg_time),
3167 .help = "Time window over which to calculate bandwidth"
3168 " (msec)",
3169 .def = "500",
3170 .parent = "write_bw_log",
3171 .hide = 1,
3172 .interval = 100,
3173 .category = FIO_OPT_C_LOG,
3174 .group = FIO_OPT_G_INVALID,
3175 },
3176 {
3177 .name = "iopsavgtime",
3178 .lname = "IOPS average time",
3179 .type = FIO_OPT_INT,
3180 .off1 = td_var_offset(iops_avg_time),
3181 .help = "Time window over which to calculate IOPS (msec)",
3182 .def = "500",
3183 .parent = "write_iops_log",
3184 .hide = 1,
3185 .interval = 100,
3186 .category = FIO_OPT_C_LOG,
3187 .group = FIO_OPT_G_INVALID,
3188 },
3189 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003190 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003191 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003192 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003193 .off1 = td_var_offset(group_reporting),
3194 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003195 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003196 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003197 },
3198 {
Jens Axboee9459e52007-04-17 15:46:32 +02003199 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003200 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003201 .type = FIO_OPT_STR_SET,
3202 .off1 = td_var_offset(zero_buffers),
3203 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003204 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003205 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003206 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003207 {
3208 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003209 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003210 .type = FIO_OPT_STR_SET,
3211 .off1 = td_var_offset(refill_buffers),
3212 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003213 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003214 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003215 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003216 {
Jens Axboefd684182011-09-19 09:24:44 +02003217 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003218 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003219 .type = FIO_OPT_BOOL,
3220 .off1 = td_var_offset(scramble_buffers),
3221 .help = "Slightly scramble buffers on every IO submit",
3222 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003223 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003224 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003225 },
3226 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003227 .name = "buffer_pattern",
3228 .lname = "Buffer pattern",
3229 .type = FIO_OPT_STR,
3230 .cb = str_buffer_pattern_cb,
3231 .help = "Fill pattern for IO buffers",
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_IO_BUF,
3234 },
3235 {
Jens Axboe9c426842012-03-02 21:02:12 +01003236 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003237 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003238 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003239 .cb = str_buffer_compress_cb,
Jens Axboe9c426842012-03-02 21:02:12 +01003240 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003241 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003242 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003243 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003244 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003245 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003246 },
3247 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003248 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003249 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003250 .type = FIO_OPT_INT,
3251 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003252 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003253 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003254 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003255 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003256 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003257 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003258 },
3259 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003260 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003261 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003262 .type = FIO_OPT_BOOL,
3263 .off1 = td_var_offset(clat_percentiles),
3264 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003265 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003266 .category = FIO_OPT_C_STAT,
3267 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003268 },
3269 {
3270 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003271 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003272 .type = FIO_OPT_FLOAT_LIST,
3273 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003274 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003275 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003276 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
Yu-ju Hong83349192011-08-13 00:53:44 +02003277 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3278 .minfp = 0.0,
3279 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003280 .category = FIO_OPT_C_STAT,
3281 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003282 },
3283
Jens Axboe0a839f32007-04-26 09:02:34 +02003284#ifdef FIO_HAVE_DISK_UTIL
3285 {
3286 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003287 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003288 .type = FIO_OPT_BOOL,
3289 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003290 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003291 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003292 .category = FIO_OPT_C_STAT,
3293 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003294 },
3295#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003296 {
Jens Axboe993bf482008-11-14 13:04:53 +01003297 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003298 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003299 .type = FIO_OPT_BOOL,
3300 .help = "Greatly reduce number of gettimeofday() calls",
3301 .cb = str_gtod_reduce_cb,
3302 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003303 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003304 .category = FIO_OPT_C_STAT,
3305 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003306 },
3307 {
Jens Axboe02af0982010-06-24 09:59:34 +02003308 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003309 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(disable_lat),
3312 .help = "Disable latency numbers",
3313 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003314 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003315 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003316 .category = FIO_OPT_C_STAT,
3317 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003318 },
3319 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003320 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003321 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003322 .type = FIO_OPT_BOOL,
3323 .off1 = td_var_offset(disable_clat),
3324 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003325 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003326 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003327 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003328 .category = FIO_OPT_C_STAT,
3329 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003330 },
3331 {
3332 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003333 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003334 .type = FIO_OPT_BOOL,
3335 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003336 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003337 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003338 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003339 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003340 .category = FIO_OPT_C_STAT,
3341 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003342 },
3343 {
3344 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003345 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003346 .type = FIO_OPT_BOOL,
3347 .off1 = td_var_offset(disable_bw),
3348 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003349 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003350 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003351 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003352 .category = FIO_OPT_C_STAT,
3353 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003354 },
3355 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003356 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003357 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003358 .type = FIO_OPT_INT,
3359 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003360 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003361 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003362 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003363 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003364 },
3365 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003366 .name = "unified_rw_reporting",
3367 .type = FIO_OPT_BOOL,
3368 .off1 = td_var_offset(unified_rw_rep),
3369 .help = "Unify reporting across data direction",
3370 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003371 .category = FIO_OPT_C_GENERAL,
3372 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003373 },
3374 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003375 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003376 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003377 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003378 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003379 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003380 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003381 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003382 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003383 .posval = {
3384 { .ival = "none",
3385 .oval = ERROR_TYPE_NONE,
3386 .help = "Exit when an error is encountered",
3387 },
3388 { .ival = "read",
3389 .oval = ERROR_TYPE_READ,
3390 .help = "Continue on read errors only",
3391 },
3392 { .ival = "write",
3393 .oval = ERROR_TYPE_WRITE,
3394 .help = "Continue on write errors only",
3395 },
3396 { .ival = "io",
3397 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3398 .help = "Continue on any IO errors",
3399 },
3400 { .ival = "verify",
3401 .oval = ERROR_TYPE_VERIFY,
3402 .help = "Continue on verify errors only",
3403 },
3404 { .ival = "all",
3405 .oval = ERROR_TYPE_ANY,
3406 .help = "Continue on all io and verify errors",
3407 },
3408 { .ival = "0",
3409 .oval = ERROR_TYPE_NONE,
3410 .help = "Alias for 'none'",
3411 },
3412 { .ival = "1",
3413 .oval = ERROR_TYPE_ANY,
3414 .help = "Alias for 'all'",
3415 },
3416 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003417 },
3418 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003419 .name = "ignore_error",
3420 .type = FIO_OPT_STR,
3421 .cb = str_ignore_error_cb,
3422 .help = "Set a specific list of errors to ignore",
3423 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003424 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003425 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003426 },
3427 {
3428 .name = "error_dump",
3429 .type = FIO_OPT_BOOL,
3430 .off1 = td_var_offset(error_dump),
3431 .def = "0",
3432 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003433 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003434 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003435 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003436 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003437 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003438 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003439 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003440 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003441 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003442 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003443 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003444 },
3445 {
Jens Axboea696fa22009-12-04 10:05:02 +01003446 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003447 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003448 .type = FIO_OPT_STR_STORE,
3449 .off1 = td_var_offset(cgroup),
3450 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003451 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003452 .group = FIO_OPT_G_CGROUP,
3453 },
3454 {
3455 .name = "cgroup_nodelete",
3456 .lname = "Cgroup no-delete",
3457 .type = FIO_OPT_BOOL,
3458 .off1 = td_var_offset(cgroup_nodelete),
3459 .help = "Do not delete cgroups after job completion",
3460 .def = "0",
3461 .parent = "cgroup",
3462 .category = FIO_OPT_C_GENERAL,
3463 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003464 },
3465 {
3466 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003467 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003468 .type = FIO_OPT_INT,
3469 .off1 = td_var_offset(cgroup_weight),
3470 .help = "Use given weight for cgroup",
3471 .minval = 100,
3472 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003473 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003474 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003475 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003476 },
3477 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003478 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003479 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003480 .type = FIO_OPT_INT,
3481 .off1 = td_var_offset(uid),
3482 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003483 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003484 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003485 },
3486 {
3487 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003488 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003489 .type = FIO_OPT_INT,
3490 .off1 = td_var_offset(gid),
3491 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003492 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003493 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003494 },
3495 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003496 .name = "kb_base",
3497 .lname = "KB Base",
3498 .type = FIO_OPT_INT,
3499 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003500 .prio = 1,
3501 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003502 .posval = {
3503 { .ival = "1024",
3504 .oval = 1024,
3505 .help = "Use 1024 as the K base",
3506 },
3507 { .ival = "1000",
3508 .oval = 1000,
3509 .help = "Use 1000 as the K base",
3510 },
3511 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003512 .help = "How many bytes per KB for reporting (1000 or 1024)",
3513 .category = FIO_OPT_C_GENERAL,
3514 .group = FIO_OPT_G_INVALID,
3515 },
3516 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003517 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003518 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003519 .type = FIO_OPT_INT,
3520 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003521 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003522 .posval = {
3523 { .ival = "0",
3524 .oval = 0,
3525 .help = "Auto-detect",
3526 },
3527 { .ival = "8",
3528 .oval = 8,
3529 .help = "Normal (byte based)",
3530 },
3531 { .ival = "1",
3532 .oval = 1,
3533 .help = "Bit based",
3534 },
3535 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003536 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3537 .category = FIO_OPT_C_GENERAL,
3538 .group = FIO_OPT_G_INVALID,
3539 },
3540 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003541 .name = "hugepage-size",
3542 .lname = "Hugepage size",
3543 .type = FIO_OPT_INT,
3544 .off1 = td_var_offset(hugepage_size),
3545 .help = "When using hugepages, specify size of each page",
3546 .def = __fio_stringify(FIO_HUGE_PAGE),
3547 .interval = 1024 * 1024,
3548 .category = FIO_OPT_C_GENERAL,
3549 .group = FIO_OPT_G_INVALID,
3550 },
3551 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003552 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003553 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003554 .type = FIO_OPT_INT,
3555 .off1 = td_var_offset(flow_id),
3556 .help = "The flow index ID to use",
3557 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003558 .category = FIO_OPT_C_IO,
3559 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003560 },
3561 {
3562 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003563 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003564 .type = FIO_OPT_INT,
3565 .off1 = td_var_offset(flow),
3566 .help = "Weight for flow control of this job",
3567 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003568 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003569 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003570 .category = FIO_OPT_C_IO,
3571 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003572 },
3573 {
3574 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003575 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003576 .type = FIO_OPT_INT,
3577 .off1 = td_var_offset(flow_watermark),
3578 .help = "High watermark for flow control. This option"
3579 " should be set to the same value for all threads"
3580 " with non-zero flow.",
3581 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003582 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003583 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003584 .category = FIO_OPT_C_IO,
3585 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003586 },
3587 {
3588 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003589 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003590 .type = FIO_OPT_INT,
3591 .off1 = td_var_offset(flow_sleep),
3592 .help = "How many microseconds to sleep after being held"
3593 " back by the flow control mechanism",
3594 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003595 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003596 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003597 .category = FIO_OPT_C_IO,
3598 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003599 },
3600 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003601 .name = NULL,
3602 },
3603};
3604
Jens Axboe17af15d2010-04-13 10:38:16 +02003605static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003606 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003607{
Jens Axboe17af15d2010-04-13 10:38:16 +02003608 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003609 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003610 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003611 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003612 else
3613 lopt->has_arg = required_argument;
3614}
3615
Steven Langde890a12011-11-09 14:03:34 +01003616static void options_to_lopts(struct fio_option *opts,
3617 struct option *long_options,
3618 int i, int option_type)
3619{
3620 struct fio_option *o = &opts[0];
3621 while (o->name) {
3622 add_to_lopt(&long_options[i], o, o->name, option_type);
3623 if (o->alias) {
3624 i++;
3625 add_to_lopt(&long_options[i], o, o->alias, option_type);
3626 }
3627
3628 i++;
3629 o++;
3630 assert(i < FIO_NR_OPTIONS);
3631 }
3632}
3633
3634void fio_options_set_ioengine_opts(struct option *long_options,
3635 struct thread_data *td)
3636{
3637 unsigned int i;
3638
3639 i = 0;
3640 while (long_options[i].name) {
3641 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3642 memset(&long_options[i], 0, sizeof(*long_options));
3643 break;
3644 }
3645 i++;
3646 }
3647
3648 /*
3649 * Just clear out the prior ioengine options.
3650 */
3651 if (!td || !td->eo)
3652 return;
3653
3654 options_to_lopts(td->io_ops->options, long_options, i,
3655 FIO_GETOPT_IOENGINE);
3656}
3657
Jens Axboe214e1ec2007-03-15 10:48:13 +01003658void fio_options_dup_and_init(struct option *long_options)
3659{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003660 unsigned int i;
3661
Jens Axboe9af4a242012-03-16 10:13:49 +01003662 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003663
3664 i = 0;
3665 while (long_options[i].name)
3666 i++;
3667
Jens Axboe9af4a242012-03-16 10:13:49 +01003668 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003669}
3670
Jens Axboe74929ac2009-08-05 11:42:37 +02003671struct fio_keyword {
3672 const char *word;
3673 const char *desc;
3674 char *replace;
3675};
3676
3677static struct fio_keyword fio_keywords[] = {
3678 {
3679 .word = "$pagesize",
3680 .desc = "Page size in the system",
3681 },
3682 {
3683 .word = "$mb_memory",
3684 .desc = "Megabytes of memory online",
3685 },
3686 {
3687 .word = "$ncpus",
3688 .desc = "Number of CPUs online in the system",
3689 },
3690 {
3691 .word = NULL,
3692 },
3693};
3694
3695void fio_keywords_init(void)
3696{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003697 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003698 char buf[128];
3699 long l;
3700
Jens Axboea4cfc472012-10-09 10:30:48 -06003701 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003702 fio_keywords[0].replace = strdup(buf);
3703
Jens Axboe8eb016d2011-07-11 10:24:20 +02003704 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003705 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003706 fio_keywords[1].replace = strdup(buf);
3707
Jens Axboec00a2282011-07-08 20:56:06 +02003708 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003709 sprintf(buf, "%lu", l);
3710 fio_keywords[2].replace = strdup(buf);
3711}
3712
Jens Axboe892a6ff2009-11-13 12:19:49 +01003713#define BC_APP "bc"
3714
3715static char *bc_calc(char *str)
3716{
Steven Langd0c814e2011-10-28 08:37:13 +02003717 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003718 FILE *f;
3719 int ret;
3720
3721 /*
3722 * No math, just return string
3723 */
Steven Langd0c814e2011-10-28 08:37:13 +02003724 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3725 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003726 return str;
3727
3728 /*
3729 * Split option from value, we only need to calculate the value
3730 */
3731 tmp = strchr(str, '=');
3732 if (!tmp)
3733 return str;
3734
3735 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003736
Steven Langd0c814e2011-10-28 08:37:13 +02003737 /*
3738 * Prevent buffer overflows; such a case isn't reasonable anyway
3739 */
3740 if (strlen(str) >= 128 || strlen(tmp) > 100)
3741 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003742
3743 sprintf(buf, "which %s > /dev/null", BC_APP);
3744 if (system(buf)) {
3745 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003746 return NULL;
3747 }
3748
Steven Langd0c814e2011-10-28 08:37:13 +02003749 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003750 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003751 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003752 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003753
Steven Langd0c814e2011-10-28 08:37:13 +02003754 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003755 if (ret <= 0) {
3756 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003757 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003758 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003759
Jens Axboe892a6ff2009-11-13 12:19:49 +01003760 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003761 buf[(tmp - str) + ret - 1] = '\0';
3762 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003763 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003764 return strdup(buf);
3765}
3766
3767/*
3768 * Return a copy of the input string with substrings of the form ${VARNAME}
3769 * substituted with the value of the environment variable VARNAME. The
3770 * substitution always occurs, even if VARNAME is empty or the corresponding
3771 * environment variable undefined.
3772 */
3773static char *option_dup_subs(const char *opt)
3774{
3775 char out[OPT_LEN_MAX+1];
3776 char in[OPT_LEN_MAX+1];
3777 char *outptr = out;
3778 char *inptr = in;
3779 char *ch1, *ch2, *env;
3780 ssize_t nchr = OPT_LEN_MAX;
3781 size_t envlen;
3782
3783 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3784 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3785 return NULL;
3786 }
3787
3788 in[OPT_LEN_MAX] = '\0';
3789 strncpy(in, opt, OPT_LEN_MAX);
3790
3791 while (*inptr && nchr > 0) {
3792 if (inptr[0] == '$' && inptr[1] == '{') {
3793 ch2 = strchr(inptr, '}');
3794 if (ch2 && inptr+1 < ch2) {
3795 ch1 = inptr+2;
3796 inptr = ch2+1;
3797 *ch2 = '\0';
3798
3799 env = getenv(ch1);
3800 if (env) {
3801 envlen = strlen(env);
3802 if (envlen <= nchr) {
3803 memcpy(outptr, env, envlen);
3804 outptr += envlen;
3805 nchr -= envlen;
3806 }
3807 }
3808
3809 continue;
3810 }
3811 }
3812
3813 *outptr++ = *inptr++;
3814 --nchr;
3815 }
3816
3817 *outptr = '\0';
3818 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003819}
3820
Jens Axboe74929ac2009-08-05 11:42:37 +02003821/*
3822 * Look for reserved variable names and replace them with real values
3823 */
3824static char *fio_keyword_replace(char *opt)
3825{
3826 char *s;
3827 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003828 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003829
3830 for (i = 0; fio_keywords[i].word != NULL; i++) {
3831 struct fio_keyword *kw = &fio_keywords[i];
3832
3833 while ((s = strstr(opt, kw->word)) != NULL) {
3834 char *new = malloc(strlen(opt) + 1);
3835 char *o_org = opt;
3836 int olen = s - opt;
3837 int len;
3838
3839 /*
3840 * Copy part of the string before the keyword and
3841 * sprintf() the replacement after it.
3842 */
3843 memcpy(new, opt, olen);
3844 len = sprintf(new + olen, "%s", kw->replace);
3845
3846 /*
3847 * If there's more in the original string, copy that
3848 * in too
3849 */
3850 opt += strlen(kw->word) + olen;
3851 if (strlen(opt))
3852 memcpy(new + olen + len, opt, opt - o_org - 1);
3853
3854 /*
3855 * replace opt and free the old opt
3856 */
3857 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003858 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003859
Steven Langd0c814e2011-10-28 08:37:13 +02003860 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003861 }
3862 }
3863
Steven Langd0c814e2011-10-28 08:37:13 +02003864 /*
3865 * Check for potential math and invoke bc, if possible
3866 */
3867 if (docalc)
3868 opt = bc_calc(opt);
3869
Jens Axboe7a958bd2009-11-13 12:33:54 +01003870 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003871}
3872
Steven Langd0c814e2011-10-28 08:37:13 +02003873static char **dup_and_sub_options(char **opts, int num_opts)
3874{
3875 int i;
3876 char **opts_copy = malloc(num_opts * sizeof(*opts));
3877 for (i = 0; i < num_opts; i++) {
3878 opts_copy[i] = option_dup_subs(opts[i]);
3879 if (!opts_copy[i])
3880 continue;
3881 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3882 }
3883 return opts_copy;
3884}
3885
Jens Axboe292cc472013-11-26 20:39:35 -07003886int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3887 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003888{
Steven Langde890a12011-11-09 14:03:34 +01003889 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003890 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003891
Jens Axboe9af4a242012-03-16 10:13:49 +01003892 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003893 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003894
Steven Langde890a12011-11-09 14:03:34 +01003895 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3896 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003897 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003898 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003899
Steven Langde890a12011-11-09 14:03:34 +01003900 if (opts_copy[i]) {
3901 if (newret && !o) {
3902 unknown++;
3903 continue;
3904 }
Steven Langd0c814e2011-10-28 08:37:13 +02003905 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003906 opts_copy[i] = NULL;
3907 }
3908
3909 ret |= newret;
3910 }
3911
3912 if (unknown) {
3913 ret |= ioengine_load(td);
3914 if (td->eo) {
3915 sort_options(opts_copy, td->io_ops->options, num_opts);
3916 opts = opts_copy;
3917 }
3918 for (i = 0; i < num_opts; i++) {
3919 struct fio_option *o = NULL;
3920 int newret = 1;
3921 if (!opts_copy[i])
3922 continue;
3923
3924 if (td->eo)
3925 newret = parse_option(opts_copy[i], opts[i],
3926 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003927 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003928
3929 ret |= newret;
3930 if (!o)
3931 log_err("Bad option <%s>\n", opts[i]);
3932
3933 free(opts_copy[i]);
3934 opts_copy[i] = NULL;
3935 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003936 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003937
Steven Langd0c814e2011-10-28 08:37:13 +02003938 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003939 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003940}
3941
3942int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3943{
Jens Axboe9af4a242012-03-16 10:13:49 +01003944 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003945}
3946
Steven Langde890a12011-11-09 14:03:34 +01003947int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3948 char *val)
3949{
Akinobu Mita8a96c802013-10-09 09:32:34 -06003950 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01003951}
3952
Jens Axboe214e1ec2007-03-15 10:48:13 +01003953void fio_fill_default_options(struct thread_data *td)
3954{
Jens Axboecb1402d2014-02-25 11:35:27 -08003955 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01003956 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003957}
3958
3959int fio_show_option_help(const char *opt)
3960{
Jens Axboe9af4a242012-03-16 10:13:49 +01003961 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003962}
Jens Axboed23bb322007-03-23 15:57:56 +01003963
Steven Langde890a12011-11-09 14:03:34 +01003964void options_mem_dupe(void *data, struct fio_option *options)
3965{
3966 struct fio_option *o;
3967 char **ptr;
3968
3969 for (o = &options[0]; o->name; o++) {
3970 if (o->type != FIO_OPT_STR_STORE)
3971 continue;
3972
Jens Axboef0fdbca2014-02-11 15:44:50 -07003973 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01003974 if (*ptr)
3975 *ptr = strdup(*ptr);
3976 }
3977}
3978
Jens Axboe7e356b22011-10-14 10:55:16 +02003979/*
3980 * dupe FIO_OPT_STR_STORE options
3981 */
Steven Langde890a12011-11-09 14:03:34 +01003982void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003983{
Jens Axboe9af4a242012-03-16 10:13:49 +01003984 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003985
3986 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003987 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003988
Steven Langde890a12011-11-09 14:03:34 +01003989 td->eo = malloc(td->io_ops->option_struct_size);
3990 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3991 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003992 }
3993}
3994
Jens Axboed6978a32009-07-18 21:04:09 +02003995unsigned int fio_get_kb_base(void *data)
3996{
Jens Axboe83ea4222012-03-28 14:01:46 +02003997 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02003998 unsigned int kb_base = 0;
3999
Jens Axboecb1402d2014-02-25 11:35:27 -08004000 /*
4001 * This is a hack... For private options, *data is not holding
4002 * a pointer to the thread_options, but to private data. This means
4003 * we can't safely dereference it, but magic is first so mem wise
4004 * it is valid. But this also means that if the job first sets
4005 * kb_base and expects that to be honored by private options,
4006 * it will be disappointed. We will return the global default
4007 * for this.
4008 */
4009 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004010 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004011 if (!kb_base)
4012 kb_base = 1024;
4013
4014 return kb_base;
4015}
Jens Axboe9f988e22010-03-04 10:42:38 +01004016
Jens Axboe07b32322010-03-05 09:48:44 +01004017int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004018{
Jens Axboe07b32322010-03-05 09:48:44 +01004019 struct fio_option *__o;
4020 int opt_index = 0;
4021
Jens Axboe9af4a242012-03-16 10:13:49 +01004022 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004023 while (__o->name) {
4024 opt_index++;
4025 __o++;
4026 }
4027
Jens Axboe7b504ed2014-02-11 14:19:38 -07004028 if (opt_index + 1 == FIO_MAX_OPTS) {
4029 log_err("fio: FIO_MAX_OPTS is too small\n");
4030 return 1;
4031 }
4032
Jens Axboe9af4a242012-03-16 10:13:49 +01004033 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004034 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004035 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004036}
Jens Axboee2de69d2010-03-04 14:05:48 +01004037
Jens Axboe07b32322010-03-05 09:48:44 +01004038void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004039{
Jens Axboe07b32322010-03-05 09:48:44 +01004040 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004041
Jens Axboe9af4a242012-03-16 10:13:49 +01004042 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004043 while (o->name) {
4044 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4045 o->type = FIO_OPT_INVALID;
4046 o->prof_name = NULL;
4047 }
4048 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004049 }
4050}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004051
4052void add_opt_posval(const char *optname, const char *ival, const char *help)
4053{
4054 struct fio_option *o;
4055 unsigned int i;
4056
Jens Axboe9af4a242012-03-16 10:13:49 +01004057 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004058 if (!o)
4059 return;
4060
4061 for (i = 0; i < PARSE_MAX_VP; i++) {
4062 if (o->posval[i].ival)
4063 continue;
4064
4065 o->posval[i].ival = ival;
4066 o->posval[i].help = help;
4067 break;
4068 }
4069}
4070
4071void del_opt_posval(const char *optname, const char *ival)
4072{
4073 struct fio_option *o;
4074 unsigned int i;
4075
Jens Axboe9af4a242012-03-16 10:13:49 +01004076 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004077 if (!o)
4078 return;
4079
4080 for (i = 0; i < PARSE_MAX_VP; i++) {
4081 if (!o->posval[i].ival)
4082 continue;
4083 if (strcmp(o->posval[i].ival, ival))
4084 continue;
4085
4086 o->posval[i].ival = NULL;
4087 o->posval[i].help = NULL;
4088 }
4089}
Jens Axboe7e356b22011-10-14 10:55:16 +02004090
4091void fio_options_free(struct thread_data *td)
4092{
Jens Axboe9af4a242012-03-16 10:13:49 +01004093 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004094 if (td->eo && td->io_ops && td->io_ops->options) {
4095 options_free(td->io_ops->options, td->eo);
4096 free(td->eo);
4097 td->eo = NULL;
4098 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004099}
Jens Axboec504ee52012-03-20 11:29:09 +01004100
4101struct fio_option *fio_option_find(const char *name)
4102{
4103 return find_option(fio_options, name);
4104}
4105