blob: 56e9108a8c35901aeffa67265555682791c2777c [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)
Jens Axboe03479882014-09-27 08:08:00 -0600101 perc = -1U;
Jens Axboe564ca972007-12-14 12:21:19 +0100102 } else
Jens Axboe03479882014-09-27 08:08:00 -0600103 perc = -1U;
Jens Axboe564ca972007-12-14 12:21:19 +0100104
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
Jens Axboe03479882014-09-27 08:08:00 -0600130 if (bsp->perc == -1U)
Jens Axboe564ca972007-12-14 12:21:19 +0100131 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 }
Jens Axboe03479882014-09-27 08:08:00 -0600141
Jens Axboe564ca972007-12-14 12:21:19 +0100142 /*
143 * If values didn't have a percentage set, divide the remains between
144 * them.
145 */
146 if (perc_missing) {
Jens Axboe03479882014-09-27 08:08:00 -0600147 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
Jens Axboef3cc9892014-09-15 18:51:32 -0600148 perc = 100;
Jens Axboe83ea4222012-03-28 14:01:46 +0200149 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200150 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100151
Jens Axboe03479882014-09-27 08:08:00 -0600152 if (bsp->perc == -1U)
Jens Axboe564ca972007-12-14 12:21:19 +0100153 bsp->perc = (100 - perc) / perc_missing;
154 }
155 }
156
Jens Axboe83ea4222012-03-28 14:01:46 +0200157 o->min_bs[ddir] = min_bs;
158 o->max_bs[ddir] = max_bs;
Jens Axboe564ca972007-12-14 12:21:19 +0100159
160 /*
161 * now sort based on percentages, for ease of lookup
162 */
Jens Axboe83ea4222012-03-28 14:01:46 +0200163 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
164 o->bssplit[ddir] = bssplit;
Jens Axboe720e84a2009-04-21 08:29:55 +0200165 return 0;
Jens Axboe720e84a2009-04-21 08:29:55 +0200166}
167
168static int str_bssplit_cb(void *data, const char *input)
169{
170 struct thread_data *td = data;
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200171 char *str, *p, *odir, *ddir;
Jens Axboe720e84a2009-04-21 08:29:55 +0200172 int ret = 0;
173
Jens Axboe52c0cea2013-09-06 10:07:37 -0600174 if (parse_dryrun())
175 return 0;
176
Jens Axboe720e84a2009-04-21 08:29:55 +0200177 p = str = strdup(input);
178
179 strip_blank_front(&str);
180 strip_blank_end(str);
181
182 odir = strchr(str, ',');
183 if (odir) {
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200184 ddir = strchr(odir + 1, ',');
185 if (ddir) {
Jens Axboed79db122012-09-24 08:51:24 +0200186 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200187 if (!ret)
188 *ddir = '\0';
189 } else {
190 char *op;
191
192 op = strdup(odir + 1);
Jens Axboed79db122012-09-24 08:51:24 +0200193 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200194
195 free(op);
196 }
Jens Axboed79db122012-09-24 08:51:24 +0200197 if (!ret)
198 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
Jens Axboe720e84a2009-04-21 08:29:55 +0200199 if (!ret) {
200 *odir = '\0';
Jens Axboe83ea4222012-03-28 14:01:46 +0200201 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200202 }
203 } else {
204 char *op;
205
206 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200207 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
Jens Axboe720e84a2009-04-21 08:29:55 +0200208 free(op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200209
210 if (!ret) {
211 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200212 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200213 free(op);
214 }
Jens Axboed79db122012-09-24 08:51:24 +0200215 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200216 }
Jens Axboe564ca972007-12-14 12:21:19 +0100217
218 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200219 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100220}
221
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400222static int str2error(char *str)
223{
Jens Axboea94eb992012-09-24 18:46:34 +0200224 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400225 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
226 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
227 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
228 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
229 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
230 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
Jens Axboea94eb992012-09-24 18:46:34 +0200231 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400232 int i = 0, num = sizeof(err) / sizeof(void *);
233
Jens Axboea94eb992012-09-24 18:46:34 +0200234 while (i < num) {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400235 if (!strcmp(err[i], str))
236 return i + 1;
237 i++;
238 }
239 return 0;
240}
241
242static int ignore_error_type(struct thread_data *td, int etype, char *str)
243{
244 unsigned int i;
245 int *error;
246 char *fname;
247
248 if (etype >= ERROR_TYPE_CNT) {
249 log_err("Illegal error type\n");
250 return 1;
251 }
252
253 td->o.ignore_error_nr[etype] = 4;
254 error = malloc(4 * sizeof(struct bssplit));
255
256 i = 0;
257 while ((fname = strsep(&str, ":")) != NULL) {
258
259 if (!strlen(fname))
260 break;
261
262 /*
263 * grow struct buffer, if needed
264 */
265 if (i == td->o.ignore_error_nr[etype]) {
266 td->o.ignore_error_nr[etype] <<= 1;
267 error = realloc(error, td->o.ignore_error_nr[etype]
268 * sizeof(int));
269 }
270 if (fname[0] == 'E') {
271 error[i] = str2error(fname);
272 } else {
273 error[i] = atoi(fname);
274 if (error[i] < 0)
Jens Axboe1616e022014-04-14 08:59:17 -0600275 error[i] = -error[i];
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400276 }
277 if (!error[i]) {
278 log_err("Unknown error %s, please use number value \n",
279 fname);
Erwan Velu0fddbf72013-07-22 23:46:10 +0200280 free(error);
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400281 return 1;
282 }
283 i++;
284 }
285 if (i) {
286 td->o.continue_on_error |= 1 << etype;
287 td->o.ignore_error_nr[etype] = i;
288 td->o.ignore_error[etype] = error;
Jens Axboec7b086b2014-04-11 11:20:29 -0600289 } else
290 free(error);
291
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400292 return 0;
293
294}
295
296static int str_ignore_error_cb(void *data, const char *input)
297{
298 struct thread_data *td = data;
299 char *str, *p, *n;
300 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600301
302 if (parse_dryrun())
303 return 0;
304
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400305 p = str = strdup(input);
306
307 strip_blank_front(&str);
308 strip_blank_end(str);
309
310 while (p) {
311 n = strchr(p, ',');
312 if (n)
313 *n++ = '\0';
314 ret = ignore_error_type(td, type, p);
315 if (ret)
316 break;
317 p = n;
318 type++;
319 }
320 free(str);
321 return ret;
322}
323
Jens Axboe211097b2007-03-22 18:56:45 +0100324static int str_rw_cb(void *data, const char *str)
325{
326 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200327 struct thread_options *o = &td->o;
Jens Axboe27ca9492014-04-11 11:25:32 -0600328 char *nr;
Jens Axboe211097b2007-03-22 18:56:45 +0100329
Jens Axboe52c0cea2013-09-06 10:07:37 -0600330 if (parse_dryrun())
331 return 0;
332
Jens Axboe83ea4222012-03-28 14:01:46 +0200333 o->ddir_seq_nr = 1;
334 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200335
Jens Axboe27ca9492014-04-11 11:25:32 -0600336 nr = get_opt_postfix(str);
Jens Axboe059b0802011-08-25 09:09:37 +0200337 if (!nr)
338 return 0;
339
340 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200341 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200342 else {
343 long long val;
344
Jens Axboe0de5b262014-02-21 15:26:01 -0800345 if (str_to_decimal(nr, &val, 1, o, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200346 log_err("fio: rw postfix parsing failed\n");
347 free(nr);
348 return 1;
349 }
350
Jens Axboe83ea4222012-03-28 14:01:46 +0200351 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100352 }
Jens Axboe211097b2007-03-22 18:56:45 +0100353
Jens Axboe059b0802011-08-25 09:09:37 +0200354 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100355 return 0;
356}
357
Jens Axboe214e1ec2007-03-15 10:48:13 +0100358static int str_mem_cb(void *data, const char *mem)
359{
360 struct thread_data *td = data;
361
Shaohua Lid9759b12013-01-17 13:28:15 +0100362 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700363 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100364
365 return 0;
366}
367
Jens Axboec223da82010-03-24 13:23:53 +0100368static int fio_clock_source_cb(void *data, const char *str)
369{
370 struct thread_data *td = data;
371
372 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100373 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100374 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100375 return 0;
376}
377
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400378static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200379{
380 struct thread_data *td = data;
381
382 td->o.rwmix[DDIR_READ] = *val;
383 td->o.rwmix[DDIR_WRITE] = 100 - *val;
384 return 0;
385}
386
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400387static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200388{
389 struct thread_data *td = data;
390
391 td->o.rwmix[DDIR_WRITE] = *val;
392 td->o.rwmix[DDIR_READ] = 100 - *val;
393 return 0;
394}
395
Jens Axboe214e1ec2007-03-15 10:48:13 +0100396static int str_exitall_cb(void)
397{
398 exitall_on_terminate = 1;
399 return 0;
400}
401
Jens Axboe214e1ec2007-03-15 10:48:13 +0100402#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800403int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800404{
Jens Axboe50b58602014-02-28 15:08:25 -0800405 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800406 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800407
Jens Axboe50b58602014-02-28 15:08:25 -0800408 cpus_in_mask = fio_cpu_count(mask);
409 cpu_index = cpu_index % cpus_in_mask;
410
411 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800412 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800413 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800414 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800415
416 if (cpu_index != index)
417 fio_cpu_clear(mask, i);
418
419 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800420 }
421
422 return fio_cpu_count(mask);
423}
424
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400425static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100426{
427 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200428 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100429 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100430 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100431
Jens Axboe52c0cea2013-09-06 10:07:37 -0600432 if (parse_dryrun())
433 return 0;
434
Jens Axboed2ce18b2008-12-12 20:51:40 +0100435 ret = fio_cpuset_init(&td->o.cpumask);
436 if (ret < 0) {
437 log_err("fio: cpuset_init failed\n");
438 td_verror(td, ret, "fio_cpuset_init");
439 return 1;
440 }
441
Jens Axboec00a2282011-07-08 20:56:06 +0200442 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200443
Jens Axboe62a72732008-12-08 11:37:01 +0100444 for (i = 0; i < sizeof(int) * 8; i++) {
445 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100446 if (i > max_cpu) {
447 log_err("fio: CPU %d too large (max=%ld)\n", i,
448 max_cpu);
449 return 1;
450 }
Jens Axboe62a72732008-12-08 11:37:01 +0100451 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100452 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100453 }
454 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200455
Jens Axboe375b2692007-05-22 09:13:02 +0200456 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100457 return 0;
458}
459
Jens Axboee8462bd2009-07-06 12:59:04 +0200460static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
461 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200462{
Jens Axboed2e268b2007-06-15 10:33:49 +0200463 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100464 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100465 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200466
Jens Axboee8462bd2009-07-06 12:59:04 +0200467 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100468 if (ret < 0) {
469 log_err("fio: cpuset_init failed\n");
470 td_verror(td, ret, "fio_cpuset_init");
471 return 1;
472 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200473
474 p = str = strdup(input);
475
476 strip_blank_front(&str);
477 strip_blank_end(str);
478
Jens Axboec00a2282011-07-08 20:56:06 +0200479 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100480
Jens Axboed2e268b2007-06-15 10:33:49 +0200481 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100482 char *str2, *cpu2;
483 int icpu, icpu2;
484
Jens Axboed2e268b2007-06-15 10:33:49 +0200485 if (!strlen(cpu))
486 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100487
488 str2 = cpu;
489 icpu2 = -1;
490 while ((cpu2 = strsep(&str2, "-")) != NULL) {
491 if (!strlen(cpu2))
492 break;
493
494 icpu2 = atoi(cpu2);
495 }
496
497 icpu = atoi(cpu);
498 if (icpu2 == -1)
499 icpu2 = icpu;
500 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100501 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100502 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100503 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100504 ret = 1;
505 break;
506 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100507 if (icpu > max_cpu) {
508 log_err("fio: CPU %d too large (max=%ld)\n",
509 icpu, max_cpu);
510 ret = 1;
511 break;
512 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200513
Jens Axboe62a72732008-12-08 11:37:01 +0100514 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200515 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100516 icpu++;
517 }
Jens Axboe19608d62008-12-08 15:03:12 +0100518 if (ret)
519 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200520 }
521
522 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100523 if (!ret)
524 td->o.cpumask_set = 1;
525 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200526}
Jens Axboee8462bd2009-07-06 12:59:04 +0200527
528static int str_cpus_allowed_cb(void *data, const char *input)
529{
530 struct thread_data *td = data;
531 int ret;
532
Jens Axboe52c0cea2013-09-06 10:07:37 -0600533 if (parse_dryrun())
534 return 0;
535
Jens Axboee8462bd2009-07-06 12:59:04 +0200536 ret = set_cpus_allowed(td, &td->o.cpumask, input);
537 if (!ret)
538 td->o.cpumask_set = 1;
539
540 return ret;
541}
542
543static int str_verify_cpus_allowed_cb(void *data, const char *input)
544{
545 struct thread_data *td = data;
546 int ret;
547
548 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
549 if (!ret)
550 td->o.verify_cpumask_set = 1;
551
552 return ret;
553}
Jens Axboed2e268b2007-06-15 10:33:49 +0200554#endif
555
Jens Axboe67bf9822013-01-10 11:23:19 +0100556#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400557static int str_numa_cpunodes_cb(void *data, char *input)
558{
559 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200560 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400561
Jens Axboe52c0cea2013-09-06 10:07:37 -0600562 if (parse_dryrun())
563 return 0;
564
Yufei Rend0b937e2012-10-19 23:11:52 -0400565 /* numa_parse_nodestring() parses a character string list
566 * of nodes into a bit mask. The bit mask is allocated by
567 * numa_allocate_nodemask(), so it should be freed by
568 * numa_free_nodemask().
569 */
Daniel Gollub43522842014-05-01 17:07:49 +0200570 verify_bitmask = numa_parse_nodestring(input);
571 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400572 log_err("fio: numa_parse_nodestring failed\n");
573 td_verror(td, 1, "str_numa_cpunodes_cb");
574 return 1;
575 }
Daniel Gollub43522842014-05-01 17:07:49 +0200576 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400577
Daniel Gollub43522842014-05-01 17:07:49 +0200578 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400579 td->o.numa_cpumask_set = 1;
580 return 0;
581}
582
583static int str_numa_mpol_cb(void *data, char *input)
584{
585 struct thread_data *td = data;
586 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600587 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400588 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600589 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200590 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400591
Jens Axboe52c0cea2013-09-06 10:07:37 -0600592 if (parse_dryrun())
593 return 0;
594
595 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400596 if (nodelist) {
597 /* NUL-terminate mode */
598 *nodelist++ = '\0';
599 }
600
601 for (i = 0; i <= MPOL_LOCAL; i++) {
602 if (!strcmp(input, policy_types[i])) {
603 td->o.numa_mem_mode = i;
604 break;
605 }
606 }
607 if (i > MPOL_LOCAL) {
608 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
609 goto out;
610 }
611
612 switch (td->o.numa_mem_mode) {
613 case MPOL_PREFERRED:
614 /*
615 * Insist on a nodelist of one node only
616 */
617 if (nodelist) {
618 char *rest = nodelist;
619 while (isdigit(*rest))
620 rest++;
621 if (*rest) {
622 log_err("fio: one node only for \'prefer\'\n");
623 goto out;
624 }
625 } else {
626 log_err("fio: one node is needed for \'prefer\'\n");
627 goto out;
628 }
629 break;
630 case MPOL_INTERLEAVE:
631 /*
632 * Default to online nodes with memory if no nodelist
633 */
634 if (!nodelist)
635 nodelist = strdup("all");
636 break;
637 case MPOL_LOCAL:
638 case MPOL_DEFAULT:
639 /*
640 * Don't allow a nodelist
641 */
642 if (nodelist) {
643 log_err("fio: NO nodelist for \'local\'\n");
644 goto out;
645 }
646 break;
647 case MPOL_BIND:
648 /*
649 * Insist on a nodelist
650 */
651 if (!nodelist) {
652 log_err("fio: a nodelist is needed for \'bind\'\n");
653 goto out;
654 }
655 break;
656 }
657
658
659 /* numa_parse_nodestring() parses a character string list
660 * of nodes into a bit mask. The bit mask is allocated by
661 * numa_allocate_nodemask(), so it should be freed by
662 * numa_free_nodemask().
663 */
664 switch (td->o.numa_mem_mode) {
665 case MPOL_PREFERRED:
666 td->o.numa_mem_prefer_node = atoi(nodelist);
667 break;
668 case MPOL_INTERLEAVE:
669 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200670 verify_bitmask = numa_parse_nodestring(nodelist);
671 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400672 log_err("fio: numa_parse_nodestring failed\n");
673 td_verror(td, 1, "str_numa_memnodes_cb");
674 return 1;
675 }
Daniel Gollub43522842014-05-01 17:07:49 +0200676 td->o.numa_memnodes = strdup(nodelist);
677 numa_free_nodemask(verify_bitmask);
Manish Mandlik44e2ab52014-08-14 11:45:16 -0600678
Yufei Rend0b937e2012-10-19 23:11:52 -0400679 break;
680 case MPOL_LOCAL:
681 case MPOL_DEFAULT:
682 default:
683 break;
684 }
685
686 td->o.numa_memmask_set = 1;
687 return 0;
688
689out:
690 return 1;
691}
692#endif
693
Jens Axboe214e1ec2007-03-15 10:48:13 +0100694static int str_fst_cb(void *data, const char *str)
695{
696 struct thread_data *td = data;
697 char *nr = get_opt_postfix(str);
698
699 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100700 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100701 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100702 free(nr);
703 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100704
705 return 0;
706}
707
Jens Axboe67bf9822013-01-10 11:23:19 +0100708#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100709static int str_sfr_cb(void *data, const char *str)
710{
711 struct thread_data *td = data;
712 char *nr = get_opt_postfix(str);
713
714 td->sync_file_range_nr = 1;
715 if (nr) {
716 td->sync_file_range_nr = atoi(nr);
717 free(nr);
718 }
719
720 return 0;
721}
Jens Axboe3ae06372010-03-19 19:17:15 +0100722#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100723
Jens Axboee25839d2012-11-06 10:49:42 +0100724static int str_random_distribution_cb(void *data, const char *str)
725{
726 struct thread_data *td = data;
727 double val;
728 char *nr;
729
Jens Axboe52c0cea2013-09-06 10:07:37 -0600730 if (parse_dryrun())
731 return 0;
732
Jens Axboe925fee32012-11-06 13:50:32 +0100733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
734 val = 1.1;
735 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
736 val = 0.2;
737 else
Jens Axboee25839d2012-11-06 10:49:42 +0100738 return 0;
739
740 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100741 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100742 log_err("fio: random postfix parsing failed\n");
743 free(nr);
744 return 1;
745 }
746
Jens Axboe078189c2012-11-07 13:47:22 +0100747 free(nr);
748
Jens Axboe18ded912012-11-08 08:36:00 +0100749 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
750 if (val == 1.00) {
751 log_err("fio: zipf theta must different than 1.0\n");
752 return 1;
753 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700754 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100755 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100756 if (val <= 0.00 || val >= 1.00) {
757 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
758 return 1;
759 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700760 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100761 }
Jens Axboe925fee32012-11-06 13:50:32 +0100762
Jens Axboee25839d2012-11-06 10:49:42 +0100763 return 0;
764}
765
Jens Axboe8e827d32009-08-04 09:51:48 +0200766/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800767 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200768 * is escaped with a '\', then that ':' is part of the filename and does not
769 * indicate a new file.
770 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800771static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200772{
773 char *str = *ptr;
774 char *p, *start;
775
776 if (!str || !strlen(str))
777 return NULL;
778
779 start = str;
780 do {
781 /*
782 * No colon, we are done
783 */
784 p = strchr(str, ':');
785 if (!p) {
786 *ptr = NULL;
787 break;
788 }
789
790 /*
791 * We got a colon, but it's the first character. Skip and
792 * continue
793 */
794 if (p == start) {
795 str = ++start;
796 continue;
797 }
798
799 if (*(p - 1) != '\\') {
800 *p = '\0';
801 *ptr = p + 1;
802 break;
803 }
804
805 memmove(p - 1, p, strlen(p) + 1);
806 str = p;
807 } while (1);
808
809 return start;
810}
811
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800812
813static int get_max_name_idx(char *input)
814{
815 unsigned int cur_idx;
816 char *str, *p;
817
818 p = str = strdup(input);
819 for (cur_idx = 0; ; cur_idx++)
820 if (get_next_name(&str) == NULL)
821 break;
822
823 free(p);
824 return cur_idx;
825}
826
827/*
828 * Returns the directory at the index, indexes > entires will be
829 * assigned via modulo division of the index
830 */
831int set_name_idx(char *target, char *input, int index)
832{
833 unsigned int cur_idx;
834 int len;
835 char *fname, *str, *p;
836
837 p = str = strdup(input);
838
839 index %= get_max_name_idx(input);
840 for (cur_idx = 0; cur_idx <= index; cur_idx++)
841 fname = get_next_name(&str);
842
843 len = sprintf(target, "%s/", fname);
844 free(p);
845
846 return len;
847}
848
Jens Axboe214e1ec2007-03-15 10:48:13 +0100849static int str_filename_cb(void *data, const char *input)
850{
851 struct thread_data *td = data;
852 char *fname, *str, *p;
853
854 p = str = strdup(input);
855
856 strip_blank_front(&str);
857 strip_blank_end(str);
858
859 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100860 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100861
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800862 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100863 if (!strlen(fname))
864 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800865 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100866 }
867
868 free(p);
869 return 0;
870}
871
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800872static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100873{
874 struct thread_data *td = data;
875 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800876 char *dirname, *str, *p;
877 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100878
Jens Axboef9633d72013-09-06 09:59:56 -0600879 if (parse_dryrun())
880 return 0;
881
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800882 p = str = strdup(td->o.directory);
883 while ((dirname = get_next_name(&str)) != NULL) {
884 if (lstat(dirname, &sb) < 0) {
885 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100886
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800887 log_err("fio: %s is not a directory\n", dirname);
888 td_verror(td, ret, "lstat");
889 goto out;
890 }
891 if (!S_ISDIR(sb.st_mode)) {
892 log_err("fio: %s is not a directory\n", dirname);
893 ret = 1;
894 goto out;
895 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100896 }
897
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800898out:
899 free(p);
900 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100901}
902
Jens Axboef2a28032014-02-11 09:12:06 -0700903static int str_lockfile_cb(void *data, const char fio_unused *str)
904{
905 struct thread_data *td = data;
906
907 if (td->files_index) {
908 log_err("fio: lockfile= option must precede filename=\n");
909 return 1;
910 }
911
912 return 0;
913}
914
Jens Axboe214e1ec2007-03-15 10:48:13 +0100915static int str_opendir_cb(void *data, const char fio_unused *str)
916{
917 struct thread_data *td = data;
918
Jens Axboe52c0cea2013-09-06 10:07:37 -0600919 if (parse_dryrun())
920 return 0;
921
Jens Axboe214e1ec2007-03-15 10:48:13 +0100922 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100923 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100924
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100925 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100926}
927
Jens Axboece35b1e2014-01-14 15:35:58 -0700928static int pattern_cb(char *pattern, unsigned int max_size,
929 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200930{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100931 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700932 int i = 0, j = 0, len, k, base = 10;
933 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200934 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200935
Jens Axboe5de855d2014-08-22 14:02:02 -0500936 /*
937 * Check if it's a string input
938 */
939 loc1 = strchr(input, '\"');
940 if (loc1) {
941 do {
942 loc1++;
943 if (*loc1 == '\0' || *loc1 == '\"')
944 break;
945
946 pattern[i] = *loc1;
947 i++;
948 } while (i < max_size);
949
950 if (!i)
951 return 1;
952
953 goto fill;
954 }
955
956 /*
957 * No string, find out if it's decimal or hexidecimal
958 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100959 loc1 = strstr(input, "0x");
960 loc2 = strstr(input, "0X");
961 if (loc1 || loc2)
962 base = 16;
963 off = strtol(input, NULL, base);
964 if (off != LONG_MAX || errno != ERANGE) {
965 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700966 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100967 off >>= 8;
968 i++;
969 }
970 } else {
971 len = strlen(input);
972 k = len - 1;
973 if (base == 16) {
974 if (loc1)
975 j = loc1 - input + 2;
976 else
977 j = loc2 - input + 2;
978 } else
979 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700980 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100981 while (k >= j) {
982 off = converthexchartoint(input[k--]);
983 if (k >= j)
984 off += (converthexchartoint(input[k--])
985 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700986 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100987 }
988 }
989 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100990
991 /*
992 * Fill the pattern all the way to the end. This greatly reduces
993 * the number of memcpy's we have to do when verifying the IO.
994 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500995fill:
Jens Axboee078de42013-04-24 23:07:17 -0600996 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700997 while (i > 1 && i * 2 <= max_size) {
998 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100999 i *= 2;
1000 }
Jens Axboee078de42013-04-24 23:07:17 -06001001
1002 /*
1003 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -07001004 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -06001005 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001006 while (i > 1 && i < max_size) {
1007 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -06001008
Jens Axboece35b1e2014-01-14 15:35:58 -07001009 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -06001010 i += b;
1011 }
1012
Steven Lang9a2a86d2012-02-07 09:42:59 +01001013 if (i == 1) {
1014 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -05001015 * The code in verify_io_u_pattern assumes a single byte
1016 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +01001017 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001018 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +01001019 }
Steven Langefcd9dc2012-02-02 20:22:04 +01001020
Jens Axboece35b1e2014-01-14 15:35:58 -07001021 *pattern_bytes = i;
1022 return 0;
1023}
1024
1025static int str_buffer_pattern_cb(void *data, const char *input)
1026{
1027 struct thread_data *td = data;
1028 int ret;
1029
1030 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1031 &td->o.buffer_pattern_bytes);
1032
Jens Axboedf91a1f2014-08-22 10:22:03 -05001033 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboece35b1e2014-01-14 15:35:58 -07001034 td->o.refill_buffers = 0;
1035 td->o.scramble_buffers = 0;
1036 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001037 } else {
1038 log_err("fio: failed parsing pattern `%s`\n", input);
1039 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001040 }
1041
1042 return ret;
1043}
1044
Jens Axboebedc9dc2014-03-17 12:51:09 -06001045static int str_buffer_compress_cb(void *data, unsigned long long *il)
1046{
1047 struct thread_data *td = data;
1048
1049 td->flags |= TD_F_COMPRESS;
1050 td->o.compress_percentage = *il;
1051 return 0;
1052}
1053
Jens Axboee66dac22014-09-22 10:02:07 -06001054static int str_dedupe_cb(void *data, unsigned long long *il)
1055{
1056 struct thread_data *td = data;
1057
1058 td->flags |= TD_F_COMPRESS;
1059 td->o.dedupe_percentage = *il;
1060 td->o.refill_buffers = 1;
1061 return 0;
1062}
1063
Jens Axboece35b1e2014-01-14 15:35:58 -07001064static int str_verify_pattern_cb(void *data, const char *input)
1065{
1066 struct thread_data *td = data;
1067 int ret;
1068
1069 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1070 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001071
Jens Axboe92bf48d2011-01-14 21:20:42 +01001072 /*
1073 * VERIFY_META could already be set
1074 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001075 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001076 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001077
Jens Axboece35b1e2014-01-14 15:35:58 -07001078 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001079}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001080
Jens Axboe993bf482008-11-14 13:04:53 +01001081static int str_gtod_reduce_cb(void *data, int *il)
1082{
1083 struct thread_data *td = data;
1084 int val = *il;
1085
Jens Axboe02af0982010-06-24 09:59:34 +02001086 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001087 td->o.disable_clat = !!val;
1088 td->o.disable_slat = !!val;
1089 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001090 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001091 if (val)
1092 td->tv_cache_mask = 63;
1093
1094 return 0;
1095}
1096
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001097static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001098{
1099 struct thread_data *td = data;
1100 int val = *il;
1101
1102 td->o.gtod_cpu = val;
1103 td->o.gtod_offload = 1;
1104 return 0;
1105}
1106
Jens Axboe7bb59102011-07-12 19:47:03 +02001107static int str_size_cb(void *data, unsigned long long *__val)
1108{
1109 struct thread_data *td = data;
1110 unsigned long long v = *__val;
1111
1112 if (parse_is_percent(v)) {
1113 td->o.size = 0;
1114 td->o.size_percent = -1ULL - v;
1115 } else
1116 td->o.size = v;
1117
1118 return 0;
1119}
1120
Jens Axboe896cac22009-07-01 10:38:35 +02001121static int rw_verify(struct fio_option *o, void *data)
1122{
1123 struct thread_data *td = data;
1124
1125 if (read_only && td_write(td)) {
1126 log_err("fio: job <%s> has write bit set, but fio is in"
1127 " read-only mode\n", td->o.name);
1128 return 1;
1129 }
1130
1131 return 0;
1132}
1133
Jens Axboe276ca4f2009-07-01 10:43:05 +02001134static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001135{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001136#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001137 struct thread_data *td = data;
1138
Jens Axboe29d43ff2009-07-01 10:42:18 +02001139 if (td->o.gtod_cpu) {
1140 log_err("fio: platform must support CPU affinity for"
1141 "gettimeofday() offloading\n");
1142 return 1;
1143 }
1144#endif
1145
1146 return 0;
1147}
1148
Jens Axboe214e1ec2007-03-15 10:48:13 +01001149/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001150 * Option grouping
1151 */
1152static struct opt_group fio_opt_groups[] = {
1153 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001154 .name = "General",
1155 .mask = FIO_OPT_C_GENERAL,
1156 },
1157 {
1158 .name = "I/O",
1159 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001160 },
1161 {
1162 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001163 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001164 },
1165 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001166 .name = "Statistics",
1167 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001168 },
1169 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001170 .name = "Logging",
1171 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001172 },
1173 {
Jens Axboe13fca822012-03-31 13:55:54 +02001174 .name = "Profiles",
1175 .mask = FIO_OPT_C_PROFILE,
1176 },
1177 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001178 .name = NULL,
1179 },
1180};
1181
Jens Axboee8b0e952012-03-19 14:37:08 +01001182static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1183 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001184{
1185 struct opt_group *og;
1186 int i;
1187
Jens Axboee8b0e952012-03-19 14:37:08 +01001188 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001189 return NULL;
1190
Jens Axboee8b0e952012-03-19 14:37:08 +01001191 for (i = 0; ogs[i].name; i++) {
1192 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001193
1194 if (*mask & og->mask) {
1195 *mask &= ~(og->mask);
1196 return og;
1197 }
1198 }
1199
1200 return NULL;
1201}
1202
Jens Axboee8b0e952012-03-19 14:37:08 +01001203struct opt_group *opt_group_from_mask(unsigned int *mask)
1204{
1205 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1206}
1207
1208static struct opt_group fio_opt_cat_groups[] = {
1209 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001210 .name = "Latency profiling",
1211 .mask = FIO_OPT_G_LATPROF,
1212 },
1213 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001214 .name = "Rate",
1215 .mask = FIO_OPT_G_RATE,
1216 },
1217 {
1218 .name = "Zone",
1219 .mask = FIO_OPT_G_ZONE,
1220 },
1221 {
1222 .name = "Read/write mix",
1223 .mask = FIO_OPT_G_RWMIX,
1224 },
1225 {
1226 .name = "Verify",
1227 .mask = FIO_OPT_G_VERIFY,
1228 },
1229 {
1230 .name = "Trim",
1231 .mask = FIO_OPT_G_TRIM,
1232 },
1233 {
1234 .name = "I/O Logging",
1235 .mask = FIO_OPT_G_IOLOG,
1236 },
1237 {
1238 .name = "I/O Depth",
1239 .mask = FIO_OPT_G_IO_DEPTH,
1240 },
1241 {
1242 .name = "I/O Flow",
1243 .mask = FIO_OPT_G_IO_FLOW,
1244 },
1245 {
Jens Axboe06260372012-03-19 15:16:08 +01001246 .name = "Description",
1247 .mask = FIO_OPT_G_DESC,
1248 },
1249 {
1250 .name = "Filename",
1251 .mask = FIO_OPT_G_FILENAME,
1252 },
1253 {
1254 .name = "General I/O",
1255 .mask = FIO_OPT_G_IO_BASIC,
1256 },
1257 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001258 .name = "Cgroups",
1259 .mask = FIO_OPT_G_CGROUP,
1260 },
1261 {
1262 .name = "Runtime",
1263 .mask = FIO_OPT_G_RUNTIME,
1264 },
1265 {
Jens Axboe10860052012-03-19 20:56:53 +01001266 .name = "Process",
1267 .mask = FIO_OPT_G_PROCESS,
1268 },
1269 {
1270 .name = "Job credentials / priority",
1271 .mask = FIO_OPT_G_CRED,
1272 },
1273 {
1274 .name = "Clock settings",
1275 .mask = FIO_OPT_G_CLOCK,
1276 },
1277 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001278 .name = "I/O Type",
1279 .mask = FIO_OPT_G_IO_TYPE,
1280 },
1281 {
1282 .name = "I/O Thinktime",
1283 .mask = FIO_OPT_G_THINKTIME,
1284 },
1285 {
1286 .name = "Randomizations",
1287 .mask = FIO_OPT_G_RANDOM,
1288 },
1289 {
1290 .name = "I/O buffers",
1291 .mask = FIO_OPT_G_IO_BUF,
1292 },
1293 {
Jens Axboe13fca822012-03-31 13:55:54 +02001294 .name = "Tiobench profile",
1295 .mask = FIO_OPT_G_TIOBENCH,
1296 },
1297
1298 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001299 .name = NULL,
1300 }
1301};
1302
1303struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1304{
1305 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1306}
1307
Jens Axboe9af4a242012-03-16 10:13:49 +01001308/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001309 * Map of job/command line options
1310 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001311struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001312 {
1313 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001314 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001315 .type = FIO_OPT_STR_STORE,
1316 .off1 = td_var_offset(description),
1317 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001318 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001319 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001320 },
1321 {
1322 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001323 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001324 .type = FIO_OPT_STR_STORE,
1325 .off1 = td_var_offset(name),
1326 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001327 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001328 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001329 },
1330 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001331 .name = "filename",
1332 .lname = "Filename(s)",
1333 .type = FIO_OPT_STR_STORE,
1334 .off1 = td_var_offset(filename),
1335 .cb = str_filename_cb,
1336 .prio = -1, /* must come after "directory" */
1337 .help = "File(s) to use for the workload",
1338 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001339 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001340 },
1341 {
1342 .name = "directory",
1343 .lname = "Directory",
1344 .type = FIO_OPT_STR_STORE,
1345 .off1 = td_var_offset(directory),
1346 .cb = str_directory_cb,
1347 .help = "Directory to store files in",
1348 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001349 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001350 },
1351 {
Jens Axboede98bd32013-04-05 11:09:20 +02001352 .name = "filename_format",
1353 .type = FIO_OPT_STR_STORE,
1354 .off1 = td_var_offset(filename_format),
1355 .prio = -1, /* must come after "directory" */
1356 .help = "Override default $jobname.$jobnum.$filenum naming",
1357 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001358 .category = FIO_OPT_C_FILE,
1359 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001360 },
1361 {
Jens Axboe29c13492008-03-01 19:25:20 +01001362 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001363 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001364 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001365 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001366 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001367 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001368 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001369 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001370 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001371 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001372 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001373 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001374 .posval = {
1375 { .ival = "none",
1376 .oval = FILE_LOCK_NONE,
1377 .help = "No file locking",
1378 },
1379 { .ival = "exclusive",
1380 .oval = FILE_LOCK_EXCLUSIVE,
1381 .help = "Exclusive file lock",
1382 },
1383 {
1384 .ival = "readwrite",
1385 .oval = FILE_LOCK_READWRITE,
1386 .help = "Read vs write lock",
1387 },
1388 },
Jens Axboe29c13492008-03-01 19:25:20 +01001389 },
1390 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001391 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001392 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001393 .type = FIO_OPT_STR_STORE,
1394 .off1 = td_var_offset(opendir),
1395 .cb = str_opendir_cb,
1396 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001397 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001398 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001399 },
1400 {
1401 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001402 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001403 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001404 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001405 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001406 .off1 = td_var_offset(td_ddir),
1407 .help = "IO direction",
1408 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001409 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001410 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001411 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001412 .posval = {
1413 { .ival = "read",
1414 .oval = TD_DDIR_READ,
1415 .help = "Sequential read",
1416 },
1417 { .ival = "write",
1418 .oval = TD_DDIR_WRITE,
1419 .help = "Sequential write",
1420 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001421 { .ival = "trim",
1422 .oval = TD_DDIR_TRIM,
1423 .help = "Sequential trim",
1424 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001425 { .ival = "randread",
1426 .oval = TD_DDIR_RANDREAD,
1427 .help = "Random read",
1428 },
1429 { .ival = "randwrite",
1430 .oval = TD_DDIR_RANDWRITE,
1431 .help = "Random write",
1432 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001433 { .ival = "randtrim",
1434 .oval = TD_DDIR_RANDTRIM,
1435 .help = "Random trim",
1436 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001437 { .ival = "rw",
1438 .oval = TD_DDIR_RW,
1439 .help = "Sequential read and write mix",
1440 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001441 { .ival = "readwrite",
1442 .oval = TD_DDIR_RW,
1443 .help = "Sequential read and write mix",
1444 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001445 { .ival = "randrw",
1446 .oval = TD_DDIR_RANDRW,
1447 .help = "Random read and write mix"
1448 },
1449 },
1450 },
1451 {
Jens Axboe38dad622010-07-20 14:46:00 -06001452 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001453 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001454 .type = FIO_OPT_STR,
1455 .off1 = td_var_offset(rw_seq),
1456 .help = "IO offset generator modifier",
1457 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001458 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001459 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001460 .posval = {
1461 { .ival = "sequential",
1462 .oval = RW_SEQ_SEQ,
1463 .help = "Generate sequential offsets",
1464 },
1465 { .ival = "identical",
1466 .oval = RW_SEQ_IDENT,
1467 .help = "Generate identical offsets",
1468 },
1469 },
1470 },
1471
1472 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001473 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001474 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001475 .type = FIO_OPT_STR_STORE,
1476 .off1 = td_var_offset(ioengine),
1477 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001478 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001479 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001480 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001481 .posval = {
1482 { .ival = "sync",
1483 .help = "Use read/write",
1484 },
gurudas paia31041e2007-10-23 15:12:30 +02001485 { .ival = "psync",
1486 .help = "Use pread/pwrite",
1487 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001488 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001489 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001490 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001491#ifdef CONFIG_PWRITEV
1492 { .ival = "pvsync",
1493 .help = "Use preadv/pwritev",
1494 },
1495#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001496#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001497 { .ival = "libaio",
1498 .help = "Linux native asynchronous IO",
1499 },
1500#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001501#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001502 { .ival = "posixaio",
1503 .help = "POSIX asynchronous IO",
1504 },
1505#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001506#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001507 { .ival = "solarisaio",
1508 .help = "Solaris native asynchronous IO",
1509 },
1510#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001511#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001512 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001513 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001514 },
Jens Axboe3be80072011-01-19 11:07:28 -07001515#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001516#ifdef CONFIG_RBD
1517 { .ival = "rbd",
1518 .help = "Rados Block Device asynchronous IO"
1519 },
1520#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001521 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001522 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001523 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001524#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001525 { .ival = "splice",
1526 .help = "splice/vmsplice based IO",
1527 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001528 { .ival = "netsplice",
1529 .help = "splice/vmsplice to/from the network",
1530 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001531#endif
1532#ifdef FIO_HAVE_SGIO
1533 { .ival = "sg",
1534 .help = "SCSI generic v3 IO",
1535 },
1536#endif
1537 { .ival = "null",
1538 .help = "Testing engine (no data transfer)",
1539 },
1540 { .ival = "net",
1541 .help = "Network IO",
1542 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001543 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001544 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001545 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001546#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001547 { .ival = "guasi",
1548 .help = "GUASI IO engine",
1549 },
1550#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001551#ifdef FIO_HAVE_BINJECT
1552 { .ival = "binject",
1553 .help = "binject direct inject block engine",
1554 },
1555#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001556#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001557 { .ival = "rdma",
1558 .help = "RDMA IO engine",
1559 },
1560#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001561#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001562 { .ival = "fusion-aw-sync",
1563 .help = "Fusion-io atomic write engine",
1564 },
1565#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001566#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001567 { .ival = "e4defrag",
1568 .help = "ext4 defrag engine",
1569 },
1570#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001571#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001572 { .ival = "falloc",
1573 .help = "fallocate() file based engine",
1574 },
1575#endif
chenh321fc5a2014-03-31 11:32:29 -04001576#ifdef CONFIG_GFAPI
1577 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001578 .help = "Glusterfs libgfapi(sync) based engine"
1579 },
1580 { .ival = "gfapi_async",
1581 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001582 },
1583#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001584#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001585 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001586 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1587 },
1588#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001589 { .ival = "external",
1590 .help = "Load external engine (append name)",
1591 },
1592 },
1593 },
1594 {
1595 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001596 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001597 .type = FIO_OPT_INT,
1598 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001599 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001600 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001601 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001602 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001603 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001604 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001605 },
1606 {
1607 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001608 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001609 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001610 .type = FIO_OPT_INT,
1611 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001612 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001613 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001614 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001615 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001616 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001617 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001618 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001619 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001620 },
1621 {
Jens Axboe49504212008-06-05 09:03:30 +02001622 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001623 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001624 .type = FIO_OPT_INT,
1625 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001626 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001627 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001628 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001629 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001630 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001631 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001632 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001633 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001634 },
1635 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001636 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001637 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001638 .type = FIO_OPT_INT,
1639 .off1 = td_var_offset(iodepth_low),
1640 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001641 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001642 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001643 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001644 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001645 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001646 },
1647 {
1648 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001649 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001650 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001651 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001652 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001653 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001654 .category = FIO_OPT_C_IO,
1655 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001656 },
1657 {
Jens Axboe77731b22014-04-28 12:08:47 -06001658 .name = "io_limit",
1659 .lname = "IO Limit",
1660 .type = FIO_OPT_STR_VAL,
1661 .off1 = td_var_offset(io_limit),
1662 .interval = 1024 * 1024,
1663 .category = FIO_OPT_C_IO,
1664 .group = FIO_OPT_G_INVALID,
1665 },
1666 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001667 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001668 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001669 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001670 .type = FIO_OPT_BOOL,
1671 .off1 = td_var_offset(fill_device),
1672 .help = "Write until an ENOSPC error occurs",
1673 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001674 .category = FIO_OPT_C_FILE,
1675 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001676 },
1677 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001678 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001679 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001680 .type = FIO_OPT_STR_VAL,
1681 .off1 = td_var_offset(file_size_low),
1682 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001683 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001684 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001685 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001686 .category = FIO_OPT_C_FILE,
1687 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001688 },
1689 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001690 .name = "file_append",
1691 .lname = "File append",
1692 .type = FIO_OPT_BOOL,
1693 .off1 = td_var_offset(file_append),
1694 .help = "IO will start at the end of the file(s)",
1695 .def = "0",
1696 .category = FIO_OPT_C_FILE,
1697 .group = FIO_OPT_G_INVALID,
1698 },
1699 {
Jens Axboe67a10002007-07-31 23:12:16 +02001700 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001701 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001702 .alias = "fileoffset",
1703 .type = FIO_OPT_STR_VAL,
1704 .off1 = td_var_offset(start_offset),
1705 .help = "Start IO from this offset",
1706 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001707 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001710 },
1711 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001712 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001713 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001714 .type = FIO_OPT_STR_VAL,
1715 .off1 = td_var_offset(offset_increment),
1716 .help = "What is the increment from one offset to the next",
1717 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001718 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001719 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001720 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001721 .category = FIO_OPT_C_IO,
1722 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001723 },
1724 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001725 .name = "number_ios",
1726 .lname = "Number of IOs to perform",
1727 .type = FIO_OPT_STR_VAL,
1728 .off1 = td_var_offset(number_ios),
1729 .help = "Force job completion of this number of IOs",
1730 .def = "0",
1731 .category = FIO_OPT_C_IO,
1732 .group = FIO_OPT_G_INVALID,
1733 },
1734 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001735 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001736 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001737 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001738 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001739 .off1 = td_var_offset(bs[DDIR_READ]),
1740 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001741 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001742 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001743 .help = "Block size unit",
1744 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001745 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001746 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001747 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001748 .category = FIO_OPT_C_IO,
1749 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001750 },
1751 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001752 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001753 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001754 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001755 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001756 .off1 = td_var_offset(ba[DDIR_READ]),
1757 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001758 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001759 .minval = 1,
1760 .help = "IO block offset alignment",
1761 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001762 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001763 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001766 },
1767 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001768 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001769 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001770 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001771 .type = FIO_OPT_RANGE,
1772 .off1 = td_var_offset(min_bs[DDIR_READ]),
1773 .off2 = td_var_offset(max_bs[DDIR_READ]),
1774 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1775 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001776 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1777 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001778 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001779 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001780 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001781 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001782 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001783 .category = FIO_OPT_C_IO,
1784 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001785 },
1786 {
Jens Axboe564ca972007-12-14 12:21:19 +01001787 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001788 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001789 .type = FIO_OPT_STR,
1790 .cb = str_bssplit_cb,
1791 .help = "Set a specific mix of block sizes",
1792 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001793 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001794 .category = FIO_OPT_C_IO,
1795 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001796 },
1797 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001798 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001799 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001800 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001801 .type = FIO_OPT_STR_SET,
1802 .off1 = td_var_offset(bs_unaligned),
1803 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001804 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001805 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001808 },
1809 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001810 .name = "bs_is_seq_rand",
1811 .lname = "Block size division is seq/random (not read/write)",
1812 .type = FIO_OPT_BOOL,
1813 .off1 = td_var_offset(bs_is_seq_rand),
1814 .help = "Consider any blocksize setting to be sequential,ramdom",
1815 .def = "0",
1816 .parent = "blocksize",
1817 .category = FIO_OPT_C_IO,
1818 .group = FIO_OPT_G_INVALID,
1819 },
1820 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001821 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001822 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001823 .type = FIO_OPT_BOOL,
1824 .off1 = td_var_offset(rand_repeatable),
1825 .help = "Use repeatable random IO pattern",
1826 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001827 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001828 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001829 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001830 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001831 },
1832 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001833 .name = "randseed",
1834 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001835 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001836 .off1 = td_var_offset(rand_seed),
1837 .help = "Set the random generator seed value",
1838 .parent = "rw",
1839 .category = FIO_OPT_C_IO,
1840 .group = FIO_OPT_G_RANDOM,
1841 },
1842 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001843 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001844 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001845 .type = FIO_OPT_BOOL,
1846 .off1 = td_var_offset(use_os_rand),
1847 .help = "Set to use OS random generator",
1848 .def = "0",
1849 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001850 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001851 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001852 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001853 },
1854 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001855 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001856 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001857 .type = FIO_OPT_STR_SET,
1858 .off1 = td_var_offset(norandommap),
1859 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001860 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001861 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001862 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001863 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001864 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001865 },
1866 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001867 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001868 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001869 .type = FIO_OPT_BOOL,
1870 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001871 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001872 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001873 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001874 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001875 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001876 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001877 },
1878 {
Jens Axboe8055e412012-11-26 08:43:47 +01001879 .name = "random_generator",
1880 .type = FIO_OPT_STR,
1881 .off1 = td_var_offset(random_generator),
1882 .help = "Type of random number generator to use",
1883 .def = "tausworthe",
1884 .posval = {
1885 { .ival = "tausworthe",
1886 .oval = FIO_RAND_GEN_TAUSWORTHE,
1887 .help = "Strong Tausworthe generator",
1888 },
1889 { .ival = "lfsr",
1890 .oval = FIO_RAND_GEN_LFSR,
1891 .help = "Variable length LFSR",
1892 },
1893 },
Jens Axboe48107592012-12-04 09:43:11 +01001894 .category = FIO_OPT_C_IO,
1895 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001896 },
1897 {
Jens Axboee25839d2012-11-06 10:49:42 +01001898 .name = "random_distribution",
1899 .type = FIO_OPT_STR,
1900 .off1 = td_var_offset(random_distribution),
1901 .cb = str_random_distribution_cb,
1902 .help = "Random offset distribution generator",
1903 .def = "random",
1904 .posval = {
1905 { .ival = "random",
1906 .oval = FIO_RAND_DIST_RANDOM,
1907 .help = "Completely random",
1908 },
1909 { .ival = "zipf",
1910 .oval = FIO_RAND_DIST_ZIPF,
1911 .help = "Zipf distribution",
1912 },
Jens Axboe925fee32012-11-06 13:50:32 +01001913 { .ival = "pareto",
1914 .oval = FIO_RAND_DIST_PARETO,
1915 .help = "Pareto distribution",
1916 },
Jens Axboee25839d2012-11-06 10:49:42 +01001917 },
Jens Axboe48107592012-12-04 09:43:11 +01001918 .category = FIO_OPT_C_IO,
1919 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001920 },
1921 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001922 .name = "percentage_random",
1923 .lname = "Percentage Random",
1924 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001925 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1926 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1927 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001928 .maxval = 100,
1929 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001930 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001931 .interval = 5,
1932 .inverse = "percentage_sequential",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_RANDOM,
1935 },
1936 {
1937 .name = "percentage_sequential",
1938 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001939 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001940 .category = FIO_OPT_C_IO,
1941 .group = FIO_OPT_G_RANDOM,
1942 },
1943 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001944 .name = "allrandrepeat",
1945 .type = FIO_OPT_BOOL,
1946 .off1 = td_var_offset(allrand_repeatable),
1947 .help = "Use repeatable random numbers for everything",
1948 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001949 .category = FIO_OPT_C_IO,
1950 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001951 },
1952 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001953 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001954 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001955 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(nr_files),
1958 .help = "Split job workload between this number of files",
1959 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001960 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001961 .category = FIO_OPT_C_FILE,
1962 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001963 },
1964 {
1965 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001966 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001967 .type = FIO_OPT_INT,
1968 .off1 = td_var_offset(open_files),
1969 .help = "Number of files to keep open at the same time",
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 },
1973 {
1974 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001975 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001976 .type = FIO_OPT_STR,
1977 .cb = str_fst_cb,
1978 .off1 = td_var_offset(file_service_type),
1979 .help = "How to select which file to service next",
1980 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001981 .category = FIO_OPT_C_FILE,
1982 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001983 .posval = {
1984 { .ival = "random",
1985 .oval = FIO_FSERVICE_RANDOM,
1986 .help = "Choose a file at random",
1987 },
1988 { .ival = "roundrobin",
1989 .oval = FIO_FSERVICE_RR,
1990 .help = "Round robin select files",
1991 },
Jens Axboea086c252009-03-04 08:27:37 +01001992 { .ival = "sequential",
1993 .oval = FIO_FSERVICE_SEQ,
1994 .help = "Finish one file before moving to the next",
1995 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001996 },
Jens Axboe67a10002007-07-31 23:12:16 +02001997 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001998 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001999 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002000#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002001 {
2002 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002003 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02002004 .type = FIO_OPT_STR,
2005 .off1 = td_var_offset(fallocate_mode),
2006 .help = "Whether pre-allocation is performed when laying out files",
2007 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01002008 .category = FIO_OPT_C_FILE,
2009 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02002010 .posval = {
2011 { .ival = "none",
2012 .oval = FIO_FALLOCATE_NONE,
2013 .help = "Do not pre-allocate space",
2014 },
2015 { .ival = "posix",
2016 .oval = FIO_FALLOCATE_POSIX,
2017 .help = "Use posix_fallocate()",
2018 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002019#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02002020 { .ival = "keep",
2021 .oval = FIO_FALLOCATE_KEEP_SIZE,
2022 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2023 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002024#endif
Eric Gourioua596f042011-06-17 09:11:45 +02002025 /* Compatibility with former boolean values */
2026 { .ival = "0",
2027 .oval = FIO_FALLOCATE_NONE,
2028 .help = "Alias for 'none'",
2029 },
2030 { .ival = "1",
2031 .oval = FIO_FALLOCATE_POSIX,
2032 .help = "Alias for 'posix'",
2033 },
2034 },
2035 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002036#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02002037 {
2038 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002039 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002040 .type = FIO_OPT_BOOL,
2041 .off1 = td_var_offset(fadvise_hint),
2042 .help = "Use fadvise() to advise the kernel on IO pattern",
2043 .def = "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 {
2048 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002049 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002050 .type = FIO_OPT_INT,
2051 .off1 = td_var_offset(fsync_blocks),
2052 .help = "Issue fsync 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 Axboe214e1ec2007-03-15 10:48:13 +01002057 },
2058 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002059 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002060 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002061 .type = FIO_OPT_INT,
2062 .off1 = td_var_offset(fdatasync_blocks),
2063 .help = "Issue fdatasync for writes every given number of blocks",
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_FILE,
2067 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002068 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002069 {
2070 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002071 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002072 .type = FIO_OPT_INT,
2073 .off1 = td_var_offset(barrier_blocks),
2074 .help = "Make every Nth write a barrier write",
2075 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002076 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002077 .category = FIO_OPT_C_IO,
2078 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002079 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002080#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002081 {
2082 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002083 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002084 .posval = {
2085 { .ival = "wait_before",
2086 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2087 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002088 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002089 },
2090 { .ival = "write",
2091 .oval = SYNC_FILE_RANGE_WRITE,
2092 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002093 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002094 },
2095 {
2096 .ival = "wait_after",
2097 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2098 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002099 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002100 },
2101 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002102 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002103 .cb = str_sfr_cb,
2104 .off1 = td_var_offset(sync_file_range),
2105 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002106 .category = FIO_OPT_C_FILE,
2107 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002108 },
2109#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002110 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002111 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002112 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(odirect),
2115 .help = "Use O_DIRECT IO (negates buffered)",
2116 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002117 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002118 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002119 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002120 },
2121 {
Chris Masond01612f2013-11-15 15:52:58 -07002122 .name = "atomic",
2123 .lname = "Atomic I/O",
2124 .type = FIO_OPT_BOOL,
2125 .off1 = td_var_offset(oatomic),
2126 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2127 .def = "0",
2128 .category = FIO_OPT_C_IO,
2129 .group = FIO_OPT_G_IO_TYPE,
2130 },
2131 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002132 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002133 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002134 .type = FIO_OPT_BOOL,
2135 .off1 = td_var_offset(odirect),
2136 .neg = 1,
2137 .help = "Use buffered IO (negates direct)",
2138 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002139 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002140 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002141 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002142 },
2143 {
2144 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002145 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002146 .type = FIO_OPT_BOOL,
2147 .off1 = td_var_offset(overwrite),
2148 .help = "When writing, set whether to overwrite current data",
2149 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002150 .category = FIO_OPT_C_FILE,
2151 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002152 },
2153 {
2154 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002155 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002156 .type = FIO_OPT_INT,
2157 .off1 = td_var_offset(loops),
2158 .help = "Number of times to run the job",
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 = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002166 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002167 .type = FIO_OPT_INT,
2168 .off1 = td_var_offset(numjobs),
2169 .help = "Duplicate this job this many times",
2170 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002171 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002172 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002173 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002174 },
2175 {
2176 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002177 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002178 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002179 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002180 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002181 .help = "Only start job when this period has passed",
2182 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002183 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002184 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002185 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002186 },
2187 {
2188 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002189 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002190 .alias = "timeout",
2191 .type = FIO_OPT_STR_VAL_TIME,
2192 .off1 = td_var_offset(timeout),
2193 .help = "Stop workload when this amount of time has passed",
2194 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002195 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002196 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002197 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002198 },
2199 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002200 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002201 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002202 .type = FIO_OPT_STR_SET,
2203 .off1 = td_var_offset(time_based),
2204 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002205 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002206 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002207 },
2208 {
Juan Casse62167762013-09-17 14:06:13 -07002209 .name = "verify_only",
2210 .lname = "Verify only",
2211 .type = FIO_OPT_STR_SET,
2212 .off1 = td_var_offset(verify_only),
2213 .help = "Verifies previously written data is still valid",
2214 .category = FIO_OPT_C_GENERAL,
2215 .group = FIO_OPT_G_RUNTIME,
2216 },
2217 {
Jens Axboe721938a2008-09-10 09:46:16 +02002218 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002219 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002220 .type = FIO_OPT_STR_VAL_TIME,
2221 .off1 = td_var_offset(ramp_time),
2222 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002223 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002224 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002225 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002226 },
2227 {
Jens Axboec223da82010-03-24 13:23:53 +01002228 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002229 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002230 .type = FIO_OPT_STR,
2231 .cb = fio_clock_source_cb,
2232 .off1 = td_var_offset(clocksource),
2233 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002234 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002235 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002236 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002237#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002238 { .ival = "gettimeofday",
2239 .oval = CS_GTOD,
2240 .help = "Use gettimeofday(2) for timing",
2241 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002242#endif
2243#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002244 { .ival = "clock_gettime",
2245 .oval = CS_CGETTIME,
2246 .help = "Use clock_gettime(2) for timing",
2247 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002248#endif
Jens Axboec223da82010-03-24 13:23:53 +01002249#ifdef ARCH_HAVE_CPU_CLOCK
2250 { .ival = "cpu",
2251 .oval = CS_CPUCLOCK,
2252 .help = "Use CPU private clock",
2253 },
2254#endif
2255 },
2256 },
2257 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002258 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002259 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002260 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002261 .type = FIO_OPT_STR,
2262 .cb = str_mem_cb,
2263 .off1 = td_var_offset(mem_type),
2264 .help = "Backing type for IO buffers",
2265 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002268 .posval = {
2269 { .ival = "malloc",
2270 .oval = MEM_MALLOC,
2271 .help = "Use malloc(3) for IO buffers",
2272 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002273#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002274 { .ival = "shm",
2275 .oval = MEM_SHM,
2276 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002277 },
2278#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002279 { .ival = "shmhuge",
2280 .oval = MEM_SHMHUGE,
2281 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002282 },
2283#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002284#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002285 { .ival = "mmap",
2286 .oval = MEM_MMAP,
2287 .help = "Use mmap(2) (file or anon) for IO buffers",
2288 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002289#ifdef FIO_HAVE_HUGETLB
2290 { .ival = "mmaphuge",
2291 .oval = MEM_MMAPHUGE,
2292 .help = "Like mmap, but use huge pages",
2293 },
2294#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002295 },
2296 },
2297 {
Jens Axboed529ee12009-07-01 10:33:03 +02002298 .name = "iomem_align",
2299 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002300 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002301 .type = FIO_OPT_INT,
2302 .off1 = td_var_offset(mem_align),
2303 .minval = 0,
2304 .help = "IO memory buffer offset alignment",
2305 .def = "0",
2306 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002307 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002308 .category = FIO_OPT_C_IO,
2309 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002310 },
2311 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002312 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002313 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002314 .type = FIO_OPT_STR,
2315 .off1 = td_var_offset(verify),
2316 .help = "Verify data written",
2317 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002318 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002319 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002320 .posval = {
2321 { .ival = "0",
2322 .oval = VERIFY_NONE,
2323 .help = "Don't do IO verification",
2324 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002325 { .ival = "md5",
2326 .oval = VERIFY_MD5,
2327 .help = "Use md5 checksums for verification",
2328 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002329 { .ival = "crc64",
2330 .oval = VERIFY_CRC64,
2331 .help = "Use crc64 checksums for verification",
2332 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002333 { .ival = "crc32",
2334 .oval = VERIFY_CRC32,
2335 .help = "Use crc32 checksums for verification",
2336 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002337 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002338 .oval = VERIFY_CRC32C,
2339 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002340 },
Jens Axboebac39e02008-06-11 20:46:19 +02002341 { .ival = "crc32c",
2342 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002343 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002344 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002345 { .ival = "crc16",
2346 .oval = VERIFY_CRC16,
2347 .help = "Use crc16 checksums for verification",
2348 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002349 { .ival = "crc7",
2350 .oval = VERIFY_CRC7,
2351 .help = "Use crc7 checksums for verification",
2352 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002353 { .ival = "sha1",
2354 .oval = VERIFY_SHA1,
2355 .help = "Use sha1 checksums for verification",
2356 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002357 { .ival = "sha256",
2358 .oval = VERIFY_SHA256,
2359 .help = "Use sha256 checksums for verification",
2360 },
2361 { .ival = "sha512",
2362 .oval = VERIFY_SHA512,
2363 .help = "Use sha512 checksums for verification",
2364 },
Jens Axboe844ea602014-02-20 13:21:45 -08002365 { .ival = "xxhash",
2366 .oval = VERIFY_XXHASH,
2367 .help = "Use xxhash checksums for verification",
2368 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002369 { .ival = "meta",
2370 .oval = VERIFY_META,
2371 .help = "Use io information",
2372 },
Jens Axboe36690c92007-03-26 10:23:34 +02002373 {
2374 .ival = "null",
2375 .oval = VERIFY_NULL,
2376 .help = "Pretend to verify",
2377 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002378 },
2379 },
2380 {
Jens Axboe005c5652007-08-02 22:21:36 +02002381 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002382 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002383 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002384 .off1 = td_var_offset(do_verify),
2385 .help = "Run verification stage after write",
2386 .def = "1",
2387 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002388 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002389 .category = FIO_OPT_C_IO,
2390 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002391 },
2392 {
Jens Axboe160b9662007-03-27 10:59:49 +02002393 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002394 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002395 .type = FIO_OPT_BOOL,
2396 .off1 = td_var_offset(verifysort),
2397 .help = "Sort written verify blocks for read back",
2398 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002399 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002400 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002401 .category = FIO_OPT_C_IO,
2402 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002403 },
2404 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002405 .name = "verifysort_nr",
2406 .type = FIO_OPT_INT,
2407 .off1 = td_var_offset(verifysort_nr),
2408 .help = "Pre-load and sort verify blocks for a read workload",
2409 .minval = 0,
2410 .maxval = 131072,
2411 .def = "1024",
2412 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002415 },
2416 {
Jens Axboea59e1702007-07-30 08:53:27 +02002417 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002418 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002419 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002420 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002421 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002422 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002423 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002424 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002425 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002426 .category = FIO_OPT_C_IO,
2427 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002428 },
2429 {
Jens Axboea59e1702007-07-30 08:53:27 +02002430 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002431 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002432 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002433 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002434 .off1 = td_var_offset(verify_offset),
2435 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002436 .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 Lewis546a9142007-07-28 21:11:37 +02002440 },
2441 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002442 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002443 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002444 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002445 .cb = str_verify_pattern_cb,
2446 .help = "Fill pattern for IO buffers",
2447 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002448 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002449 .category = FIO_OPT_C_IO,
2450 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002451 },
2452 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002453 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002454 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002455 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002456 .off1 = td_var_offset(verify_fatal),
2457 .def = "0",
2458 .help = "Exit on a single verify failure, don't continue",
2459 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002460 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002463 },
2464 {
Jens Axboeb463e932011-01-12 09:03:23 +01002465 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002466 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002467 .type = FIO_OPT_BOOL,
2468 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002469 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002470 .help = "Dump contents of good and bad blocks on failure",
2471 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002472 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002475 },
2476 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002477 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002478 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002479 .type = FIO_OPT_INT,
2480 .off1 = td_var_offset(verify_async),
2481 .def = "0",
2482 .help = "Number of async verifier threads to use",
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 Axboee8462bd2009-07-06 12:59:04 +02002487 },
Jens Axboe9e144182010-06-15 14:25:36 +02002488 {
2489 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002490 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002491 .type = FIO_OPT_STR_VAL,
2492 .off1 = td_var_offset(verify_backlog),
2493 .help = "Verify after this number of blocks are written",
2494 .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 },
2499 {
2500 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002501 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002502 .type = FIO_OPT_INT,
2503 .off1 = td_var_offset(verify_batch),
2504 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002505 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002506 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002507 .category = FIO_OPT_C_IO,
2508 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002509 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002510#ifdef FIO_HAVE_CPU_AFFINITY
2511 {
2512 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002513 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002514 .type = FIO_OPT_STR,
2515 .cb = str_verify_cpus_allowed_cb,
2516 .help = "Set CPUs allowed for async verify threads",
2517 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002518 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002519 .category = FIO_OPT_C_IO,
2520 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002521 },
2522#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002523 {
2524 .name = "experimental_verify",
2525 .off1 = td_var_offset(experimental_verify),
2526 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002527 .help = "Enable experimental verification",
Jens Axboe836fcc02013-01-24 09:08:45 -07002528 .category = FIO_OPT_C_IO,
2529 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002530 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002531#ifdef FIO_HAVE_TRIM
2532 {
2533 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002534 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002535 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002536 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002537 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002538 .maxval = 100,
2539 .help = "Number of verify blocks to discard/trim",
2540 .parent = "verify",
2541 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002542 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002543 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002546 },
2547 {
2548 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002549 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002550 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002551 .help = "Verify that trim/discarded blocks are returned as zeroes",
2552 .off1 = td_var_offset(trim_zero),
2553 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002554 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002555 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002556 .category = FIO_OPT_C_IO,
2557 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002558 },
2559 {
2560 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002561 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002562 .type = FIO_OPT_STR_VAL,
2563 .off1 = td_var_offset(trim_backlog),
2564 .help = "Trim after this number of blocks are written",
2565 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002566 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002567 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002568 .category = FIO_OPT_C_IO,
2569 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002570 },
2571 {
2572 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002573 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002574 .type = FIO_OPT_INT,
2575 .off1 = td_var_offset(trim_batch),
2576 .help = "Trim this number of IO blocks",
2577 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002578 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002579 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002580 .category = FIO_OPT_C_IO,
2581 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002582 },
2583#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002584 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002585 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002586 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002587 .type = FIO_OPT_STR_STORE,
2588 .off1 = td_var_offset(write_iolog_file),
2589 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002590 .category = FIO_OPT_C_IO,
2591 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002592 },
2593 {
2594 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002595 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002596 .type = FIO_OPT_STR_STORE,
2597 .off1 = td_var_offset(read_iolog_file),
2598 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002601 },
2602 {
David Nellans64bbb862010-08-24 22:13:30 +02002603 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002604 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002605 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002606 .off1 = td_var_offset(no_stall),
2607 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002608 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002609 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002610 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002613 },
2614 {
David Nellansd1c46c02010-08-31 21:20:47 +02002615 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002616 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002617 .type = FIO_OPT_STR_STORE,
2618 .off1 = td_var_offset(replay_redirect),
2619 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002620 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002621 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002622 .category = FIO_OPT_C_IO,
2623 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002624 },
2625 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002626 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002627 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002628 .type = FIO_OPT_STR_STORE,
2629 .off1 = td_var_offset(exec_prerun),
2630 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002631 .category = FIO_OPT_C_GENERAL,
2632 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002633 },
2634 {
2635 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002636 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002637 .type = FIO_OPT_STR_STORE,
2638 .off1 = td_var_offset(exec_postrun),
2639 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002640 .category = FIO_OPT_C_GENERAL,
2641 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002642 },
2643#ifdef FIO_HAVE_IOSCHED_SWITCH
2644 {
2645 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002646 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002647 .type = FIO_OPT_STR_STORE,
2648 .off1 = td_var_offset(ioscheduler),
2649 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002650 .category = FIO_OPT_C_FILE,
2651 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002652 },
2653#endif
2654 {
2655 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002656 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002657 .type = FIO_OPT_STR_VAL,
2658 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002659 .help = "Amount of data to read per 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,
Steven Noonaned335852012-01-31 13:58:00 +01002664 },
2665 {
2666 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002667 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002670 .help = "Give size of an IO zone",
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 = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002678 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002679 .type = FIO_OPT_STR_VAL,
2680 .off1 = td_var_offset(zone_skip),
2681 .help = "Space between IO zones",
2682 .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_IO,
2685 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002686 },
2687 {
2688 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002689 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002690 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002691 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002692 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002693 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002694 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002695 .category = FIO_OPT_C_GENERAL,
2696 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002697 },
2698 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002699 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002700 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002701 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002702 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002703 .maxval = 100,
2704 .help = "Percentage of mixed workload that is reads",
2705 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002706 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002707 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002708 .category = FIO_OPT_C_IO,
2709 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002710 },
2711 {
2712 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002713 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002714 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002715 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002716 .maxval = 100,
2717 .help = "Percentage of mixed workload that is writes",
2718 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002719 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002720 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002721 .category = FIO_OPT_C_IO,
2722 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002723 },
2724 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002725 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002726 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002727 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002728 .category = FIO_OPT_C_IO,
2729 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002730 },
2731 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002732 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002733 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002734 .type = FIO_OPT_INT,
2735 .off1 = td_var_offset(nice),
2736 .help = "Set job CPU nice value",
2737 .minval = -19,
2738 .maxval = 20,
2739 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002740 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002741 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002742 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002743 },
2744#ifdef FIO_HAVE_IOPRIO
2745 {
2746 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002747 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002748 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002749 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002750 .help = "Set job IO priority value",
2751 .minval = 0,
2752 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002753 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002754 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002755 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002756 },
2757 {
2758 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002759 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002760 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002761 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002762 .help = "Set job IO priority class",
2763 .minval = 0,
2764 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002765 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002766 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002767 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002768 },
2769#endif
2770 {
2771 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002772 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002773 .type = FIO_OPT_INT,
2774 .off1 = td_var_offset(thinktime),
2775 .help = "Idle time between IO buffers (usec)",
2776 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002777 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002778 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002779 },
2780 {
2781 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002782 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002783 .type = FIO_OPT_INT,
2784 .off1 = td_var_offset(thinktime_spin),
2785 .help = "Start think time by spinning this amount (usec)",
2786 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002787 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002788 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002789 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002790 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002791 },
2792 {
2793 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002794 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002795 .type = FIO_OPT_INT,
2796 .off1 = td_var_offset(thinktime_blocks),
2797 .help = "IO buffer period between 'thinktime'",
2798 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002799 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002800 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002801 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002802 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002803 },
2804 {
2805 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .lname = "I/O 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(rate[DDIR_READ]),
2809 .off2 = td_var_offset(rate[DDIR_WRITE]),
2810 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002811 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002812 .category = FIO_OPT_C_IO,
2813 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002814 },
2815 {
2816 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002817 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002818 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002819 .off1 = td_var_offset(ratemin[DDIR_READ]),
2820 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2821 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002822 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002823 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002824 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002825 .category = FIO_OPT_C_IO,
2826 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002827 },
2828 {
2829 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002830 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002831 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002832 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2833 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2834 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002835 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002836 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002837 .category = FIO_OPT_C_IO,
2838 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002839 },
2840 {
2841 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002842 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002843 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002844 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2845 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2846 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002847 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002848 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002849 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002850 .category = FIO_OPT_C_IO,
2851 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002852 },
2853 {
2854 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002855 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002856 .type = FIO_OPT_INT,
2857 .off1 = td_var_offset(ratecycle),
2858 .help = "Window average for rate limits (msec)",
2859 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002860 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002861 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002862 .category = FIO_OPT_C_IO,
2863 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002864 },
2865 {
Jens Axboe15501532012-10-24 16:37:45 +02002866 .name = "max_latency",
2867 .type = FIO_OPT_INT,
2868 .off1 = td_var_offset(max_latency),
2869 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe1e5324e2012-11-14 14:25:31 -07002870 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002871 .group = FIO_OPT_G_LATPROF,
2872 },
2873 {
2874 .name = "latency_target",
2875 .lname = "Latency Target (usec)",
2876 .type = FIO_OPT_STR_VAL_TIME,
2877 .off1 = td_var_offset(latency_target),
2878 .help = "Ramp to max queue depth supporting this latency",
2879 .category = FIO_OPT_C_IO,
2880 .group = FIO_OPT_G_LATPROF,
2881 },
2882 {
2883 .name = "latency_window",
2884 .lname = "Latency Window (usec)",
2885 .type = FIO_OPT_STR_VAL_TIME,
2886 .off1 = td_var_offset(latency_window),
2887 .help = "Time to sustain latency_target",
2888 .category = FIO_OPT_C_IO,
2889 .group = FIO_OPT_G_LATPROF,
2890 },
2891 {
2892 .name = "latency_percentile",
2893 .lname = "Latency Percentile",
2894 .type = FIO_OPT_FLOAT_LIST,
2895 .off1 = td_var_offset(latency_percentile),
2896 .help = "Percentile of IOs must be below latency_target",
2897 .def = "100",
2898 .maxlen = 1,
2899 .minfp = 0.0,
2900 .maxfp = 100.0,
2901 .category = FIO_OPT_C_IO,
2902 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002903 },
2904 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002905 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002906 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002907 .type = FIO_OPT_BOOL,
2908 .off1 = td_var_offset(invalidate_cache),
2909 .help = "Invalidate buffer/page cache prior to running job",
2910 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002911 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002912 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002913 },
2914 {
2915 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002916 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002917 .type = FIO_OPT_BOOL,
2918 .off1 = td_var_offset(sync_io),
2919 .help = "Use O_SYNC for buffered writes",
2920 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002921 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002922 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002923 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002924 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002925 },
2926 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002927 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002928 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002929 .type = FIO_OPT_BOOL,
2930 .off1 = td_var_offset(create_serialize),
2931 .help = "Serialize creating of job files",
2932 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002933 .category = FIO_OPT_C_FILE,
2934 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002935 },
2936 {
2937 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002938 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002939 .type = FIO_OPT_BOOL,
2940 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002941 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002942 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002943 .category = FIO_OPT_C_FILE,
2944 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002945 },
2946 {
Jens Axboe814452b2009-03-04 12:53:13 +01002947 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002948 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002949 .type = FIO_OPT_BOOL,
2950 .off1 = td_var_offset(create_on_open),
2951 .help = "Create files when they are opened for IO",
2952 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002953 .category = FIO_OPT_C_FILE,
2954 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002955 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002956 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002957 .name = "create_only",
2958 .type = FIO_OPT_BOOL,
2959 .off1 = td_var_offset(create_only),
2960 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002961 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002962 .def = "0",
2963 },
2964 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002965 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002969 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002970 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002971 .category = FIO_OPT_C_FILE,
2972 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002973 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002974#ifdef FIO_HAVE_CPU_AFFINITY
2975 {
2976 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002977 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002978 .type = FIO_OPT_INT,
2979 .cb = str_cpumask_cb,
2980 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002981 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002982 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002983 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002984 {
2985 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002986 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002987 .type = FIO_OPT_STR,
2988 .cb = str_cpus_allowed_cb,
2989 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002990 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002991 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002992 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002993 {
2994 .name = "cpus_allowed_policy",
2995 .lname = "CPUs allowed distribution policy",
2996 .type = FIO_OPT_STR,
2997 .off1 = td_var_offset(cpus_allowed_policy),
2998 .help = "Distribution policy for cpus_allowed",
2999 .parent = "cpus_allowed",
3000 .prio = 1,
3001 .posval = {
3002 { .ival = "shared",
3003 .oval = FIO_CPUS_SHARED,
3004 .help = "Mask shared between threads",
3005 },
3006 { .ival = "split",
3007 .oval = FIO_CPUS_SPLIT,
3008 .help = "Mask split between threads",
3009 },
3010 },
3011 .category = FIO_OPT_C_GENERAL,
3012 .group = FIO_OPT_G_CRED,
3013 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003014#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003015#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003016 {
3017 .name = "numa_cpu_nodes",
3018 .type = FIO_OPT_STR,
3019 .cb = str_numa_cpunodes_cb,
3020 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003021 .category = FIO_OPT_C_GENERAL,
3022 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003023 },
3024 {
3025 .name = "numa_mem_policy",
3026 .type = FIO_OPT_STR,
3027 .cb = str_numa_mpol_cb,
3028 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003029 .category = FIO_OPT_C_GENERAL,
3030 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003031 },
3032#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003033 {
3034 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003035 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003036 .type = FIO_OPT_BOOL,
3037 .off1 = td_var_offset(end_fsync),
3038 .help = "Include fsync at the end of job",
3039 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003040 .category = FIO_OPT_C_FILE,
3041 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003042 },
3043 {
3044 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003045 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003046 .type = FIO_OPT_BOOL,
3047 .off1 = td_var_offset(fsync_on_close),
3048 .help = "fsync files on close",
3049 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003050 .category = FIO_OPT_C_FILE,
3051 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003052 },
3053 {
3054 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003055 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003056 .type = FIO_OPT_BOOL,
3057 .off1 = td_var_offset(unlink),
3058 .help = "Unlink created files after job has completed",
3059 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003060 .category = FIO_OPT_C_FILE,
3061 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003062 },
3063 {
3064 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003065 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003066 .type = FIO_OPT_STR_SET,
3067 .cb = str_exitall_cb,
3068 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003069 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003070 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003071 },
3072 {
3073 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003074 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003075 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003076 .type = FIO_OPT_STR_SET,
3077 .off1 = td_var_offset(stonewall),
3078 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003079 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003080 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003081 },
3082 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003083 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003084 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003085 .type = FIO_OPT_STR_SET,
3086 .off1 = td_var_offset(new_group),
3087 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003088 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003089 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003090 },
3091 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003092 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003093 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003094 .type = FIO_OPT_STR_SET,
3095 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003096 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003097#ifdef CONFIG_NO_SHM
3098 .def = "1",
3099 .no_warn_def = 1,
3100#endif
Jens Axboee8b0e952012-03-19 14:37:08 +01003101 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003102 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003103 },
3104 {
3105 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003106 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003107 .type = FIO_OPT_STR_STORE,
3108 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003109 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003110 .category = FIO_OPT_C_LOG,
3111 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003112 },
3113 {
3114 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003115 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003116 .type = FIO_OPT_STR_STORE,
3117 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003118 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003119 .category = FIO_OPT_C_LOG,
3120 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003121 },
3122 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003123 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003124 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003125 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003126 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003127 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003128 .category = FIO_OPT_C_LOG,
3129 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003130 },
3131 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003132 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003133 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003134 .type = FIO_OPT_INT,
3135 .off1 = td_var_offset(log_avg_msec),
3136 .help = "Average bw/iops/lat logs over this period of time",
3137 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003138 .category = FIO_OPT_C_LOG,
3139 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003140 },
3141 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003142 .name = "log_offset",
3143 .lname = "Log offset of IO",
3144 .type = FIO_OPT_BOOL,
3145 .off1 = td_var_offset(log_offset),
3146 .help = "Include offset of IO for each log entry",
3147 .def = "0",
3148 .category = FIO_OPT_C_LOG,
3149 .group = FIO_OPT_G_INVALID,
3150 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003151#ifdef CONFIG_ZLIB
3152 {
3153 .name = "log_compression",
3154 .lname = "Log compression",
3155 .type = FIO_OPT_INT,
3156 .off1 = td_var_offset(log_gz),
3157 .help = "Log in compressed chunks of this size",
3158 .minval = 32 * 1024 * 1024ULL,
3159 .maxval = 512 * 1024 * 1024ULL,
3160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
3162 },
Jens Axboebac4af12014-07-03 13:42:28 -06003163 {
3164 .name = "log_store_compressed",
3165 .lname = "Log store compressed",
3166 .type = FIO_OPT_BOOL,
3167 .off1 = td_var_offset(log_gz_store),
3168 .help = "Store logs in a compressed format",
3169 .category = FIO_OPT_C_LOG,
3170 .group = FIO_OPT_G_INVALID,
3171 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003172#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003173 {
Jens Axboec504ee52012-03-20 11:29:09 +01003174 .name = "bwavgtime",
3175 .lname = "Bandwidth average time",
3176 .type = FIO_OPT_INT,
3177 .off1 = td_var_offset(bw_avg_time),
3178 .help = "Time window over which to calculate bandwidth"
3179 " (msec)",
3180 .def = "500",
3181 .parent = "write_bw_log",
3182 .hide = 1,
3183 .interval = 100,
3184 .category = FIO_OPT_C_LOG,
3185 .group = FIO_OPT_G_INVALID,
3186 },
3187 {
3188 .name = "iopsavgtime",
3189 .lname = "IOPS average time",
3190 .type = FIO_OPT_INT,
3191 .off1 = td_var_offset(iops_avg_time),
3192 .help = "Time window over which to calculate IOPS (msec)",
3193 .def = "500",
3194 .parent = "write_iops_log",
3195 .hide = 1,
3196 .interval = 100,
3197 .category = FIO_OPT_C_LOG,
3198 .group = FIO_OPT_G_INVALID,
3199 },
3200 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003201 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003202 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003203 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003204 .off1 = td_var_offset(group_reporting),
3205 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003206 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003207 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003208 },
3209 {
Jens Axboee9459e52007-04-17 15:46:32 +02003210 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003211 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003212 .type = FIO_OPT_STR_SET,
3213 .off1 = td_var_offset(zero_buffers),
3214 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003215 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003216 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003217 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003218 {
3219 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003220 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003221 .type = FIO_OPT_STR_SET,
3222 .off1 = td_var_offset(refill_buffers),
3223 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003224 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003225 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003226 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003227 {
Jens Axboefd684182011-09-19 09:24:44 +02003228 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003229 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003230 .type = FIO_OPT_BOOL,
3231 .off1 = td_var_offset(scramble_buffers),
3232 .help = "Slightly scramble buffers on every IO submit",
3233 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003234 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003235 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003236 },
3237 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003238 .name = "buffer_pattern",
3239 .lname = "Buffer pattern",
3240 .type = FIO_OPT_STR,
3241 .cb = str_buffer_pattern_cb,
3242 .help = "Fill pattern for IO buffers",
3243 .category = FIO_OPT_C_IO,
3244 .group = FIO_OPT_G_IO_BUF,
3245 },
3246 {
Jens Axboe9c426842012-03-02 21:02:12 +01003247 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003248 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003249 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003250 .cb = str_buffer_compress_cb,
Jens Axboe9c426842012-03-02 21:02:12 +01003251 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003252 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003253 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003254 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003255 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003256 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003257 },
3258 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003259 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003260 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003261 .type = FIO_OPT_INT,
3262 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003263 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003264 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003265 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003266 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003267 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003268 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003269 },
3270 {
Jens Axboee66dac22014-09-22 10:02:07 -06003271 .name = "dedupe_percentage",
3272 .lname = "Dedupe percentage",
3273 .type = FIO_OPT_INT,
3274 .cb = str_dedupe_cb,
3275 .maxval = 100,
3276 .minval = 0,
3277 .help = "Percentage of buffers that are dedupable",
3278 .interval = 1,
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_IO_BUF,
3281 },
3282 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003283 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003284 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003285 .type = FIO_OPT_BOOL,
3286 .off1 = td_var_offset(clat_percentiles),
3287 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003288 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003289 .category = FIO_OPT_C_STAT,
3290 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003291 },
3292 {
3293 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003294 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003295 .type = FIO_OPT_FLOAT_LIST,
3296 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003297 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003298 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003299 .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 +02003300 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3301 .minfp = 0.0,
3302 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003303 .category = FIO_OPT_C_STAT,
3304 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003305 },
3306
Jens Axboe0a839f32007-04-26 09:02:34 +02003307#ifdef FIO_HAVE_DISK_UTIL
3308 {
3309 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003310 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003311 .type = FIO_OPT_BOOL,
3312 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003313 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003314 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003315 .category = FIO_OPT_C_STAT,
3316 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003317 },
3318#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003319 {
Jens Axboe993bf482008-11-14 13:04:53 +01003320 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003321 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003322 .type = FIO_OPT_BOOL,
3323 .help = "Greatly reduce number of gettimeofday() calls",
3324 .cb = str_gtod_reduce_cb,
3325 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003326 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003327 .category = FIO_OPT_C_STAT,
3328 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003329 },
3330 {
Jens Axboe02af0982010-06-24 09:59:34 +02003331 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003332 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003333 .type = FIO_OPT_BOOL,
3334 .off1 = td_var_offset(disable_lat),
3335 .help = "Disable latency numbers",
3336 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003337 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003338 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003339 .category = FIO_OPT_C_STAT,
3340 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003341 },
3342 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003343 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003344 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003345 .type = FIO_OPT_BOOL,
3346 .off1 = td_var_offset(disable_clat),
3347 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003348 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003349 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003350 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003351 .category = FIO_OPT_C_STAT,
3352 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003353 },
3354 {
3355 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003356 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003357 .type = FIO_OPT_BOOL,
3358 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003359 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003360 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003361 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003362 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003363 .category = FIO_OPT_C_STAT,
3364 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003365 },
3366 {
3367 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003368 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003369 .type = FIO_OPT_BOOL,
3370 .off1 = td_var_offset(disable_bw),
3371 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003372 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003373 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003374 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003375 .category = FIO_OPT_C_STAT,
3376 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003377 },
3378 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003379 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003380 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003381 .type = FIO_OPT_INT,
3382 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003383 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003384 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003385 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003386 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003387 },
3388 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003389 .name = "unified_rw_reporting",
3390 .type = FIO_OPT_BOOL,
3391 .off1 = td_var_offset(unified_rw_rep),
3392 .help = "Unify reporting across data direction",
3393 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003394 .category = FIO_OPT_C_GENERAL,
3395 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003396 },
3397 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003398 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003399 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003400 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003401 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003402 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003403 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003404 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003405 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003406 .posval = {
3407 { .ival = "none",
3408 .oval = ERROR_TYPE_NONE,
3409 .help = "Exit when an error is encountered",
3410 },
3411 { .ival = "read",
3412 .oval = ERROR_TYPE_READ,
3413 .help = "Continue on read errors only",
3414 },
3415 { .ival = "write",
3416 .oval = ERROR_TYPE_WRITE,
3417 .help = "Continue on write errors only",
3418 },
3419 { .ival = "io",
3420 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3421 .help = "Continue on any IO errors",
3422 },
3423 { .ival = "verify",
3424 .oval = ERROR_TYPE_VERIFY,
3425 .help = "Continue on verify errors only",
3426 },
3427 { .ival = "all",
3428 .oval = ERROR_TYPE_ANY,
3429 .help = "Continue on all io and verify errors",
3430 },
3431 { .ival = "0",
3432 .oval = ERROR_TYPE_NONE,
3433 .help = "Alias for 'none'",
3434 },
3435 { .ival = "1",
3436 .oval = ERROR_TYPE_ANY,
3437 .help = "Alias for 'all'",
3438 },
3439 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003440 },
3441 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003442 .name = "ignore_error",
3443 .type = FIO_OPT_STR,
3444 .cb = str_ignore_error_cb,
3445 .help = "Set a specific list of errors to ignore",
3446 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003447 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003448 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003449 },
3450 {
3451 .name = "error_dump",
3452 .type = FIO_OPT_BOOL,
3453 .off1 = td_var_offset(error_dump),
3454 .def = "0",
3455 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003456 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003457 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003458 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003459 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003460 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003461 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003462 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003463 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003464 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003465 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003466 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003467 },
3468 {
Jens Axboea696fa22009-12-04 10:05:02 +01003469 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003470 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003471 .type = FIO_OPT_STR_STORE,
3472 .off1 = td_var_offset(cgroup),
3473 .help = "Add job to cgroup of this name",
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,
3476 },
3477 {
3478 .name = "cgroup_nodelete",
3479 .lname = "Cgroup no-delete",
3480 .type = FIO_OPT_BOOL,
3481 .off1 = td_var_offset(cgroup_nodelete),
3482 .help = "Do not delete cgroups after job completion",
3483 .def = "0",
3484 .parent = "cgroup",
3485 .category = FIO_OPT_C_GENERAL,
3486 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003487 },
3488 {
3489 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003490 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003491 .type = FIO_OPT_INT,
3492 .off1 = td_var_offset(cgroup_weight),
3493 .help = "Use given weight for cgroup",
3494 .minval = 100,
3495 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003496 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003497 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003498 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003499 },
3500 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003501 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003502 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003503 .type = FIO_OPT_INT,
3504 .off1 = td_var_offset(uid),
3505 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003506 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003507 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003508 },
3509 {
3510 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003511 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003512 .type = FIO_OPT_INT,
3513 .off1 = td_var_offset(gid),
3514 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003515 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003516 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003517 },
3518 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003519 .name = "kb_base",
3520 .lname = "KB Base",
3521 .type = FIO_OPT_INT,
3522 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003523 .prio = 1,
3524 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003525 .posval = {
3526 { .ival = "1024",
3527 .oval = 1024,
3528 .help = "Use 1024 as the K base",
3529 },
3530 { .ival = "1000",
3531 .oval = 1000,
3532 .help = "Use 1000 as the K base",
3533 },
3534 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003535 .help = "How many bytes per KB for reporting (1000 or 1024)",
3536 .category = FIO_OPT_C_GENERAL,
3537 .group = FIO_OPT_G_INVALID,
3538 },
3539 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003540 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003541 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003542 .type = FIO_OPT_INT,
3543 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003544 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003545 .posval = {
3546 { .ival = "0",
3547 .oval = 0,
3548 .help = "Auto-detect",
3549 },
3550 { .ival = "8",
3551 .oval = 8,
3552 .help = "Normal (byte based)",
3553 },
3554 { .ival = "1",
3555 .oval = 1,
3556 .help = "Bit based",
3557 },
3558 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003559 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3560 .category = FIO_OPT_C_GENERAL,
3561 .group = FIO_OPT_G_INVALID,
3562 },
3563 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003564 .name = "hugepage-size",
3565 .lname = "Hugepage size",
3566 .type = FIO_OPT_INT,
3567 .off1 = td_var_offset(hugepage_size),
3568 .help = "When using hugepages, specify size of each page",
3569 .def = __fio_stringify(FIO_HUGE_PAGE),
3570 .interval = 1024 * 1024,
3571 .category = FIO_OPT_C_GENERAL,
3572 .group = FIO_OPT_G_INVALID,
3573 },
3574 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003575 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003576 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003577 .type = FIO_OPT_INT,
3578 .off1 = td_var_offset(flow_id),
3579 .help = "The flow index ID to use",
3580 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003581 .category = FIO_OPT_C_IO,
3582 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003583 },
3584 {
3585 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003586 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003587 .type = FIO_OPT_INT,
3588 .off1 = td_var_offset(flow),
3589 .help = "Weight for flow control of this job",
3590 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003591 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003592 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003593 .category = FIO_OPT_C_IO,
3594 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003595 },
3596 {
3597 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003598 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003599 .type = FIO_OPT_INT,
3600 .off1 = td_var_offset(flow_watermark),
3601 .help = "High watermark for flow control. This option"
3602 " should be set to the same value for all threads"
3603 " with non-zero flow.",
3604 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003605 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003606 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003607 .category = FIO_OPT_C_IO,
3608 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003609 },
3610 {
3611 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003612 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003613 .type = FIO_OPT_INT,
3614 .off1 = td_var_offset(flow_sleep),
3615 .help = "How many microseconds to sleep after being held"
3616 " back by the flow control mechanism",
3617 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003618 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003619 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003620 .category = FIO_OPT_C_IO,
3621 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003622 },
3623 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003624 .name = NULL,
3625 },
3626};
3627
Jens Axboe17af15d2010-04-13 10:38:16 +02003628static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003629 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003630{
Jens Axboe17af15d2010-04-13 10:38:16 +02003631 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003632 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003633 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003634 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003635 else
3636 lopt->has_arg = required_argument;
3637}
3638
Steven Langde890a12011-11-09 14:03:34 +01003639static void options_to_lopts(struct fio_option *opts,
3640 struct option *long_options,
3641 int i, int option_type)
3642{
3643 struct fio_option *o = &opts[0];
3644 while (o->name) {
3645 add_to_lopt(&long_options[i], o, o->name, option_type);
3646 if (o->alias) {
3647 i++;
3648 add_to_lopt(&long_options[i], o, o->alias, option_type);
3649 }
3650
3651 i++;
3652 o++;
3653 assert(i < FIO_NR_OPTIONS);
3654 }
3655}
3656
3657void fio_options_set_ioengine_opts(struct option *long_options,
3658 struct thread_data *td)
3659{
3660 unsigned int i;
3661
3662 i = 0;
3663 while (long_options[i].name) {
3664 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3665 memset(&long_options[i], 0, sizeof(*long_options));
3666 break;
3667 }
3668 i++;
3669 }
3670
3671 /*
3672 * Just clear out the prior ioengine options.
3673 */
3674 if (!td || !td->eo)
3675 return;
3676
3677 options_to_lopts(td->io_ops->options, long_options, i,
3678 FIO_GETOPT_IOENGINE);
3679}
3680
Jens Axboe214e1ec2007-03-15 10:48:13 +01003681void fio_options_dup_and_init(struct option *long_options)
3682{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003683 unsigned int i;
3684
Jens Axboe9af4a242012-03-16 10:13:49 +01003685 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003686
3687 i = 0;
3688 while (long_options[i].name)
3689 i++;
3690
Jens Axboe9af4a242012-03-16 10:13:49 +01003691 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003692}
3693
Jens Axboe74929ac2009-08-05 11:42:37 +02003694struct fio_keyword {
3695 const char *word;
3696 const char *desc;
3697 char *replace;
3698};
3699
3700static struct fio_keyword fio_keywords[] = {
3701 {
3702 .word = "$pagesize",
3703 .desc = "Page size in the system",
3704 },
3705 {
3706 .word = "$mb_memory",
3707 .desc = "Megabytes of memory online",
3708 },
3709 {
3710 .word = "$ncpus",
3711 .desc = "Number of CPUs online in the system",
3712 },
3713 {
3714 .word = NULL,
3715 },
3716};
3717
3718void fio_keywords_init(void)
3719{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003720 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003721 char buf[128];
3722 long l;
3723
Jens Axboea4cfc472012-10-09 10:30:48 -06003724 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003725 fio_keywords[0].replace = strdup(buf);
3726
Jens Axboe8eb016d2011-07-11 10:24:20 +02003727 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003728 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003729 fio_keywords[1].replace = strdup(buf);
3730
Jens Axboec00a2282011-07-08 20:56:06 +02003731 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003732 sprintf(buf, "%lu", l);
3733 fio_keywords[2].replace = strdup(buf);
3734}
3735
Jens Axboe892a6ff2009-11-13 12:19:49 +01003736#define BC_APP "bc"
3737
3738static char *bc_calc(char *str)
3739{
Steven Langd0c814e2011-10-28 08:37:13 +02003740 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003741 FILE *f;
3742 int ret;
3743
3744 /*
3745 * No math, just return string
3746 */
Steven Langd0c814e2011-10-28 08:37:13 +02003747 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3748 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003749 return str;
3750
3751 /*
3752 * Split option from value, we only need to calculate the value
3753 */
3754 tmp = strchr(str, '=');
3755 if (!tmp)
3756 return str;
3757
3758 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003759
Steven Langd0c814e2011-10-28 08:37:13 +02003760 /*
3761 * Prevent buffer overflows; such a case isn't reasonable anyway
3762 */
3763 if (strlen(str) >= 128 || strlen(tmp) > 100)
3764 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003765
3766 sprintf(buf, "which %s > /dev/null", BC_APP);
3767 if (system(buf)) {
3768 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003769 return NULL;
3770 }
3771
Steven Langd0c814e2011-10-28 08:37:13 +02003772 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003773 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003774 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003775 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003776
Steven Langd0c814e2011-10-28 08:37:13 +02003777 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003778 if (ret <= 0) {
3779 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003780 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003781 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003782
Jens Axboe892a6ff2009-11-13 12:19:49 +01003783 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003784 buf[(tmp - str) + ret - 1] = '\0';
3785 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003786 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003787 return strdup(buf);
3788}
3789
3790/*
3791 * Return a copy of the input string with substrings of the form ${VARNAME}
3792 * substituted with the value of the environment variable VARNAME. The
3793 * substitution always occurs, even if VARNAME is empty or the corresponding
3794 * environment variable undefined.
3795 */
3796static char *option_dup_subs(const char *opt)
3797{
3798 char out[OPT_LEN_MAX+1];
3799 char in[OPT_LEN_MAX+1];
3800 char *outptr = out;
3801 char *inptr = in;
3802 char *ch1, *ch2, *env;
3803 ssize_t nchr = OPT_LEN_MAX;
3804 size_t envlen;
3805
3806 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3807 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3808 return NULL;
3809 }
3810
3811 in[OPT_LEN_MAX] = '\0';
3812 strncpy(in, opt, OPT_LEN_MAX);
3813
3814 while (*inptr && nchr > 0) {
3815 if (inptr[0] == '$' && inptr[1] == '{') {
3816 ch2 = strchr(inptr, '}');
3817 if (ch2 && inptr+1 < ch2) {
3818 ch1 = inptr+2;
3819 inptr = ch2+1;
3820 *ch2 = '\0';
3821
3822 env = getenv(ch1);
3823 if (env) {
3824 envlen = strlen(env);
3825 if (envlen <= nchr) {
3826 memcpy(outptr, env, envlen);
3827 outptr += envlen;
3828 nchr -= envlen;
3829 }
3830 }
3831
3832 continue;
3833 }
3834 }
3835
3836 *outptr++ = *inptr++;
3837 --nchr;
3838 }
3839
3840 *outptr = '\0';
3841 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003842}
3843
Jens Axboe74929ac2009-08-05 11:42:37 +02003844/*
3845 * Look for reserved variable names and replace them with real values
3846 */
3847static char *fio_keyword_replace(char *opt)
3848{
3849 char *s;
3850 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003851 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003852
3853 for (i = 0; fio_keywords[i].word != NULL; i++) {
3854 struct fio_keyword *kw = &fio_keywords[i];
3855
3856 while ((s = strstr(opt, kw->word)) != NULL) {
3857 char *new = malloc(strlen(opt) + 1);
3858 char *o_org = opt;
3859 int olen = s - opt;
3860 int len;
3861
3862 /*
3863 * Copy part of the string before the keyword and
3864 * sprintf() the replacement after it.
3865 */
3866 memcpy(new, opt, olen);
3867 len = sprintf(new + olen, "%s", kw->replace);
3868
3869 /*
3870 * If there's more in the original string, copy that
3871 * in too
3872 */
3873 opt += strlen(kw->word) + olen;
3874 if (strlen(opt))
3875 memcpy(new + olen + len, opt, opt - o_org - 1);
3876
3877 /*
3878 * replace opt and free the old opt
3879 */
3880 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003881 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003882
Steven Langd0c814e2011-10-28 08:37:13 +02003883 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003884 }
3885 }
3886
Steven Langd0c814e2011-10-28 08:37:13 +02003887 /*
3888 * Check for potential math and invoke bc, if possible
3889 */
3890 if (docalc)
3891 opt = bc_calc(opt);
3892
Jens Axboe7a958bd2009-11-13 12:33:54 +01003893 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003894}
3895
Steven Langd0c814e2011-10-28 08:37:13 +02003896static char **dup_and_sub_options(char **opts, int num_opts)
3897{
3898 int i;
3899 char **opts_copy = malloc(num_opts * sizeof(*opts));
3900 for (i = 0; i < num_opts; i++) {
3901 opts_copy[i] = option_dup_subs(opts[i]);
3902 if (!opts_copy[i])
3903 continue;
3904 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3905 }
3906 return opts_copy;
3907}
3908
Jens Axboe292cc472013-11-26 20:39:35 -07003909int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3910 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003911{
Steven Langde890a12011-11-09 14:03:34 +01003912 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003913 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003914
Jens Axboe9af4a242012-03-16 10:13:49 +01003915 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003916 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003917
Steven Langde890a12011-11-09 14:03:34 +01003918 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3919 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003920 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003921 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003922
Steven Langde890a12011-11-09 14:03:34 +01003923 if (opts_copy[i]) {
3924 if (newret && !o) {
3925 unknown++;
3926 continue;
3927 }
Steven Langd0c814e2011-10-28 08:37:13 +02003928 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003929 opts_copy[i] = NULL;
3930 }
3931
3932 ret |= newret;
3933 }
3934
3935 if (unknown) {
3936 ret |= ioengine_load(td);
3937 if (td->eo) {
3938 sort_options(opts_copy, td->io_ops->options, num_opts);
3939 opts = opts_copy;
3940 }
3941 for (i = 0; i < num_opts; i++) {
3942 struct fio_option *o = NULL;
3943 int newret = 1;
3944 if (!opts_copy[i])
3945 continue;
3946
3947 if (td->eo)
3948 newret = parse_option(opts_copy[i], opts[i],
3949 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003950 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003951
3952 ret |= newret;
3953 if (!o)
3954 log_err("Bad option <%s>\n", opts[i]);
3955
3956 free(opts_copy[i]);
3957 opts_copy[i] = NULL;
3958 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003959 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003960
Steven Langd0c814e2011-10-28 08:37:13 +02003961 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003962 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003963}
3964
3965int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3966{
Jens Axboe9af4a242012-03-16 10:13:49 +01003967 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003968}
3969
Steven Langde890a12011-11-09 14:03:34 +01003970int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3971 char *val)
3972{
Akinobu Mita8a96c802013-10-09 09:32:34 -06003973 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01003974}
3975
Jens Axboe214e1ec2007-03-15 10:48:13 +01003976void fio_fill_default_options(struct thread_data *td)
3977{
Jens Axboecb1402d2014-02-25 11:35:27 -08003978 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01003979 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003980}
3981
3982int fio_show_option_help(const char *opt)
3983{
Jens Axboe9af4a242012-03-16 10:13:49 +01003984 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003985}
Jens Axboed23bb322007-03-23 15:57:56 +01003986
Steven Langde890a12011-11-09 14:03:34 +01003987void options_mem_dupe(void *data, struct fio_option *options)
3988{
3989 struct fio_option *o;
3990 char **ptr;
3991
3992 for (o = &options[0]; o->name; o++) {
3993 if (o->type != FIO_OPT_STR_STORE)
3994 continue;
3995
Jens Axboef0fdbca2014-02-11 15:44:50 -07003996 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01003997 if (*ptr)
3998 *ptr = strdup(*ptr);
3999 }
4000}
4001
Jens Axboe7e356b22011-10-14 10:55:16 +02004002/*
4003 * dupe FIO_OPT_STR_STORE options
4004 */
Steven Langde890a12011-11-09 14:03:34 +01004005void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01004006{
Jens Axboe9af4a242012-03-16 10:13:49 +01004007 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01004008
4009 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01004010 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01004011
Steven Langde890a12011-11-09 14:03:34 +01004012 td->eo = malloc(td->io_ops->option_struct_size);
4013 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4014 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01004015 }
4016}
4017
Jens Axboed6978a32009-07-18 21:04:09 +02004018unsigned int fio_get_kb_base(void *data)
4019{
Jens Axboe83ea4222012-03-28 14:01:46 +02004020 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02004021 unsigned int kb_base = 0;
4022
Jens Axboecb1402d2014-02-25 11:35:27 -08004023 /*
4024 * This is a hack... For private options, *data is not holding
4025 * a pointer to the thread_options, but to private data. This means
4026 * we can't safely dereference it, but magic is first so mem wise
4027 * it is valid. But this also means that if the job first sets
4028 * kb_base and expects that to be honored by private options,
4029 * it will be disappointed. We will return the global default
4030 * for this.
4031 */
4032 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004033 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004034 if (!kb_base)
4035 kb_base = 1024;
4036
4037 return kb_base;
4038}
Jens Axboe9f988e22010-03-04 10:42:38 +01004039
Jens Axboe07b32322010-03-05 09:48:44 +01004040int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004041{
Jens Axboe07b32322010-03-05 09:48:44 +01004042 struct fio_option *__o;
4043 int opt_index = 0;
4044
Jens Axboe9af4a242012-03-16 10:13:49 +01004045 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004046 while (__o->name) {
4047 opt_index++;
4048 __o++;
4049 }
4050
Jens Axboe7b504ed2014-02-11 14:19:38 -07004051 if (opt_index + 1 == FIO_MAX_OPTS) {
4052 log_err("fio: FIO_MAX_OPTS is too small\n");
4053 return 1;
4054 }
4055
Jens Axboe9af4a242012-03-16 10:13:49 +01004056 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004057 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004058 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004059}
Jens Axboee2de69d2010-03-04 14:05:48 +01004060
Jens Axboe07b32322010-03-05 09:48:44 +01004061void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004062{
Jens Axboe07b32322010-03-05 09:48:44 +01004063 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004064
Jens Axboe9af4a242012-03-16 10:13:49 +01004065 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004066 while (o->name) {
4067 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4068 o->type = FIO_OPT_INVALID;
4069 o->prof_name = NULL;
4070 }
4071 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004072 }
4073}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004074
4075void add_opt_posval(const char *optname, const char *ival, const char *help)
4076{
4077 struct fio_option *o;
4078 unsigned int i;
4079
Jens Axboe9af4a242012-03-16 10:13:49 +01004080 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004081 if (!o)
4082 return;
4083
4084 for (i = 0; i < PARSE_MAX_VP; i++) {
4085 if (o->posval[i].ival)
4086 continue;
4087
4088 o->posval[i].ival = ival;
4089 o->posval[i].help = help;
4090 break;
4091 }
4092}
4093
4094void del_opt_posval(const char *optname, const char *ival)
4095{
4096 struct fio_option *o;
4097 unsigned int i;
4098
Jens Axboe9af4a242012-03-16 10:13:49 +01004099 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004100 if (!o)
4101 return;
4102
4103 for (i = 0; i < PARSE_MAX_VP; i++) {
4104 if (!o->posval[i].ival)
4105 continue;
4106 if (strcmp(o->posval[i].ival, ival))
4107 continue;
4108
4109 o->posval[i].ival = NULL;
4110 o->posval[i].help = NULL;
4111 }
4112}
Jens Axboe7e356b22011-10-14 10:55:16 +02004113
4114void fio_options_free(struct thread_data *td)
4115{
Jens Axboe9af4a242012-03-16 10:13:49 +01004116 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004117 if (td->eo && td->io_ops && td->io_ops->options) {
4118 options_free(td->io_ops->options, td->eo);
4119 free(td->eo);
4120 td->eo = NULL;
4121 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004122}
Jens Axboec504ee52012-03-20 11:29:09 +01004123
4124struct fio_option *fio_option_find(const char *name)
4125{
4126 return find_option(fio_options, name);
4127}
4128