blob: 3e783c15edc7375e7b4af251347068ee1622286c [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
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700105 if (str_to_decimal(fname, &val, 1, o, 0, 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
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700345 if (str_to_decimal(nr, &val, 1, o, 0, 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 Axboe214e1ec2007-03-15 10:48:13 +0100456 return 0;
457}
458
Jens Axboee8462bd2009-07-06 12:59:04 +0200459static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
460 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200461{
Jens Axboed2e268b2007-06-15 10:33:49 +0200462 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100463 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100464 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200465
Jens Axboee8462bd2009-07-06 12:59:04 +0200466 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100467 if (ret < 0) {
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
470 return 1;
471 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200472
473 p = str = strdup(input);
474
475 strip_blank_front(&str);
476 strip_blank_end(str);
477
Jens Axboec00a2282011-07-08 20:56:06 +0200478 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100479
Jens Axboed2e268b2007-06-15 10:33:49 +0200480 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100481 char *str2, *cpu2;
482 int icpu, icpu2;
483
Jens Axboed2e268b2007-06-15 10:33:49 +0200484 if (!strlen(cpu))
485 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100486
487 str2 = cpu;
488 icpu2 = -1;
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
490 if (!strlen(cpu2))
491 break;
492
493 icpu2 = atoi(cpu2);
494 }
495
496 icpu = atoi(cpu);
497 if (icpu2 == -1)
498 icpu2 = icpu;
499 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100500 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100501 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100502 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100503 ret = 1;
504 break;
505 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
508 icpu, max_cpu);
509 ret = 1;
510 break;
511 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200512
Jens Axboe62a72732008-12-08 11:37:01 +0100513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200514 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100515 icpu++;
516 }
Jens Axboe19608d62008-12-08 15:03:12 +0100517 if (ret)
518 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200519 }
520
521 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100522 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200523}
Jens Axboee8462bd2009-07-06 12:59:04 +0200524
525static int str_cpus_allowed_cb(void *data, const char *input)
526{
527 struct thread_data *td = data;
Jens Axboee8462bd2009-07-06 12:59:04 +0200528
Jens Axboe52c0cea2013-09-06 10:07:37 -0600529 if (parse_dryrun())
530 return 0;
531
Jens Axboe94b360f2014-12-09 13:17:33 -0700532 return set_cpus_allowed(td, &td->o.cpumask, input);
Jens Axboee8462bd2009-07-06 12:59:04 +0200533}
534
535static int str_verify_cpus_allowed_cb(void *data, const char *input)
536{
537 struct thread_data *td = data;
Jens Axboee8462bd2009-07-06 12:59:04 +0200538
Jens Axboe94b360f2014-12-09 13:17:33 -0700539 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
Jens Axboee8462bd2009-07-06 12:59:04 +0200540}
Jens Axboed2e268b2007-06-15 10:33:49 +0200541#endif
542
Jens Axboe67bf9822013-01-10 11:23:19 +0100543#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400544static int str_numa_cpunodes_cb(void *data, char *input)
545{
546 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200547 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400548
Jens Axboe52c0cea2013-09-06 10:07:37 -0600549 if (parse_dryrun())
550 return 0;
551
Yufei Rend0b937e2012-10-19 23:11:52 -0400552 /* numa_parse_nodestring() parses a character string list
553 * of nodes into a bit mask. The bit mask is allocated by
554 * numa_allocate_nodemask(), so it should be freed by
555 * numa_free_nodemask().
556 */
Daniel Gollub43522842014-05-01 17:07:49 +0200557 verify_bitmask = numa_parse_nodestring(input);
558 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400559 log_err("fio: numa_parse_nodestring failed\n");
560 td_verror(td, 1, "str_numa_cpunodes_cb");
561 return 1;
562 }
Daniel Gollub43522842014-05-01 17:07:49 +0200563 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400564
Daniel Gollub43522842014-05-01 17:07:49 +0200565 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400566 return 0;
567}
568
569static int str_numa_mpol_cb(void *data, char *input)
570{
571 struct thread_data *td = data;
572 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600573 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400574 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600575 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200576 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400577
Jens Axboe52c0cea2013-09-06 10:07:37 -0600578 if (parse_dryrun())
579 return 0;
580
581 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400582 if (nodelist) {
583 /* NUL-terminate mode */
584 *nodelist++ = '\0';
585 }
586
587 for (i = 0; i <= MPOL_LOCAL; i++) {
588 if (!strcmp(input, policy_types[i])) {
589 td->o.numa_mem_mode = i;
590 break;
591 }
592 }
593 if (i > MPOL_LOCAL) {
594 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
595 goto out;
596 }
597
598 switch (td->o.numa_mem_mode) {
599 case MPOL_PREFERRED:
600 /*
601 * Insist on a nodelist of one node only
602 */
603 if (nodelist) {
604 char *rest = nodelist;
605 while (isdigit(*rest))
606 rest++;
607 if (*rest) {
608 log_err("fio: one node only for \'prefer\'\n");
609 goto out;
610 }
611 } else {
612 log_err("fio: one node is needed for \'prefer\'\n");
613 goto out;
614 }
615 break;
616 case MPOL_INTERLEAVE:
617 /*
618 * Default to online nodes with memory if no nodelist
619 */
620 if (!nodelist)
621 nodelist = strdup("all");
622 break;
623 case MPOL_LOCAL:
624 case MPOL_DEFAULT:
625 /*
626 * Don't allow a nodelist
627 */
628 if (nodelist) {
629 log_err("fio: NO nodelist for \'local\'\n");
630 goto out;
631 }
632 break;
633 case MPOL_BIND:
634 /*
635 * Insist on a nodelist
636 */
637 if (!nodelist) {
638 log_err("fio: a nodelist is needed for \'bind\'\n");
639 goto out;
640 }
641 break;
642 }
643
644
645 /* numa_parse_nodestring() parses a character string list
646 * of nodes into a bit mask. The bit mask is allocated by
647 * numa_allocate_nodemask(), so it should be freed by
648 * numa_free_nodemask().
649 */
650 switch (td->o.numa_mem_mode) {
651 case MPOL_PREFERRED:
652 td->o.numa_mem_prefer_node = atoi(nodelist);
653 break;
654 case MPOL_INTERLEAVE:
655 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200656 verify_bitmask = numa_parse_nodestring(nodelist);
657 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400658 log_err("fio: numa_parse_nodestring failed\n");
659 td_verror(td, 1, "str_numa_memnodes_cb");
660 return 1;
661 }
Daniel Gollub43522842014-05-01 17:07:49 +0200662 td->o.numa_memnodes = strdup(nodelist);
663 numa_free_nodemask(verify_bitmask);
Manish Mandlik44e2ab52014-08-14 11:45:16 -0600664
Yufei Rend0b937e2012-10-19 23:11:52 -0400665 break;
666 case MPOL_LOCAL:
667 case MPOL_DEFAULT:
668 default:
669 break;
670 }
671
Yufei Rend0b937e2012-10-19 23:11:52 -0400672 return 0;
Yufei Rend0b937e2012-10-19 23:11:52 -0400673out:
674 return 1;
675}
676#endif
677
Jens Axboe214e1ec2007-03-15 10:48:13 +0100678static int str_fst_cb(void *data, const char *str)
679{
680 struct thread_data *td = data;
681 char *nr = get_opt_postfix(str);
682
683 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100684 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100685 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100686 free(nr);
687 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100688
689 return 0;
690}
691
Jens Axboe67bf9822013-01-10 11:23:19 +0100692#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100693static int str_sfr_cb(void *data, const char *str)
694{
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
697
698 td->sync_file_range_nr = 1;
699 if (nr) {
700 td->sync_file_range_nr = atoi(nr);
701 free(nr);
702 }
703
704 return 0;
705}
Jens Axboe3ae06372010-03-19 19:17:15 +0100706#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100707
Jens Axboee25839d2012-11-06 10:49:42 +0100708static int str_random_distribution_cb(void *data, const char *str)
709{
710 struct thread_data *td = data;
711 double val;
712 char *nr;
713
Jens Axboe52c0cea2013-09-06 10:07:37 -0600714 if (parse_dryrun())
715 return 0;
716
Jens Axboe925fee32012-11-06 13:50:32 +0100717 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
718 val = 1.1;
719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
720 val = 0.2;
721 else
Jens Axboee25839d2012-11-06 10:49:42 +0100722 return 0;
723
724 nr = get_opt_postfix(str);
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700725 if (nr && !str_to_float(nr, &val, 0)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100726 log_err("fio: random postfix parsing failed\n");
727 free(nr);
728 return 1;
729 }
730
Jens Axboe078189c2012-11-07 13:47:22 +0100731 free(nr);
732
Jens Axboe18ded912012-11-08 08:36:00 +0100733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
734 if (val == 1.00) {
735 log_err("fio: zipf theta must different than 1.0\n");
736 return 1;
737 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700738 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100739 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100740 if (val <= 0.00 || val >= 1.00) {
741 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
742 return 1;
743 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700744 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100745 }
Jens Axboe925fee32012-11-06 13:50:32 +0100746
Jens Axboee25839d2012-11-06 10:49:42 +0100747 return 0;
748}
749
Jens Axboe8e827d32009-08-04 09:51:48 +0200750/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800751 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200752 * is escaped with a '\', then that ':' is part of the filename and does not
753 * indicate a new file.
754 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800755static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200756{
757 char *str = *ptr;
758 char *p, *start;
759
760 if (!str || !strlen(str))
761 return NULL;
762
763 start = str;
764 do {
765 /*
766 * No colon, we are done
767 */
768 p = strchr(str, ':');
769 if (!p) {
770 *ptr = NULL;
771 break;
772 }
773
774 /*
775 * We got a colon, but it's the first character. Skip and
776 * continue
777 */
778 if (p == start) {
779 str = ++start;
780 continue;
781 }
782
783 if (*(p - 1) != '\\') {
784 *p = '\0';
785 *ptr = p + 1;
786 break;
787 }
788
789 memmove(p - 1, p, strlen(p) + 1);
790 str = p;
791 } while (1);
792
793 return start;
794}
795
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800796
797static int get_max_name_idx(char *input)
798{
799 unsigned int cur_idx;
800 char *str, *p;
801
802 p = str = strdup(input);
803 for (cur_idx = 0; ; cur_idx++)
804 if (get_next_name(&str) == NULL)
805 break;
806
807 free(p);
808 return cur_idx;
809}
810
811/*
812 * Returns the directory at the index, indexes > entires will be
813 * assigned via modulo division of the index
814 */
815int set_name_idx(char *target, char *input, int index)
816{
817 unsigned int cur_idx;
818 int len;
819 char *fname, *str, *p;
820
821 p = str = strdup(input);
822
823 index %= get_max_name_idx(input);
824 for (cur_idx = 0; cur_idx <= index; cur_idx++)
825 fname = get_next_name(&str);
826
827 len = sprintf(target, "%s/", fname);
828 free(p);
829
830 return len;
831}
832
Jens Axboe214e1ec2007-03-15 10:48:13 +0100833static int str_filename_cb(void *data, const char *input)
834{
835 struct thread_data *td = data;
836 char *fname, *str, *p;
837
838 p = str = strdup(input);
839
840 strip_blank_front(&str);
841 strip_blank_end(str);
842
843 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100844 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100845
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800846 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100847 if (!strlen(fname))
848 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800849 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100850 }
851
852 free(p);
853 return 0;
854}
855
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800856static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100857{
858 struct thread_data *td = data;
859 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800860 char *dirname, *str, *p;
861 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100862
Jens Axboef9633d72013-09-06 09:59:56 -0600863 if (parse_dryrun())
864 return 0;
865
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800866 p = str = strdup(td->o.directory);
867 while ((dirname = get_next_name(&str)) != NULL) {
868 if (lstat(dirname, &sb) < 0) {
869 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100870
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800871 log_err("fio: %s is not a directory\n", dirname);
872 td_verror(td, ret, "lstat");
873 goto out;
874 }
875 if (!S_ISDIR(sb.st_mode)) {
876 log_err("fio: %s is not a directory\n", dirname);
877 ret = 1;
878 goto out;
879 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100880 }
881
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800882out:
883 free(p);
884 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100885}
886
Jens Axboef2a28032014-02-11 09:12:06 -0700887static int str_lockfile_cb(void *data, const char fio_unused *str)
888{
889 struct thread_data *td = data;
890
891 if (td->files_index) {
892 log_err("fio: lockfile= option must precede filename=\n");
893 return 1;
894 }
895
896 return 0;
897}
898
Jens Axboe214e1ec2007-03-15 10:48:13 +0100899static int str_opendir_cb(void *data, const char fio_unused *str)
900{
901 struct thread_data *td = data;
902
Jens Axboe52c0cea2013-09-06 10:07:37 -0600903 if (parse_dryrun())
904 return 0;
905
Jens Axboe214e1ec2007-03-15 10:48:13 +0100906 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100907 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100908
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100909 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100910}
911
Jens Axboece35b1e2014-01-14 15:35:58 -0700912static int pattern_cb(char *pattern, unsigned int max_size,
913 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200914{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100915 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700916 int i = 0, j = 0, len, k, base = 10;
917 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200918 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200919
Jens Axboe5de855d2014-08-22 14:02:02 -0500920 /*
921 * Check if it's a string input
922 */
923 loc1 = strchr(input, '\"');
924 if (loc1) {
925 do {
926 loc1++;
927 if (*loc1 == '\0' || *loc1 == '\"')
928 break;
929
930 pattern[i] = *loc1;
931 i++;
932 } while (i < max_size);
933
934 if (!i)
935 return 1;
936
937 goto fill;
938 }
939
940 /*
941 * No string, find out if it's decimal or hexidecimal
942 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100943 loc1 = strstr(input, "0x");
944 loc2 = strstr(input, "0X");
945 if (loc1 || loc2)
946 base = 16;
947 off = strtol(input, NULL, base);
948 if (off != LONG_MAX || errno != ERANGE) {
949 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700950 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100951 off >>= 8;
952 i++;
953 }
954 } else {
955 len = strlen(input);
956 k = len - 1;
957 if (base == 16) {
958 if (loc1)
959 j = loc1 - input + 2;
960 else
961 j = loc2 - input + 2;
962 } else
963 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700964 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100965 while (k >= j) {
966 off = converthexchartoint(input[k--]);
967 if (k >= j)
968 off += (converthexchartoint(input[k--])
969 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700970 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100971 }
972 }
973 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100974
975 /*
976 * Fill the pattern all the way to the end. This greatly reduces
977 * the number of memcpy's we have to do when verifying the IO.
978 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500979fill:
Jens Axboee078de42013-04-24 23:07:17 -0600980 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700981 while (i > 1 && i * 2 <= max_size) {
982 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100983 i *= 2;
984 }
Jens Axboee078de42013-04-24 23:07:17 -0600985
986 /*
987 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700988 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600989 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700990 while (i > 1 && i < max_size) {
991 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600992
Jens Axboece35b1e2014-01-14 15:35:58 -0700993 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600994 i += b;
995 }
996
Steven Lang9a2a86d2012-02-07 09:42:59 +0100997 if (i == 1) {
998 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -0500999 * The code in verify_io_u_pattern assumes a single byte
1000 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +01001001 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001002 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +01001003 }
Steven Langefcd9dc2012-02-02 20:22:04 +01001004
Jens Axboece35b1e2014-01-14 15:35:58 -07001005 *pattern_bytes = i;
1006 return 0;
1007}
1008
1009static int str_buffer_pattern_cb(void *data, const char *input)
1010{
1011 struct thread_data *td = data;
1012 int ret;
1013
1014 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1015 &td->o.buffer_pattern_bytes);
1016
Jens Axboedf91a1f2014-08-22 10:22:03 -05001017 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboe97f78c42014-12-04 08:27:21 -07001018 if (!td->o.compress_percentage)
1019 td->o.refill_buffers = 0;
Jens Axboece35b1e2014-01-14 15:35:58 -07001020 td->o.scramble_buffers = 0;
1021 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001022 } else {
1023 log_err("fio: failed parsing pattern `%s`\n", input);
1024 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001025 }
1026
1027 return ret;
1028}
1029
Jens Axboebedc9dc2014-03-17 12:51:09 -06001030static int str_buffer_compress_cb(void *data, unsigned long long *il)
1031{
1032 struct thread_data *td = data;
1033
1034 td->flags |= TD_F_COMPRESS;
1035 td->o.compress_percentage = *il;
1036 return 0;
1037}
1038
Jens Axboee66dac22014-09-22 10:02:07 -06001039static int str_dedupe_cb(void *data, unsigned long long *il)
1040{
1041 struct thread_data *td = data;
1042
1043 td->flags |= TD_F_COMPRESS;
1044 td->o.dedupe_percentage = *il;
1045 td->o.refill_buffers = 1;
1046 return 0;
1047}
1048
Jens Axboece35b1e2014-01-14 15:35:58 -07001049static int str_verify_pattern_cb(void *data, const char *input)
1050{
1051 struct thread_data *td = data;
1052 int ret;
1053
1054 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1055 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001056
Jens Axboe92bf48d2011-01-14 21:20:42 +01001057 /*
1058 * VERIFY_META could already be set
1059 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001060 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001061 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001062
Jens Axboece35b1e2014-01-14 15:35:58 -07001063 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001064}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001065
Jens Axboe993bf482008-11-14 13:04:53 +01001066static int str_gtod_reduce_cb(void *data, int *il)
1067{
1068 struct thread_data *td = data;
1069 int val = *il;
1070
Jens Axboe02af0982010-06-24 09:59:34 +02001071 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001072 td->o.disable_clat = !!val;
1073 td->o.disable_slat = !!val;
1074 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001075 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001076 if (val)
1077 td->tv_cache_mask = 63;
1078
1079 return 0;
1080}
1081
Jens Axboe7bb59102011-07-12 19:47:03 +02001082static int str_size_cb(void *data, unsigned long long *__val)
1083{
1084 struct thread_data *td = data;
1085 unsigned long long v = *__val;
1086
1087 if (parse_is_percent(v)) {
1088 td->o.size = 0;
1089 td->o.size_percent = -1ULL - v;
1090 } else
1091 td->o.size = v;
1092
1093 return 0;
1094}
1095
Jens Axboe896cac22009-07-01 10:38:35 +02001096static int rw_verify(struct fio_option *o, void *data)
1097{
1098 struct thread_data *td = data;
1099
1100 if (read_only && td_write(td)) {
1101 log_err("fio: job <%s> has write bit set, but fio is in"
1102 " read-only mode\n", td->o.name);
1103 return 1;
1104 }
1105
1106 return 0;
1107}
1108
Jens Axboe276ca4f2009-07-01 10:43:05 +02001109static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001110{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001111#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001112 struct thread_data *td = data;
1113
Jens Axboe29d43ff2009-07-01 10:42:18 +02001114 if (td->o.gtod_cpu) {
1115 log_err("fio: platform must support CPU affinity for"
1116 "gettimeofday() offloading\n");
1117 return 1;
1118 }
1119#endif
1120
1121 return 0;
1122}
1123
Jens Axboe214e1ec2007-03-15 10:48:13 +01001124/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001125 * Option grouping
1126 */
1127static struct opt_group fio_opt_groups[] = {
1128 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001129 .name = "General",
1130 .mask = FIO_OPT_C_GENERAL,
1131 },
1132 {
1133 .name = "I/O",
1134 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001135 },
1136 {
1137 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001138 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001139 },
1140 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001141 .name = "Statistics",
1142 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001143 },
1144 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001145 .name = "Logging",
1146 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001147 },
1148 {
Jens Axboe13fca822012-03-31 13:55:54 +02001149 .name = "Profiles",
1150 .mask = FIO_OPT_C_PROFILE,
1151 },
1152 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001153 .name = NULL,
1154 },
1155};
1156
Jens Axboee8b0e952012-03-19 14:37:08 +01001157static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1158 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001159{
1160 struct opt_group *og;
1161 int i;
1162
Jens Axboee8b0e952012-03-19 14:37:08 +01001163 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001164 return NULL;
1165
Jens Axboee8b0e952012-03-19 14:37:08 +01001166 for (i = 0; ogs[i].name; i++) {
1167 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001168
1169 if (*mask & og->mask) {
1170 *mask &= ~(og->mask);
1171 return og;
1172 }
1173 }
1174
1175 return NULL;
1176}
1177
Jens Axboee8b0e952012-03-19 14:37:08 +01001178struct opt_group *opt_group_from_mask(unsigned int *mask)
1179{
1180 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1181}
1182
1183static struct opt_group fio_opt_cat_groups[] = {
1184 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001185 .name = "Latency profiling",
1186 .mask = FIO_OPT_G_LATPROF,
1187 },
1188 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001189 .name = "Rate",
1190 .mask = FIO_OPT_G_RATE,
1191 },
1192 {
1193 .name = "Zone",
1194 .mask = FIO_OPT_G_ZONE,
1195 },
1196 {
1197 .name = "Read/write mix",
1198 .mask = FIO_OPT_G_RWMIX,
1199 },
1200 {
1201 .name = "Verify",
1202 .mask = FIO_OPT_G_VERIFY,
1203 },
1204 {
1205 .name = "Trim",
1206 .mask = FIO_OPT_G_TRIM,
1207 },
1208 {
1209 .name = "I/O Logging",
1210 .mask = FIO_OPT_G_IOLOG,
1211 },
1212 {
1213 .name = "I/O Depth",
1214 .mask = FIO_OPT_G_IO_DEPTH,
1215 },
1216 {
1217 .name = "I/O Flow",
1218 .mask = FIO_OPT_G_IO_FLOW,
1219 },
1220 {
Jens Axboe06260372012-03-19 15:16:08 +01001221 .name = "Description",
1222 .mask = FIO_OPT_G_DESC,
1223 },
1224 {
1225 .name = "Filename",
1226 .mask = FIO_OPT_G_FILENAME,
1227 },
1228 {
1229 .name = "General I/O",
1230 .mask = FIO_OPT_G_IO_BASIC,
1231 },
1232 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001233 .name = "Cgroups",
1234 .mask = FIO_OPT_G_CGROUP,
1235 },
1236 {
1237 .name = "Runtime",
1238 .mask = FIO_OPT_G_RUNTIME,
1239 },
1240 {
Jens Axboe10860052012-03-19 20:56:53 +01001241 .name = "Process",
1242 .mask = FIO_OPT_G_PROCESS,
1243 },
1244 {
1245 .name = "Job credentials / priority",
1246 .mask = FIO_OPT_G_CRED,
1247 },
1248 {
1249 .name = "Clock settings",
1250 .mask = FIO_OPT_G_CLOCK,
1251 },
1252 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001253 .name = "I/O Type",
1254 .mask = FIO_OPT_G_IO_TYPE,
1255 },
1256 {
1257 .name = "I/O Thinktime",
1258 .mask = FIO_OPT_G_THINKTIME,
1259 },
1260 {
1261 .name = "Randomizations",
1262 .mask = FIO_OPT_G_RANDOM,
1263 },
1264 {
1265 .name = "I/O buffers",
1266 .mask = FIO_OPT_G_IO_BUF,
1267 },
1268 {
Jens Axboe13fca822012-03-31 13:55:54 +02001269 .name = "Tiobench profile",
1270 .mask = FIO_OPT_G_TIOBENCH,
1271 },
1272
1273 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001274 .name = NULL,
1275 }
1276};
1277
1278struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1279{
1280 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1281}
1282
Jens Axboe9af4a242012-03-16 10:13:49 +01001283/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001284 * Map of job/command line options
1285 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001286struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001287 {
1288 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001289 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001290 .type = FIO_OPT_STR_STORE,
1291 .off1 = td_var_offset(description),
1292 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001293 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001294 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001295 },
1296 {
1297 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001298 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001299 .type = FIO_OPT_STR_STORE,
1300 .off1 = td_var_offset(name),
1301 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001302 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001303 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001304 },
1305 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001306 .name = "filename",
1307 .lname = "Filename(s)",
1308 .type = FIO_OPT_STR_STORE,
1309 .off1 = td_var_offset(filename),
1310 .cb = str_filename_cb,
1311 .prio = -1, /* must come after "directory" */
1312 .help = "File(s) to use for the workload",
1313 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001314 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001315 },
1316 {
1317 .name = "directory",
1318 .lname = "Directory",
1319 .type = FIO_OPT_STR_STORE,
1320 .off1 = td_var_offset(directory),
1321 .cb = str_directory_cb,
1322 .help = "Directory to store files in",
1323 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001324 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001325 },
1326 {
Jens Axboede98bd32013-04-05 11:09:20 +02001327 .name = "filename_format",
1328 .type = FIO_OPT_STR_STORE,
1329 .off1 = td_var_offset(filename_format),
1330 .prio = -1, /* must come after "directory" */
1331 .help = "Override default $jobname.$jobnum.$filenum naming",
1332 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001333 .category = FIO_OPT_C_FILE,
1334 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001335 },
1336 {
Jens Axboe29c13492008-03-01 19:25:20 +01001337 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001338 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001339 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001340 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001341 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001342 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001343 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001344 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001345 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001346 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001347 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001348 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001349 .posval = {
1350 { .ival = "none",
1351 .oval = FILE_LOCK_NONE,
1352 .help = "No file locking",
1353 },
1354 { .ival = "exclusive",
1355 .oval = FILE_LOCK_EXCLUSIVE,
1356 .help = "Exclusive file lock",
1357 },
1358 {
1359 .ival = "readwrite",
1360 .oval = FILE_LOCK_READWRITE,
1361 .help = "Read vs write lock",
1362 },
1363 },
Jens Axboe29c13492008-03-01 19:25:20 +01001364 },
1365 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001366 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001367 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001368 .type = FIO_OPT_STR_STORE,
1369 .off1 = td_var_offset(opendir),
1370 .cb = str_opendir_cb,
1371 .help = "Recursively add files from this directory and down",
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 Axboe214e1ec2007-03-15 10:48:13 +01001374 },
1375 {
1376 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001377 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001378 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001379 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001380 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001381 .off1 = td_var_offset(td_ddir),
1382 .help = "IO direction",
1383 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001384 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001385 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001386 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001387 .posval = {
1388 { .ival = "read",
1389 .oval = TD_DDIR_READ,
1390 .help = "Sequential read",
1391 },
1392 { .ival = "write",
1393 .oval = TD_DDIR_WRITE,
1394 .help = "Sequential write",
1395 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001396 { .ival = "trim",
1397 .oval = TD_DDIR_TRIM,
1398 .help = "Sequential trim",
1399 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001400 { .ival = "randread",
1401 .oval = TD_DDIR_RANDREAD,
1402 .help = "Random read",
1403 },
1404 { .ival = "randwrite",
1405 .oval = TD_DDIR_RANDWRITE,
1406 .help = "Random write",
1407 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001408 { .ival = "randtrim",
1409 .oval = TD_DDIR_RANDTRIM,
1410 .help = "Random trim",
1411 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001412 { .ival = "rw",
1413 .oval = TD_DDIR_RW,
1414 .help = "Sequential read and write mix",
1415 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001416 { .ival = "readwrite",
1417 .oval = TD_DDIR_RW,
1418 .help = "Sequential read and write mix",
1419 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001420 { .ival = "randrw",
1421 .oval = TD_DDIR_RANDRW,
1422 .help = "Random read and write mix"
1423 },
1424 },
1425 },
1426 {
Jens Axboe38dad622010-07-20 14:46:00 -06001427 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001428 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001429 .type = FIO_OPT_STR,
1430 .off1 = td_var_offset(rw_seq),
1431 .help = "IO offset generator modifier",
1432 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001433 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001434 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001435 .posval = {
1436 { .ival = "sequential",
1437 .oval = RW_SEQ_SEQ,
1438 .help = "Generate sequential offsets",
1439 },
1440 { .ival = "identical",
1441 .oval = RW_SEQ_IDENT,
1442 .help = "Generate identical offsets",
1443 },
1444 },
1445 },
1446
1447 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001448 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001449 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001450 .type = FIO_OPT_STR_STORE,
1451 .off1 = td_var_offset(ioengine),
1452 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001453 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001454 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001455 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001456 .posval = {
1457 { .ival = "sync",
1458 .help = "Use read/write",
1459 },
gurudas paia31041e2007-10-23 15:12:30 +02001460 { .ival = "psync",
1461 .help = "Use pread/pwrite",
1462 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001463 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001464 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001465 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001466#ifdef CONFIG_PWRITEV
1467 { .ival = "pvsync",
1468 .help = "Use preadv/pwritev",
1469 },
1470#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001471#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001472 { .ival = "libaio",
1473 .help = "Linux native asynchronous IO",
1474 },
1475#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001476#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001477 { .ival = "posixaio",
1478 .help = "POSIX asynchronous IO",
1479 },
1480#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001481#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001482 { .ival = "solarisaio",
1483 .help = "Solaris native asynchronous IO",
1484 },
1485#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001486#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001487 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001488 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001489 },
Jens Axboe3be80072011-01-19 11:07:28 -07001490#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001491#ifdef CONFIG_RBD
1492 { .ival = "rbd",
1493 .help = "Rados Block Device asynchronous IO"
1494 },
1495#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001496 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001497 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001498 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001499#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001500 { .ival = "splice",
1501 .help = "splice/vmsplice based IO",
1502 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001503 { .ival = "netsplice",
1504 .help = "splice/vmsplice to/from the network",
1505 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001506#endif
1507#ifdef FIO_HAVE_SGIO
1508 { .ival = "sg",
1509 .help = "SCSI generic v3 IO",
1510 },
1511#endif
1512 { .ival = "null",
1513 .help = "Testing engine (no data transfer)",
1514 },
1515 { .ival = "net",
1516 .help = "Network IO",
1517 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001518 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001519 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001520 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001521#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001522 { .ival = "guasi",
1523 .help = "GUASI IO engine",
1524 },
1525#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001526#ifdef FIO_HAVE_BINJECT
1527 { .ival = "binject",
1528 .help = "binject direct inject block engine",
1529 },
1530#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001531#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001532 { .ival = "rdma",
1533 .help = "RDMA IO engine",
1534 },
1535#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001536#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001537 { .ival = "fusion-aw-sync",
1538 .help = "Fusion-io atomic write engine",
1539 },
1540#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001541#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001542 { .ival = "e4defrag",
1543 .help = "ext4 defrag engine",
1544 },
1545#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001546#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001547 { .ival = "falloc",
1548 .help = "fallocate() file based engine",
1549 },
1550#endif
chenh321fc5a2014-03-31 11:32:29 -04001551#ifdef CONFIG_GFAPI
1552 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001553 .help = "Glusterfs libgfapi(sync) based engine"
1554 },
1555 { .ival = "gfapi_async",
1556 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001557 },
1558#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001559#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001560 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001561 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1562 },
1563#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001564 { .ival = "external",
1565 .help = "Load external engine (append name)",
1566 },
1567 },
1568 },
1569 {
1570 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001571 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001572 .type = FIO_OPT_INT,
1573 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001574 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001575 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001576 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001577 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001578 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001579 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001580 },
1581 {
1582 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001583 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001584 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001585 .type = FIO_OPT_INT,
1586 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001587 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001588 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001589 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001590 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001591 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001592 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001593 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001594 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001595 },
1596 {
Jens Axboe49504212008-06-05 09:03:30 +02001597 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001598 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001599 .type = FIO_OPT_INT,
1600 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001601 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001602 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001603 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001604 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001605 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001606 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001607 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001608 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001609 },
1610 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001611 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001612 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001613 .type = FIO_OPT_INT,
1614 .off1 = td_var_offset(iodepth_low),
1615 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001616 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001617 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001618 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001619 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001620 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001621 },
1622 {
1623 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001624 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001625 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001626 .cb = str_size_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001627 .off1 = td_var_offset(size),
Jens Axboe214e1ec2007-03-15 10:48:13 +01001628 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001629 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001630 .category = FIO_OPT_C_IO,
1631 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001632 },
1633 {
Jens Axboeb65f3922014-12-10 19:21:37 -07001634 .name = "io_size",
1635 .alias = "io_limit",
1636 .lname = "IO Size",
Jens Axboe77731b22014-04-28 12:08:47 -06001637 .type = FIO_OPT_STR_VAL,
1638 .off1 = td_var_offset(io_limit),
1639 .interval = 1024 * 1024,
1640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_INVALID,
1642 },
1643 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001644 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001645 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001646 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001647 .type = FIO_OPT_BOOL,
1648 .off1 = td_var_offset(fill_device),
1649 .help = "Write until an ENOSPC error occurs",
1650 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001651 .category = FIO_OPT_C_FILE,
1652 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001653 },
1654 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001655 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001656 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001657 .type = FIO_OPT_STR_VAL,
1658 .off1 = td_var_offset(file_size_low),
1659 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001660 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001661 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001662 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001663 .category = FIO_OPT_C_FILE,
1664 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001665 },
1666 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001667 .name = "file_append",
1668 .lname = "File append",
1669 .type = FIO_OPT_BOOL,
1670 .off1 = td_var_offset(file_append),
1671 .help = "IO will start at the end of the file(s)",
1672 .def = "0",
1673 .category = FIO_OPT_C_FILE,
1674 .group = FIO_OPT_G_INVALID,
1675 },
1676 {
Jens Axboe67a10002007-07-31 23:12:16 +02001677 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001678 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001679 .alias = "fileoffset",
1680 .type = FIO_OPT_STR_VAL,
1681 .off1 = td_var_offset(start_offset),
1682 .help = "Start IO from this offset",
1683 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001684 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001687 },
1688 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001689 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001690 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001691 .type = FIO_OPT_STR_VAL,
1692 .off1 = td_var_offset(offset_increment),
1693 .help = "What is the increment from one offset to the next",
1694 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001695 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001696 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001697 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001698 .category = FIO_OPT_C_IO,
1699 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001700 },
1701 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001702 .name = "number_ios",
1703 .lname = "Number of IOs to perform",
1704 .type = FIO_OPT_STR_VAL,
1705 .off1 = td_var_offset(number_ios),
Jens Axboe0b24a952014-09-28 16:24:23 -06001706 .help = "Force job completion after this number of IOs",
Jens Axboeddf24e42013-08-09 12:53:44 -06001707 .def = "0",
1708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_INVALID,
1710 },
1711 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001712 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001713 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001714 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001715 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001716 .off1 = td_var_offset(bs[DDIR_READ]),
1717 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001718 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001719 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001720 .help = "Block size unit",
1721 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001722 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001723 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001724 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001725 .category = FIO_OPT_C_IO,
1726 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001727 },
1728 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001729 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001730 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001731 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001732 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001733 .off1 = td_var_offset(ba[DDIR_READ]),
1734 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001735 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001736 .minval = 1,
1737 .help = "IO block offset alignment",
1738 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001739 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001740 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001741 .category = FIO_OPT_C_IO,
1742 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001743 },
1744 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001745 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001746 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001747 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001748 .type = FIO_OPT_RANGE,
1749 .off1 = td_var_offset(min_bs[DDIR_READ]),
1750 .off2 = td_var_offset(max_bs[DDIR_READ]),
1751 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1752 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001753 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1754 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001755 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001756 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001757 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001758 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001759 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001760 .category = FIO_OPT_C_IO,
1761 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001762 },
1763 {
Jens Axboe564ca972007-12-14 12:21:19 +01001764 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001765 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001766 .type = FIO_OPT_STR,
1767 .cb = str_bssplit_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001768 .off1 = td_var_offset(bssplit),
Jens Axboe564ca972007-12-14 12:21:19 +01001769 .help = "Set a specific mix of block sizes",
1770 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001771 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001772 .category = FIO_OPT_C_IO,
1773 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001774 },
1775 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001776 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001777 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001778 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001779 .type = FIO_OPT_STR_SET,
1780 .off1 = td_var_offset(bs_unaligned),
1781 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001782 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001783 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001784 .category = FIO_OPT_C_IO,
1785 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001786 },
1787 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001788 .name = "bs_is_seq_rand",
1789 .lname = "Block size division is seq/random (not read/write)",
1790 .type = FIO_OPT_BOOL,
1791 .off1 = td_var_offset(bs_is_seq_rand),
Jens Axboe86051d42014-09-28 16:25:49 -06001792 .help = "Consider any blocksize setting to be sequential,random",
Jens Axboe6aca9b32013-07-25 12:45:26 -06001793 .def = "0",
1794 .parent = "blocksize",
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_INVALID,
1797 },
1798 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001799 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001800 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(rand_repeatable),
1803 .help = "Use repeatable random IO pattern",
1804 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001805 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001806 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001807 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001808 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001809 },
1810 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001811 .name = "randseed",
1812 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001813 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001814 .off1 = td_var_offset(rand_seed),
1815 .help = "Set the random generator seed value",
1816 .parent = "rw",
1817 .category = FIO_OPT_C_IO,
1818 .group = FIO_OPT_G_RANDOM,
1819 },
1820 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001821 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001822 .lname = "Use OS random",
Jens Axboe559073f2014-11-05 18:34:02 -07001823 .type = FIO_OPT_DEPRECATED,
1824 .off1 = td_var_offset(dep_use_os_rand),
Jens Axboee8b0e952012-03-19 14:37:08 +01001825 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001826 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001827 },
1828 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001829 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001830 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001831 .type = FIO_OPT_STR_SET,
1832 .off1 = td_var_offset(norandommap),
1833 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001834 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001835 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001836 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001837 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001838 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001839 },
1840 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001841 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001842 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001843 .type = FIO_OPT_BOOL,
1844 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001845 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001846 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001847 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001848 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001849 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001850 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001851 },
1852 {
Jens Axboe8055e412012-11-26 08:43:47 +01001853 .name = "random_generator",
1854 .type = FIO_OPT_STR,
1855 .off1 = td_var_offset(random_generator),
1856 .help = "Type of random number generator to use",
1857 .def = "tausworthe",
1858 .posval = {
1859 { .ival = "tausworthe",
1860 .oval = FIO_RAND_GEN_TAUSWORTHE,
1861 .help = "Strong Tausworthe generator",
1862 },
1863 { .ival = "lfsr",
1864 .oval = FIO_RAND_GEN_LFSR,
1865 .help = "Variable length LFSR",
1866 },
1867 },
Jens Axboe48107592012-12-04 09:43:11 +01001868 .category = FIO_OPT_C_IO,
1869 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001870 },
1871 {
Jens Axboee25839d2012-11-06 10:49:42 +01001872 .name = "random_distribution",
1873 .type = FIO_OPT_STR,
1874 .off1 = td_var_offset(random_distribution),
1875 .cb = str_random_distribution_cb,
1876 .help = "Random offset distribution generator",
1877 .def = "random",
1878 .posval = {
1879 { .ival = "random",
1880 .oval = FIO_RAND_DIST_RANDOM,
1881 .help = "Completely random",
1882 },
1883 { .ival = "zipf",
1884 .oval = FIO_RAND_DIST_ZIPF,
1885 .help = "Zipf distribution",
1886 },
Jens Axboe925fee32012-11-06 13:50:32 +01001887 { .ival = "pareto",
1888 .oval = FIO_RAND_DIST_PARETO,
1889 .help = "Pareto distribution",
1890 },
Jens Axboee25839d2012-11-06 10:49:42 +01001891 },
Jens Axboe48107592012-12-04 09:43:11 +01001892 .category = FIO_OPT_C_IO,
1893 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001894 },
1895 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001896 .name = "percentage_random",
1897 .lname = "Percentage Random",
1898 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001899 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1900 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1901 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001902 .maxval = 100,
1903 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001904 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001905 .interval = 5,
1906 .inverse = "percentage_sequential",
1907 .category = FIO_OPT_C_IO,
1908 .group = FIO_OPT_G_RANDOM,
1909 },
1910 {
1911 .name = "percentage_sequential",
1912 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001913 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001914 .category = FIO_OPT_C_IO,
1915 .group = FIO_OPT_G_RANDOM,
1916 },
1917 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001918 .name = "allrandrepeat",
1919 .type = FIO_OPT_BOOL,
1920 .off1 = td_var_offset(allrand_repeatable),
1921 .help = "Use repeatable random numbers for everything",
1922 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001923 .category = FIO_OPT_C_IO,
1924 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001925 },
1926 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001927 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001928 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001929 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001930 .type = FIO_OPT_INT,
1931 .off1 = td_var_offset(nr_files),
1932 .help = "Split job workload between this number of files",
1933 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001934 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001935 .category = FIO_OPT_C_FILE,
1936 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001937 },
1938 {
1939 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001940 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001941 .type = FIO_OPT_INT,
1942 .off1 = td_var_offset(open_files),
1943 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001944 .category = FIO_OPT_C_FILE,
1945 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001946 },
1947 {
1948 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001949 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001950 .type = FIO_OPT_STR,
1951 .cb = str_fst_cb,
1952 .off1 = td_var_offset(file_service_type),
1953 .help = "How to select which file to service next",
1954 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001955 .category = FIO_OPT_C_FILE,
1956 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001957 .posval = {
1958 { .ival = "random",
1959 .oval = FIO_FSERVICE_RANDOM,
1960 .help = "Choose a file at random",
1961 },
1962 { .ival = "roundrobin",
1963 .oval = FIO_FSERVICE_RR,
1964 .help = "Round robin select files",
1965 },
Jens Axboea086c252009-03-04 08:27:37 +01001966 { .ival = "sequential",
1967 .oval = FIO_FSERVICE_SEQ,
1968 .help = "Finish one file before moving to the next",
1969 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001970 },
Jens Axboe67a10002007-07-31 23:12:16 +02001971 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001972 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001973 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001974#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001975 {
1976 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001977 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001978 .type = FIO_OPT_STR,
1979 .off1 = td_var_offset(fallocate_mode),
1980 .help = "Whether pre-allocation is performed when laying out files",
1981 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001982 .category = FIO_OPT_C_FILE,
1983 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001984 .posval = {
1985 { .ival = "none",
1986 .oval = FIO_FALLOCATE_NONE,
1987 .help = "Do not pre-allocate space",
1988 },
1989 { .ival = "posix",
1990 .oval = FIO_FALLOCATE_POSIX,
1991 .help = "Use posix_fallocate()",
1992 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001993#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001994 { .ival = "keep",
1995 .oval = FIO_FALLOCATE_KEEP_SIZE,
1996 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1997 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001998#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001999 /* Compatibility with former boolean values */
2000 { .ival = "0",
2001 .oval = FIO_FALLOCATE_NONE,
2002 .help = "Alias for 'none'",
2003 },
2004 { .ival = "1",
2005 .oval = FIO_FALLOCATE_POSIX,
2006 .help = "Alias for 'posix'",
2007 },
2008 },
2009 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002010#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02002011 {
2012 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002013 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002014 .type = FIO_OPT_BOOL,
2015 .off1 = td_var_offset(fadvise_hint),
2016 .help = "Use fadvise() to advise the kernel on IO pattern",
2017 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002018 .category = FIO_OPT_C_FILE,
2019 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002020 },
2021 {
2022 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002023 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002024 .type = FIO_OPT_INT,
2025 .off1 = td_var_offset(fsync_blocks),
2026 .help = "Issue fsync for writes every given number of blocks",
2027 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002028 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002029 .category = FIO_OPT_C_FILE,
2030 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002031 },
2032 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002033 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002034 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002035 .type = FIO_OPT_INT,
2036 .off1 = td_var_offset(fdatasync_blocks),
2037 .help = "Issue fdatasync for writes every given number of blocks",
2038 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002039 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002040 .category = FIO_OPT_C_FILE,
2041 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002042 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002043 {
2044 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002045 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002046 .type = FIO_OPT_INT,
2047 .off1 = td_var_offset(barrier_blocks),
2048 .help = "Make every Nth write a barrier write",
2049 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002050 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002051 .category = FIO_OPT_C_IO,
2052 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002053 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002054#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002055 {
2056 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002057 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002058 .posval = {
2059 { .ival = "wait_before",
2060 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2061 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002062 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002063 },
2064 { .ival = "write",
2065 .oval = SYNC_FILE_RANGE_WRITE,
2066 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002067 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002068 },
2069 {
2070 .ival = "wait_after",
2071 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2072 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002073 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002074 },
2075 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002076 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002077 .cb = str_sfr_cb,
2078 .off1 = td_var_offset(sync_file_range),
2079 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002080 .category = FIO_OPT_C_FILE,
2081 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002082 },
2083#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002084 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002085 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002086 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002087 .type = FIO_OPT_BOOL,
2088 .off1 = td_var_offset(odirect),
2089 .help = "Use O_DIRECT IO (negates buffered)",
2090 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002091 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002092 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002093 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002094 },
2095 {
Chris Masond01612f2013-11-15 15:52:58 -07002096 .name = "atomic",
2097 .lname = "Atomic I/O",
2098 .type = FIO_OPT_BOOL,
2099 .off1 = td_var_offset(oatomic),
2100 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2101 .def = "0",
2102 .category = FIO_OPT_C_IO,
2103 .group = FIO_OPT_G_IO_TYPE,
2104 },
2105 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002106 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002107 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002108 .type = FIO_OPT_BOOL,
2109 .off1 = td_var_offset(odirect),
2110 .neg = 1,
2111 .help = "Use buffered IO (negates direct)",
2112 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002113 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002114 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002115 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002116 },
2117 {
2118 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002119 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002120 .type = FIO_OPT_BOOL,
2121 .off1 = td_var_offset(overwrite),
2122 .help = "When writing, set whether to overwrite current data",
2123 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002124 .category = FIO_OPT_C_FILE,
2125 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002126 },
2127 {
2128 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002129 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002130 .type = FIO_OPT_INT,
2131 .off1 = td_var_offset(loops),
2132 .help = "Number of times to run the job",
2133 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002134 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002135 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002136 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002137 },
2138 {
2139 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002140 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002141 .type = FIO_OPT_INT,
2142 .off1 = td_var_offset(numjobs),
2143 .help = "Duplicate this job this many times",
2144 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002145 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002146 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002147 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002148 },
2149 {
2150 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002151 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002152 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002153 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002154 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002155 .help = "Only start job when this period has passed",
2156 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002157 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002158 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002159 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002160 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002161 },
2162 {
2163 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002164 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002165 .alias = "timeout",
2166 .type = FIO_OPT_STR_VAL_TIME,
2167 .off1 = td_var_offset(timeout),
2168 .help = "Stop workload when this amount of time has passed",
2169 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002170 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002171 .is_time = 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 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002176 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002177 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002178 .type = FIO_OPT_STR_SET,
2179 .off1 = td_var_offset(time_based),
2180 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002181 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002182 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002183 },
2184 {
Juan Casse62167762013-09-17 14:06:13 -07002185 .name = "verify_only",
2186 .lname = "Verify only",
2187 .type = FIO_OPT_STR_SET,
2188 .off1 = td_var_offset(verify_only),
2189 .help = "Verifies previously written data is still valid",
2190 .category = FIO_OPT_C_GENERAL,
2191 .group = FIO_OPT_G_RUNTIME,
2192 },
2193 {
Jens Axboe721938a2008-09-10 09:46:16 +02002194 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002195 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002196 .type = FIO_OPT_STR_VAL_TIME,
2197 .off1 = td_var_offset(ramp_time),
2198 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002199 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002200 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002201 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002202 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002203 },
2204 {
Jens Axboec223da82010-03-24 13:23:53 +01002205 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002206 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002207 .type = FIO_OPT_STR,
2208 .cb = fio_clock_source_cb,
2209 .off1 = td_var_offset(clocksource),
2210 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002211 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002212 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002213 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002214#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002215 { .ival = "gettimeofday",
2216 .oval = CS_GTOD,
2217 .help = "Use gettimeofday(2) for timing",
2218 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002219#endif
2220#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002221 { .ival = "clock_gettime",
2222 .oval = CS_CGETTIME,
2223 .help = "Use clock_gettime(2) for timing",
2224 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002225#endif
Jens Axboec223da82010-03-24 13:23:53 +01002226#ifdef ARCH_HAVE_CPU_CLOCK
2227 { .ival = "cpu",
2228 .oval = CS_CPUCLOCK,
2229 .help = "Use CPU private clock",
2230 },
2231#endif
2232 },
2233 },
2234 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002235 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002236 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002237 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002238 .type = FIO_OPT_STR,
2239 .cb = str_mem_cb,
2240 .off1 = td_var_offset(mem_type),
2241 .help = "Backing type for IO buffers",
2242 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002243 .category = FIO_OPT_C_IO,
2244 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002245 .posval = {
2246 { .ival = "malloc",
2247 .oval = MEM_MALLOC,
2248 .help = "Use malloc(3) for IO buffers",
2249 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002250#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002251 { .ival = "shm",
2252 .oval = MEM_SHM,
2253 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002254 },
2255#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002256 { .ival = "shmhuge",
2257 .oval = MEM_SHMHUGE,
2258 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002259 },
2260#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002261#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002262 { .ival = "mmap",
2263 .oval = MEM_MMAP,
2264 .help = "Use mmap(2) (file or anon) for IO buffers",
2265 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002266#ifdef FIO_HAVE_HUGETLB
2267 { .ival = "mmaphuge",
2268 .oval = MEM_MMAPHUGE,
2269 .help = "Like mmap, but use huge pages",
2270 },
2271#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002272 },
2273 },
2274 {
Jens Axboed529ee12009-07-01 10:33:03 +02002275 .name = "iomem_align",
2276 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002277 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002278 .type = FIO_OPT_INT,
2279 .off1 = td_var_offset(mem_align),
2280 .minval = 0,
2281 .help = "IO memory buffer offset alignment",
2282 .def = "0",
2283 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002284 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002285 .category = FIO_OPT_C_IO,
2286 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002287 },
2288 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002289 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002290 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002291 .type = FIO_OPT_STR,
2292 .off1 = td_var_offset(verify),
2293 .help = "Verify data written",
2294 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002295 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002296 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002297 .posval = {
2298 { .ival = "0",
2299 .oval = VERIFY_NONE,
2300 .help = "Don't do IO verification",
2301 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002302 { .ival = "md5",
2303 .oval = VERIFY_MD5,
2304 .help = "Use md5 checksums for verification",
2305 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002306 { .ival = "crc64",
2307 .oval = VERIFY_CRC64,
2308 .help = "Use crc64 checksums for verification",
2309 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002310 { .ival = "crc32",
2311 .oval = VERIFY_CRC32,
2312 .help = "Use crc32 checksums for verification",
2313 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002314 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002315 .oval = VERIFY_CRC32C,
2316 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002317 },
Jens Axboebac39e02008-06-11 20:46:19 +02002318 { .ival = "crc32c",
2319 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002320 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002321 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002322 { .ival = "crc16",
2323 .oval = VERIFY_CRC16,
2324 .help = "Use crc16 checksums for verification",
2325 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002326 { .ival = "crc7",
2327 .oval = VERIFY_CRC7,
2328 .help = "Use crc7 checksums for verification",
2329 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002330 { .ival = "sha1",
2331 .oval = VERIFY_SHA1,
2332 .help = "Use sha1 checksums for verification",
2333 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002334 { .ival = "sha256",
2335 .oval = VERIFY_SHA256,
2336 .help = "Use sha256 checksums for verification",
2337 },
2338 { .ival = "sha512",
2339 .oval = VERIFY_SHA512,
2340 .help = "Use sha512 checksums for verification",
2341 },
Jens Axboe844ea602014-02-20 13:21:45 -08002342 { .ival = "xxhash",
2343 .oval = VERIFY_XXHASH,
2344 .help = "Use xxhash checksums for verification",
2345 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002346 { .ival = "meta",
2347 .oval = VERIFY_META,
2348 .help = "Use io information",
2349 },
Jens Axboe36690c92007-03-26 10:23:34 +02002350 {
2351 .ival = "null",
2352 .oval = VERIFY_NULL,
2353 .help = "Pretend to verify",
2354 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002355 },
2356 },
2357 {
Jens Axboe005c5652007-08-02 22:21:36 +02002358 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002359 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002360 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002361 .off1 = td_var_offset(do_verify),
2362 .help = "Run verification stage after write",
2363 .def = "1",
2364 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002365 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002366 .category = FIO_OPT_C_IO,
2367 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002368 },
2369 {
Jens Axboe160b9662007-03-27 10:59:49 +02002370 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002371 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002372 .type = FIO_OPT_BOOL,
2373 .off1 = td_var_offset(verifysort),
2374 .help = "Sort written verify blocks for read back",
2375 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002376 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002377 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002380 },
2381 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002382 .name = "verifysort_nr",
2383 .type = FIO_OPT_INT,
2384 .off1 = td_var_offset(verifysort_nr),
2385 .help = "Pre-load and sort verify blocks for a read workload",
2386 .minval = 0,
2387 .maxval = 131072,
2388 .def = "1024",
2389 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002392 },
2393 {
Jens Axboea59e1702007-07-30 08:53:27 +02002394 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002395 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002396 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002397 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002398 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002399 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002400 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002401 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002402 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002403 .category = FIO_OPT_C_IO,
2404 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002405 },
2406 {
Jens Axboea59e1702007-07-30 08:53:27 +02002407 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002408 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002409 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002410 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002411 .off1 = td_var_offset(verify_offset),
2412 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002413 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002414 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002417 },
2418 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002419 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002420 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002421 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002422 .cb = str_verify_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002423 .off1 = td_var_offset(verify_pattern),
Shawn Lewise28218f2008-01-16 11:01:33 +01002424 .help = "Fill pattern for IO buffers",
2425 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002426 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002429 },
2430 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002431 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002432 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002433 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002434 .off1 = td_var_offset(verify_fatal),
2435 .def = "0",
2436 .help = "Exit on a single verify failure, don't continue",
2437 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002438 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002439 .category = FIO_OPT_C_IO,
2440 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002441 },
2442 {
Jens Axboeb463e932011-01-12 09:03:23 +01002443 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002444 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002445 .type = FIO_OPT_BOOL,
2446 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002447 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002448 .help = "Dump contents of good and bad blocks on failure",
2449 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002450 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002451 .category = FIO_OPT_C_IO,
2452 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002453 },
2454 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002455 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002456 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002457 .type = FIO_OPT_INT,
2458 .off1 = td_var_offset(verify_async),
2459 .def = "0",
2460 .help = "Number of async verifier threads to use",
2461 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002462 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002465 },
Jens Axboe9e144182010-06-15 14:25:36 +02002466 {
2467 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002468 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002469 .type = FIO_OPT_STR_VAL,
2470 .off1 = td_var_offset(verify_backlog),
2471 .help = "Verify after this number of blocks are written",
2472 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002473 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002474 .category = FIO_OPT_C_IO,
2475 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002476 },
2477 {
2478 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002479 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002480 .type = FIO_OPT_INT,
2481 .off1 = td_var_offset(verify_batch),
2482 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002483 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002484 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002487 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002488#ifdef FIO_HAVE_CPU_AFFINITY
2489 {
2490 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002491 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002492 .type = FIO_OPT_STR,
2493 .cb = str_verify_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002494 .off1 = td_var_offset(verify_cpumask),
Jens Axboee8462bd2009-07-06 12:59:04 +02002495 .help = "Set CPUs allowed for async verify threads",
2496 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002497 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002498 .category = FIO_OPT_C_IO,
2499 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002500 },
2501#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002502 {
2503 .name = "experimental_verify",
2504 .off1 = td_var_offset(experimental_verify),
2505 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002506 .help = "Enable experimental verification",
Jens Axboede54cfd2014-11-10 20:34:00 -07002507 .parent = "verify",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
2510 },
2511 {
2512 .name = "verify_state_load",
2513 .lname = "Load verify state",
2514 .off1 = td_var_offset(verify_state),
2515 .type = FIO_OPT_BOOL,
2516 .help = "Load verify termination state",
2517 .parent = "verify",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_VERIFY,
2520 },
2521 {
2522 .name = "verify_state_save",
2523 .lname = "Save verify state",
2524 .off1 = td_var_offset(verify_state_save),
2525 .type = FIO_OPT_BOOL,
2526 .def = "1",
2527 .help = "Save verify state on termination",
2528 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002529 .category = FIO_OPT_C_IO,
2530 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002531 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002532#ifdef FIO_HAVE_TRIM
2533 {
2534 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002535 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002536 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002537 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002538 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002539 .maxval = 100,
2540 .help = "Number of verify blocks to discard/trim",
2541 .parent = "verify",
2542 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002543 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002544 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002545 .category = FIO_OPT_C_IO,
2546 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002547 },
2548 {
2549 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002550 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002551 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002552 .help = "Verify that trim/discarded blocks are returned as zeroes",
2553 .off1 = td_var_offset(trim_zero),
2554 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002555 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002556 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002557 .category = FIO_OPT_C_IO,
2558 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002559 },
2560 {
2561 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002562 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002563 .type = FIO_OPT_STR_VAL,
2564 .off1 = td_var_offset(trim_backlog),
2565 .help = "Trim after this number of blocks are written",
2566 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002567 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002568 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002571 },
2572 {
2573 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002574 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002575 .type = FIO_OPT_INT,
2576 .off1 = td_var_offset(trim_batch),
2577 .help = "Trim this number of IO blocks",
2578 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002579 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002580 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002581 .category = FIO_OPT_C_IO,
2582 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002583 },
2584#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002585 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002586 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002587 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002588 .type = FIO_OPT_STR_STORE,
2589 .off1 = td_var_offset(write_iolog_file),
2590 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002593 },
2594 {
2595 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002596 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002597 .type = FIO_OPT_STR_STORE,
2598 .off1 = td_var_offset(read_iolog_file),
2599 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002600 .category = FIO_OPT_C_IO,
2601 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002602 },
2603 {
David Nellans64bbb862010-08-24 22:13:30 +02002604 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002605 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002606 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002607 .off1 = td_var_offset(no_stall),
2608 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002609 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002610 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002611 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002612 .category = FIO_OPT_C_IO,
2613 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002614 },
2615 {
David Nellansd1c46c02010-08-31 21:20:47 +02002616 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002617 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002618 .type = FIO_OPT_STR_STORE,
2619 .off1 = td_var_offset(replay_redirect),
2620 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002621 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002622 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002623 .category = FIO_OPT_C_IO,
2624 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002625 },
2626 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002627 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002628 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002629 .type = FIO_OPT_STR_STORE,
2630 .off1 = td_var_offset(exec_prerun),
2631 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002632 .category = FIO_OPT_C_GENERAL,
2633 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002634 },
2635 {
2636 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002637 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002638 .type = FIO_OPT_STR_STORE,
2639 .off1 = td_var_offset(exec_postrun),
2640 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002641 .category = FIO_OPT_C_GENERAL,
2642 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002643 },
2644#ifdef FIO_HAVE_IOSCHED_SWITCH
2645 {
2646 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002647 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002648 .type = FIO_OPT_STR_STORE,
2649 .off1 = td_var_offset(ioscheduler),
2650 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002651 .category = FIO_OPT_C_FILE,
2652 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002653 },
2654#endif
2655 {
2656 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002657 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002658 .type = FIO_OPT_STR_VAL,
2659 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002660 .help = "Amount of data to read per zone",
2661 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002662 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002663 .category = FIO_OPT_C_IO,
2664 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002665 },
2666 {
2667 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002668 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002669 .type = FIO_OPT_STR_VAL,
2670 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002671 .help = "Give size of an IO zone",
2672 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002673 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002674 .category = FIO_OPT_C_IO,
2675 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002676 },
2677 {
2678 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002679 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002680 .type = FIO_OPT_STR_VAL,
2681 .off1 = td_var_offset(zone_skip),
2682 .help = "Space between IO zones",
2683 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002684 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002685 .category = FIO_OPT_C_IO,
2686 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002687 },
2688 {
2689 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002690 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002691 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002692 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002693 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002694 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002695 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002696 .category = FIO_OPT_C_GENERAL,
2697 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002698 },
2699 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002700 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002701 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002702 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002703 .cb = str_rwmix_read_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002704 .off1 = td_var_offset(rwmix[DDIR_READ]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002705 .maxval = 100,
2706 .help = "Percentage of mixed workload that is reads",
2707 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002708 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002709 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002712 },
2713 {
2714 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002715 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002716 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002717 .cb = str_rwmix_write_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002718 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002719 .maxval = 100,
2720 .help = "Percentage of mixed workload that is writes",
2721 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002722 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002723 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002724 .category = FIO_OPT_C_IO,
2725 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002726 },
2727 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002728 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002729 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002730 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002731 .category = FIO_OPT_C_IO,
2732 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002733 },
2734 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002735 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002736 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002737 .type = FIO_OPT_INT,
2738 .off1 = td_var_offset(nice),
2739 .help = "Set job CPU nice value",
2740 .minval = -19,
2741 .maxval = 20,
2742 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002743 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002744 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002745 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002746 },
2747#ifdef FIO_HAVE_IOPRIO
2748 {
2749 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002750 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002751 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002752 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002753 .help = "Set job IO priority value",
2754 .minval = 0,
2755 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002756 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002757 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002758 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002759 },
2760 {
2761 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002762 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002763 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002764 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002765 .help = "Set job IO priority class",
2766 .minval = 0,
2767 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002768 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002769 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002770 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002771 },
2772#endif
2773 {
2774 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002775 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002776 .type = FIO_OPT_INT,
2777 .off1 = td_var_offset(thinktime),
2778 .help = "Idle time between IO buffers (usec)",
2779 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002780 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002781 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002782 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002783 },
2784 {
2785 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002786 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002787 .type = FIO_OPT_INT,
2788 .off1 = td_var_offset(thinktime_spin),
2789 .help = "Start think time by spinning this amount (usec)",
2790 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002791 .is_time = 1,
Jens Axboeafdf9352007-07-31 16:14:34 +02002792 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002793 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002794 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002795 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002796 },
2797 {
2798 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002799 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002800 .type = FIO_OPT_INT,
2801 .off1 = td_var_offset(thinktime_blocks),
2802 .help = "IO buffer period between 'thinktime'",
2803 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002804 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002805 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002807 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002808 },
2809 {
2810 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002811 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002812 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002813 .off1 = td_var_offset(rate[DDIR_READ]),
2814 .off2 = td_var_offset(rate[DDIR_WRITE]),
2815 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002816 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002817 .category = FIO_OPT_C_IO,
2818 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002819 },
2820 {
2821 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002822 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002823 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002824 .off1 = td_var_offset(ratemin[DDIR_READ]),
2825 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2826 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002827 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002828 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002829 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002830 .category = FIO_OPT_C_IO,
2831 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002832 },
2833 {
2834 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002835 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002836 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002837 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2838 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2839 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002840 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002841 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002842 .category = FIO_OPT_C_IO,
2843 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002844 },
2845 {
2846 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002847 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002848 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002849 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2850 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2851 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002852 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002853 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002854 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002855 .category = FIO_OPT_C_IO,
2856 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002857 },
2858 {
2859 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002860 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002861 .type = FIO_OPT_INT,
2862 .off1 = td_var_offset(ratecycle),
2863 .help = "Window average for rate limits (msec)",
2864 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002865 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002866 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002867 .category = FIO_OPT_C_IO,
2868 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002869 },
2870 {
Jens Axboe15501532012-10-24 16:37:45 +02002871 .name = "max_latency",
2872 .type = FIO_OPT_INT,
2873 .off1 = td_var_offset(max_latency),
2874 .help = "Maximum tolerated IO latency (usec)",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002875 .is_time = 1,
Jens Axboe1e5324e2012-11-14 14:25:31 -07002876 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002877 .group = FIO_OPT_G_LATPROF,
2878 },
2879 {
2880 .name = "latency_target",
2881 .lname = "Latency Target (usec)",
2882 .type = FIO_OPT_STR_VAL_TIME,
2883 .off1 = td_var_offset(latency_target),
2884 .help = "Ramp to max queue depth supporting this latency",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002885 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002886 .category = FIO_OPT_C_IO,
2887 .group = FIO_OPT_G_LATPROF,
2888 },
2889 {
2890 .name = "latency_window",
2891 .lname = "Latency Window (usec)",
2892 .type = FIO_OPT_STR_VAL_TIME,
2893 .off1 = td_var_offset(latency_window),
2894 .help = "Time to sustain latency_target",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002895 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_LATPROF,
2898 },
2899 {
2900 .name = "latency_percentile",
2901 .lname = "Latency Percentile",
2902 .type = FIO_OPT_FLOAT_LIST,
2903 .off1 = td_var_offset(latency_percentile),
2904 .help = "Percentile of IOs must be below latency_target",
2905 .def = "100",
2906 .maxlen = 1,
2907 .minfp = 0.0,
2908 .maxfp = 100.0,
2909 .category = FIO_OPT_C_IO,
2910 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002911 },
2912 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002913 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002914 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002915 .type = FIO_OPT_BOOL,
2916 .off1 = td_var_offset(invalidate_cache),
2917 .help = "Invalidate buffer/page cache prior to running job",
2918 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002919 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002920 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002921 },
2922 {
2923 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002924 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002925 .type = FIO_OPT_BOOL,
2926 .off1 = td_var_offset(sync_io),
2927 .help = "Use O_SYNC for buffered writes",
2928 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002929 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002930 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002931 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002932 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002933 },
2934 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002935 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002936 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002937 .type = FIO_OPT_BOOL,
2938 .off1 = td_var_offset(create_serialize),
2939 .help = "Serialize creating of job files",
2940 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002941 .category = FIO_OPT_C_FILE,
2942 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002943 },
2944 {
2945 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002946 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002949 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002950 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002951 .category = FIO_OPT_C_FILE,
2952 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002953 },
2954 {
Jens Axboe814452b2009-03-04 12:53:13 +01002955 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002956 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002957 .type = FIO_OPT_BOOL,
2958 .off1 = td_var_offset(create_on_open),
2959 .help = "Create files when they are opened for IO",
2960 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002961 .category = FIO_OPT_C_FILE,
2962 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002963 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002964 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002965 .name = "create_only",
2966 .type = FIO_OPT_BOOL,
2967 .off1 = td_var_offset(create_only),
2968 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002969 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002970 .def = "0",
2971 },
2972 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002973 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002974 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002975 .type = FIO_OPT_BOOL,
2976 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002977 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002978 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002979 .category = FIO_OPT_C_FILE,
2980 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002981 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002982#ifdef FIO_HAVE_CPU_AFFINITY
2983 {
2984 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002985 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002986 .type = FIO_OPT_INT,
2987 .cb = str_cpumask_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002988 .off1 = td_var_offset(cpumask),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002989 .help = "CPU affinity mask",
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 Axboe214e1ec2007-03-15 10:48:13 +01002992 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002993 {
2994 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002995 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002996 .type = FIO_OPT_STR,
2997 .cb = str_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002998 .off1 = td_var_offset(cpumask),
Jens Axboed2e268b2007-06-15 10:33:49 +02002999 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01003000 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003001 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02003002 },
Jens Axboec2acfba2014-02-27 15:52:02 -08003003 {
3004 .name = "cpus_allowed_policy",
3005 .lname = "CPUs allowed distribution policy",
3006 .type = FIO_OPT_STR,
3007 .off1 = td_var_offset(cpus_allowed_policy),
3008 .help = "Distribution policy for cpus_allowed",
3009 .parent = "cpus_allowed",
3010 .prio = 1,
3011 .posval = {
3012 { .ival = "shared",
3013 .oval = FIO_CPUS_SHARED,
3014 .help = "Mask shared between threads",
3015 },
3016 { .ival = "split",
3017 .oval = FIO_CPUS_SPLIT,
3018 .help = "Mask split between threads",
3019 },
3020 },
3021 .category = FIO_OPT_C_GENERAL,
3022 .group = FIO_OPT_G_CRED,
3023 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003024#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003025#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003026 {
3027 .name = "numa_cpu_nodes",
3028 .type = FIO_OPT_STR,
3029 .cb = str_numa_cpunodes_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003030 .off1 = td_var_offset(numa_cpunodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003031 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003032 .category = FIO_OPT_C_GENERAL,
3033 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003034 },
3035 {
3036 .name = "numa_mem_policy",
3037 .type = FIO_OPT_STR,
3038 .cb = str_numa_mpol_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003039 .off1 = td_var_offset(numa_memnodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003040 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003041 .category = FIO_OPT_C_GENERAL,
3042 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003043 },
3044#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003045 {
3046 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003047 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003048 .type = FIO_OPT_BOOL,
3049 .off1 = td_var_offset(end_fsync),
3050 .help = "Include fsync at the end of job",
3051 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003052 .category = FIO_OPT_C_FILE,
3053 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003054 },
3055 {
3056 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003057 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003058 .type = FIO_OPT_BOOL,
3059 .off1 = td_var_offset(fsync_on_close),
3060 .help = "fsync files on close",
3061 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003062 .category = FIO_OPT_C_FILE,
3063 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003064 },
3065 {
3066 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003067 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003068 .type = FIO_OPT_BOOL,
3069 .off1 = td_var_offset(unlink),
3070 .help = "Unlink created files after job has completed",
3071 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003072 .category = FIO_OPT_C_FILE,
3073 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003074 },
3075 {
3076 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003077 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003078 .type = FIO_OPT_STR_SET,
3079 .cb = str_exitall_cb,
3080 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003081 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003082 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003083 },
3084 {
3085 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003086 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003087 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003088 .type = FIO_OPT_STR_SET,
3089 .off1 = td_var_offset(stonewall),
3090 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003091 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003092 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003093 },
3094 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003095 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003096 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003097 .type = FIO_OPT_STR_SET,
3098 .off1 = td_var_offset(new_group),
3099 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003100 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003101 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003102 },
3103 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003104 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003105 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003106 .type = FIO_OPT_STR_SET,
3107 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003108 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003109#ifdef CONFIG_NO_SHM
3110 .def = "1",
3111 .no_warn_def = 1,
3112#endif
Jens Axboee8b0e952012-03-19 14:37:08 +01003113 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003114 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003115 },
3116 {
3117 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003118 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003119 .type = FIO_OPT_STR_STORE,
3120 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003121 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003122 .category = FIO_OPT_C_LOG,
3123 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003124 },
3125 {
3126 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003127 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003128 .type = FIO_OPT_STR_STORE,
3129 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003130 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003131 .category = FIO_OPT_C_LOG,
3132 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003133 },
3134 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003135 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003136 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003137 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003138 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003139 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003140 .category = FIO_OPT_C_LOG,
3141 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003142 },
3143 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003144 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003145 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003146 .type = FIO_OPT_INT,
3147 .off1 = td_var_offset(log_avg_msec),
3148 .help = "Average bw/iops/lat logs over this period of time",
3149 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003150 .category = FIO_OPT_C_LOG,
3151 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003152 },
3153 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003154 .name = "log_offset",
3155 .lname = "Log offset of IO",
3156 .type = FIO_OPT_BOOL,
3157 .off1 = td_var_offset(log_offset),
3158 .help = "Include offset of IO for each log entry",
3159 .def = "0",
3160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
3162 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003163#ifdef CONFIG_ZLIB
3164 {
3165 .name = "log_compression",
3166 .lname = "Log compression",
3167 .type = FIO_OPT_INT,
3168 .off1 = td_var_offset(log_gz),
3169 .help = "Log in compressed chunks of this size",
3170 .minval = 32 * 1024 * 1024ULL,
3171 .maxval = 512 * 1024 * 1024ULL,
3172 .category = FIO_OPT_C_LOG,
3173 .group = FIO_OPT_G_INVALID,
3174 },
Jens Axboebac4af12014-07-03 13:42:28 -06003175 {
3176 .name = "log_store_compressed",
3177 .lname = "Log store compressed",
3178 .type = FIO_OPT_BOOL,
3179 .off1 = td_var_offset(log_gz_store),
3180 .help = "Store logs in a compressed format",
3181 .category = FIO_OPT_C_LOG,
3182 .group = FIO_OPT_G_INVALID,
3183 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003184#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003185 {
Jens Axboec504ee52012-03-20 11:29:09 +01003186 .name = "bwavgtime",
3187 .lname = "Bandwidth average time",
3188 .type = FIO_OPT_INT,
3189 .off1 = td_var_offset(bw_avg_time),
3190 .help = "Time window over which to calculate bandwidth"
3191 " (msec)",
3192 .def = "500",
3193 .parent = "write_bw_log",
3194 .hide = 1,
3195 .interval = 100,
3196 .category = FIO_OPT_C_LOG,
3197 .group = FIO_OPT_G_INVALID,
3198 },
3199 {
3200 .name = "iopsavgtime",
3201 .lname = "IOPS average time",
3202 .type = FIO_OPT_INT,
3203 .off1 = td_var_offset(iops_avg_time),
3204 .help = "Time window over which to calculate IOPS (msec)",
3205 .def = "500",
3206 .parent = "write_iops_log",
3207 .hide = 1,
3208 .interval = 100,
3209 .category = FIO_OPT_C_LOG,
3210 .group = FIO_OPT_G_INVALID,
3211 },
3212 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003213 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003214 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003215 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003216 .off1 = td_var_offset(group_reporting),
3217 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003218 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003219 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003220 },
3221 {
Jens Axboee9459e52007-04-17 15:46:32 +02003222 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003223 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003224 .type = FIO_OPT_STR_SET,
3225 .off1 = td_var_offset(zero_buffers),
3226 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003227 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003228 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003229 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003230 {
3231 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003232 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003233 .type = FIO_OPT_STR_SET,
3234 .off1 = td_var_offset(refill_buffers),
3235 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003236 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003237 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003238 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003239 {
Jens Axboefd684182011-09-19 09:24:44 +02003240 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003241 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003242 .type = FIO_OPT_BOOL,
3243 .off1 = td_var_offset(scramble_buffers),
3244 .help = "Slightly scramble buffers on every IO submit",
3245 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003246 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003247 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003248 },
3249 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003250 .name = "buffer_pattern",
3251 .lname = "Buffer pattern",
3252 .type = FIO_OPT_STR,
3253 .cb = str_buffer_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003254 .off1 = td_var_offset(buffer_pattern),
Jens Axboece35b1e2014-01-14 15:35:58 -07003255 .help = "Fill pattern for IO buffers",
3256 .category = FIO_OPT_C_IO,
3257 .group = FIO_OPT_G_IO_BUF,
3258 },
3259 {
Jens Axboe9c426842012-03-02 21:02:12 +01003260 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003261 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003262 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003263 .cb = str_buffer_compress_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003264 .off1 = td_var_offset(compress_percentage),
Jens Axboe9c426842012-03-02 21:02:12 +01003265 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003266 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003267 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003268 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003269 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003270 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003271 },
3272 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003273 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003274 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003275 .type = FIO_OPT_INT,
3276 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003277 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003278 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003279 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003280 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003281 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003282 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003283 },
3284 {
Jens Axboee66dac22014-09-22 10:02:07 -06003285 .name = "dedupe_percentage",
3286 .lname = "Dedupe percentage",
3287 .type = FIO_OPT_INT,
3288 .cb = str_dedupe_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003289 .off1 = td_var_offset(dedupe_percentage),
Jens Axboee66dac22014-09-22 10:02:07 -06003290 .maxval = 100,
3291 .minval = 0,
3292 .help = "Percentage of buffers that are dedupable",
3293 .interval = 1,
3294 .category = FIO_OPT_C_IO,
3295 .group = FIO_OPT_G_IO_BUF,
3296 },
3297 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003298 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003299 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003300 .type = FIO_OPT_BOOL,
3301 .off1 = td_var_offset(clat_percentiles),
3302 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003303 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003304 .category = FIO_OPT_C_STAT,
3305 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003306 },
3307 {
3308 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003309 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003310 .type = FIO_OPT_FLOAT_LIST,
3311 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003312 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003313 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003314 .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 +02003315 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3316 .minfp = 0.0,
3317 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003318 .category = FIO_OPT_C_STAT,
3319 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003320 },
3321
Jens Axboe0a839f32007-04-26 09:02:34 +02003322#ifdef FIO_HAVE_DISK_UTIL
3323 {
3324 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003325 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003326 .type = FIO_OPT_BOOL,
3327 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003328 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003329 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003330 .category = FIO_OPT_C_STAT,
3331 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003332 },
3333#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003334 {
Jens Axboe993bf482008-11-14 13:04:53 +01003335 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003336 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003337 .type = FIO_OPT_BOOL,
3338 .help = "Greatly reduce number of gettimeofday() calls",
3339 .cb = str_gtod_reduce_cb,
3340 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003341 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003342 .category = FIO_OPT_C_STAT,
3343 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003344 },
3345 {
Jens Axboe02af0982010-06-24 09:59:34 +02003346 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003347 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003348 .type = FIO_OPT_BOOL,
3349 .off1 = td_var_offset(disable_lat),
3350 .help = "Disable latency numbers",
3351 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003352 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003353 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003354 .category = FIO_OPT_C_STAT,
3355 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003356 },
3357 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003358 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003359 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003360 .type = FIO_OPT_BOOL,
3361 .off1 = td_var_offset(disable_clat),
3362 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003363 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003364 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003365 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003366 .category = FIO_OPT_C_STAT,
3367 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003368 },
3369 {
3370 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003371 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003372 .type = FIO_OPT_BOOL,
3373 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003374 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003375 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003376 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003377 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003378 .category = FIO_OPT_C_STAT,
3379 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003380 },
3381 {
3382 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003383 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003384 .type = FIO_OPT_BOOL,
3385 .off1 = td_var_offset(disable_bw),
3386 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003387 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003388 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003389 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003390 .category = FIO_OPT_C_STAT,
3391 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003392 },
3393 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003394 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003395 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003396 .type = FIO_OPT_INT,
Jens Axboe80ac0202014-12-16 20:38:53 -07003397 .off1 = td_var_offset(gtod_cpu),
Bruce Cran03e20d62011-01-02 20:14:54 +01003398 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003399 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003400 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003401 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003402 },
3403 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003404 .name = "unified_rw_reporting",
3405 .type = FIO_OPT_BOOL,
3406 .off1 = td_var_offset(unified_rw_rep),
3407 .help = "Unify reporting across data direction",
3408 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003409 .category = FIO_OPT_C_GENERAL,
3410 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003411 },
3412 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003413 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003414 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003415 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003416 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003417 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003418 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003419 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003420 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003421 .posval = {
3422 { .ival = "none",
3423 .oval = ERROR_TYPE_NONE,
3424 .help = "Exit when an error is encountered",
3425 },
3426 { .ival = "read",
3427 .oval = ERROR_TYPE_READ,
3428 .help = "Continue on read errors only",
3429 },
3430 { .ival = "write",
3431 .oval = ERROR_TYPE_WRITE,
3432 .help = "Continue on write errors only",
3433 },
3434 { .ival = "io",
3435 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3436 .help = "Continue on any IO errors",
3437 },
3438 { .ival = "verify",
3439 .oval = ERROR_TYPE_VERIFY,
3440 .help = "Continue on verify errors only",
3441 },
3442 { .ival = "all",
3443 .oval = ERROR_TYPE_ANY,
3444 .help = "Continue on all io and verify errors",
3445 },
3446 { .ival = "0",
3447 .oval = ERROR_TYPE_NONE,
3448 .help = "Alias for 'none'",
3449 },
3450 { .ival = "1",
3451 .oval = ERROR_TYPE_ANY,
3452 .help = "Alias for 'all'",
3453 },
3454 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003455 },
3456 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003457 .name = "ignore_error",
3458 .type = FIO_OPT_STR,
3459 .cb = str_ignore_error_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003460 .off1 = td_var_offset(ignore_error_nr),
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003461 .help = "Set a specific list of errors to ignore",
3462 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003463 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003464 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003465 },
3466 {
3467 .name = "error_dump",
3468 .type = FIO_OPT_BOOL,
3469 .off1 = td_var_offset(error_dump),
3470 .def = "0",
3471 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003472 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003473 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003474 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003475 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003476 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003477 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003478 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003479 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003480 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003481 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003482 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003483 },
3484 {
Jens Axboea696fa22009-12-04 10:05:02 +01003485 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003486 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003487 .type = FIO_OPT_STR_STORE,
3488 .off1 = td_var_offset(cgroup),
3489 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003490 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003491 .group = FIO_OPT_G_CGROUP,
3492 },
3493 {
3494 .name = "cgroup_nodelete",
3495 .lname = "Cgroup no-delete",
3496 .type = FIO_OPT_BOOL,
3497 .off1 = td_var_offset(cgroup_nodelete),
3498 .help = "Do not delete cgroups after job completion",
3499 .def = "0",
3500 .parent = "cgroup",
3501 .category = FIO_OPT_C_GENERAL,
3502 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003503 },
3504 {
3505 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003506 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003507 .type = FIO_OPT_INT,
3508 .off1 = td_var_offset(cgroup_weight),
3509 .help = "Use given weight for cgroup",
3510 .minval = 100,
3511 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003512 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003513 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003514 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003515 },
3516 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003517 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003518 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003519 .type = FIO_OPT_INT,
3520 .off1 = td_var_offset(uid),
3521 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003522 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003523 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003524 },
3525 {
3526 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003527 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003528 .type = FIO_OPT_INT,
3529 .off1 = td_var_offset(gid),
3530 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003531 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003532 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003533 },
3534 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003535 .name = "kb_base",
3536 .lname = "KB Base",
3537 .type = FIO_OPT_INT,
3538 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003539 .prio = 1,
3540 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003541 .posval = {
3542 { .ival = "1024",
3543 .oval = 1024,
3544 .help = "Use 1024 as the K base",
3545 },
3546 { .ival = "1000",
3547 .oval = 1000,
3548 .help = "Use 1000 as the K base",
3549 },
3550 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003551 .help = "How many bytes per KB for reporting (1000 or 1024)",
3552 .category = FIO_OPT_C_GENERAL,
3553 .group = FIO_OPT_G_INVALID,
3554 },
3555 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003556 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003557 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003558 .type = FIO_OPT_INT,
3559 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003560 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003561 .posval = {
3562 { .ival = "0",
3563 .oval = 0,
3564 .help = "Auto-detect",
3565 },
3566 { .ival = "8",
3567 .oval = 8,
3568 .help = "Normal (byte based)",
3569 },
3570 { .ival = "1",
3571 .oval = 1,
3572 .help = "Bit based",
3573 },
3574 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003575 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3576 .category = FIO_OPT_C_GENERAL,
3577 .group = FIO_OPT_G_INVALID,
3578 },
3579 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003580 .name = "hugepage-size",
3581 .lname = "Hugepage size",
3582 .type = FIO_OPT_INT,
3583 .off1 = td_var_offset(hugepage_size),
3584 .help = "When using hugepages, specify size of each page",
3585 .def = __fio_stringify(FIO_HUGE_PAGE),
3586 .interval = 1024 * 1024,
3587 .category = FIO_OPT_C_GENERAL,
3588 .group = FIO_OPT_G_INVALID,
3589 },
3590 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003591 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003592 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003593 .type = FIO_OPT_INT,
3594 .off1 = td_var_offset(flow_id),
3595 .help = "The flow index ID to use",
3596 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003597 .category = FIO_OPT_C_IO,
3598 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003599 },
3600 {
3601 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003602 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003603 .type = FIO_OPT_INT,
3604 .off1 = td_var_offset(flow),
3605 .help = "Weight for flow control of this job",
3606 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003607 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003608 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003609 .category = FIO_OPT_C_IO,
3610 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003611 },
3612 {
3613 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003614 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003615 .type = FIO_OPT_INT,
3616 .off1 = td_var_offset(flow_watermark),
3617 .help = "High watermark for flow control. This option"
3618 " should be set to the same value for all threads"
3619 " with non-zero flow.",
3620 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003621 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003622 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003623 .category = FIO_OPT_C_IO,
3624 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003625 },
3626 {
3627 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003628 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003629 .type = FIO_OPT_INT,
3630 .off1 = td_var_offset(flow_sleep),
3631 .help = "How many microseconds to sleep after being held"
3632 " back by the flow control mechanism",
3633 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003634 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003635 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003636 .category = FIO_OPT_C_IO,
3637 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003638 },
3639 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003640 .name = NULL,
3641 },
3642};
3643
Jens Axboe17af15d2010-04-13 10:38:16 +02003644static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003645 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003646{
Jens Axboe17af15d2010-04-13 10:38:16 +02003647 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003648 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003649 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003650 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003651 else
3652 lopt->has_arg = required_argument;
3653}
3654
Steven Langde890a12011-11-09 14:03:34 +01003655static void options_to_lopts(struct fio_option *opts,
3656 struct option *long_options,
3657 int i, int option_type)
3658{
3659 struct fio_option *o = &opts[0];
3660 while (o->name) {
3661 add_to_lopt(&long_options[i], o, o->name, option_type);
3662 if (o->alias) {
3663 i++;
3664 add_to_lopt(&long_options[i], o, o->alias, option_type);
3665 }
3666
3667 i++;
3668 o++;
3669 assert(i < FIO_NR_OPTIONS);
3670 }
3671}
3672
3673void fio_options_set_ioengine_opts(struct option *long_options,
3674 struct thread_data *td)
3675{
3676 unsigned int i;
3677
3678 i = 0;
3679 while (long_options[i].name) {
3680 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3681 memset(&long_options[i], 0, sizeof(*long_options));
3682 break;
3683 }
3684 i++;
3685 }
3686
3687 /*
3688 * Just clear out the prior ioengine options.
3689 */
3690 if (!td || !td->eo)
3691 return;
3692
3693 options_to_lopts(td->io_ops->options, long_options, i,
3694 FIO_GETOPT_IOENGINE);
3695}
3696
Jens Axboe214e1ec2007-03-15 10:48:13 +01003697void fio_options_dup_and_init(struct option *long_options)
3698{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003699 unsigned int i;
3700
Jens Axboe9af4a242012-03-16 10:13:49 +01003701 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003702
3703 i = 0;
3704 while (long_options[i].name)
3705 i++;
3706
Jens Axboe9af4a242012-03-16 10:13:49 +01003707 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003708}
3709
Jens Axboe74929ac2009-08-05 11:42:37 +02003710struct fio_keyword {
3711 const char *word;
3712 const char *desc;
3713 char *replace;
3714};
3715
3716static struct fio_keyword fio_keywords[] = {
3717 {
3718 .word = "$pagesize",
3719 .desc = "Page size in the system",
3720 },
3721 {
3722 .word = "$mb_memory",
3723 .desc = "Megabytes of memory online",
3724 },
3725 {
3726 .word = "$ncpus",
3727 .desc = "Number of CPUs online in the system",
3728 },
3729 {
3730 .word = NULL,
3731 },
3732};
3733
3734void fio_keywords_init(void)
3735{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003736 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003737 char buf[128];
3738 long l;
3739
Jens Axboea4cfc472012-10-09 10:30:48 -06003740 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003741 fio_keywords[0].replace = strdup(buf);
3742
Jens Axboe8eb016d2011-07-11 10:24:20 +02003743 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003744 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003745 fio_keywords[1].replace = strdup(buf);
3746
Jens Axboec00a2282011-07-08 20:56:06 +02003747 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003748 sprintf(buf, "%lu", l);
3749 fio_keywords[2].replace = strdup(buf);
3750}
3751
Jens Axboe892a6ff2009-11-13 12:19:49 +01003752#define BC_APP "bc"
3753
3754static char *bc_calc(char *str)
3755{
Steven Langd0c814e2011-10-28 08:37:13 +02003756 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003757 FILE *f;
3758 int ret;
3759
3760 /*
3761 * No math, just return string
3762 */
Steven Langd0c814e2011-10-28 08:37:13 +02003763 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3764 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003765 return str;
3766
3767 /*
3768 * Split option from value, we only need to calculate the value
3769 */
3770 tmp = strchr(str, '=');
3771 if (!tmp)
3772 return str;
3773
3774 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003775
Steven Langd0c814e2011-10-28 08:37:13 +02003776 /*
3777 * Prevent buffer overflows; such a case isn't reasonable anyway
3778 */
3779 if (strlen(str) >= 128 || strlen(tmp) > 100)
3780 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003781
3782 sprintf(buf, "which %s > /dev/null", BC_APP);
3783 if (system(buf)) {
3784 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003785 return NULL;
3786 }
3787
Steven Langd0c814e2011-10-28 08:37:13 +02003788 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003789 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003790 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003791 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003792
Steven Langd0c814e2011-10-28 08:37:13 +02003793 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003794 if (ret <= 0) {
3795 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003796 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003797 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003798
Jens Axboe892a6ff2009-11-13 12:19:49 +01003799 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003800 buf[(tmp - str) + ret - 1] = '\0';
3801 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003802 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003803 return strdup(buf);
3804}
3805
3806/*
3807 * Return a copy of the input string with substrings of the form ${VARNAME}
3808 * substituted with the value of the environment variable VARNAME. The
3809 * substitution always occurs, even if VARNAME is empty or the corresponding
3810 * environment variable undefined.
3811 */
3812static char *option_dup_subs(const char *opt)
3813{
3814 char out[OPT_LEN_MAX+1];
3815 char in[OPT_LEN_MAX+1];
3816 char *outptr = out;
3817 char *inptr = in;
3818 char *ch1, *ch2, *env;
3819 ssize_t nchr = OPT_LEN_MAX;
3820 size_t envlen;
3821
3822 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3823 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3824 return NULL;
3825 }
3826
3827 in[OPT_LEN_MAX] = '\0';
3828 strncpy(in, opt, OPT_LEN_MAX);
3829
3830 while (*inptr && nchr > 0) {
3831 if (inptr[0] == '$' && inptr[1] == '{') {
3832 ch2 = strchr(inptr, '}');
3833 if (ch2 && inptr+1 < ch2) {
3834 ch1 = inptr+2;
3835 inptr = ch2+1;
3836 *ch2 = '\0';
3837
3838 env = getenv(ch1);
3839 if (env) {
3840 envlen = strlen(env);
3841 if (envlen <= nchr) {
3842 memcpy(outptr, env, envlen);
3843 outptr += envlen;
3844 nchr -= envlen;
3845 }
3846 }
3847
3848 continue;
3849 }
3850 }
3851
3852 *outptr++ = *inptr++;
3853 --nchr;
3854 }
3855
3856 *outptr = '\0';
3857 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003858}
3859
Jens Axboe74929ac2009-08-05 11:42:37 +02003860/*
3861 * Look for reserved variable names and replace them with real values
3862 */
3863static char *fio_keyword_replace(char *opt)
3864{
3865 char *s;
3866 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003867 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003868
3869 for (i = 0; fio_keywords[i].word != NULL; i++) {
3870 struct fio_keyword *kw = &fio_keywords[i];
3871
3872 while ((s = strstr(opt, kw->word)) != NULL) {
3873 char *new = malloc(strlen(opt) + 1);
3874 char *o_org = opt;
3875 int olen = s - opt;
3876 int len;
3877
3878 /*
3879 * Copy part of the string before the keyword and
3880 * sprintf() the replacement after it.
3881 */
3882 memcpy(new, opt, olen);
3883 len = sprintf(new + olen, "%s", kw->replace);
3884
3885 /*
3886 * If there's more in the original string, copy that
3887 * in too
3888 */
3889 opt += strlen(kw->word) + olen;
3890 if (strlen(opt))
3891 memcpy(new + olen + len, opt, opt - o_org - 1);
3892
3893 /*
3894 * replace opt and free the old opt
3895 */
3896 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003897 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003898
Steven Langd0c814e2011-10-28 08:37:13 +02003899 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003900 }
3901 }
3902
Steven Langd0c814e2011-10-28 08:37:13 +02003903 /*
3904 * Check for potential math and invoke bc, if possible
3905 */
3906 if (docalc)
3907 opt = bc_calc(opt);
3908
Jens Axboe7a958bd2009-11-13 12:33:54 +01003909 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003910}
3911
Steven Langd0c814e2011-10-28 08:37:13 +02003912static char **dup_and_sub_options(char **opts, int num_opts)
3913{
3914 int i;
3915 char **opts_copy = malloc(num_opts * sizeof(*opts));
3916 for (i = 0; i < num_opts; i++) {
3917 opts_copy[i] = option_dup_subs(opts[i]);
3918 if (!opts_copy[i])
3919 continue;
3920 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3921 }
3922 return opts_copy;
3923}
3924
Jens Axboe5b284222014-12-06 09:53:46 -07003925static void show_closest_option(const char *opt)
Jens Axboecf88f2a2014-12-06 09:17:52 -07003926{
3927 int best_option, best_distance;
3928 int i, distance;
Jens Axboe5b284222014-12-06 09:53:46 -07003929 char *name;
3930
3931 if (!strlen(opt))
3932 return;
3933
3934 name = strdup(opt);
3935 i = 0;
3936 while (name[i] != '\0' && name[i] != '=')
3937 i++;
3938 name[i] = '\0';
Jens Axboecf88f2a2014-12-06 09:17:52 -07003939
3940 best_option = -1;
3941 best_distance = INT_MAX;
3942 i = 0;
3943 while (fio_options[i].name) {
3944 distance = string_distance(name, fio_options[i].name);
3945 if (distance < best_distance) {
3946 best_distance = distance;
3947 best_option = i;
3948 }
3949 i++;
3950 }
3951
3952 if (best_option != -1)
3953 log_err("Did you mean %s?\n", fio_options[best_option].name);
Jens Axboe5b284222014-12-06 09:53:46 -07003954
3955 free(name);
Jens Axboecf88f2a2014-12-06 09:17:52 -07003956}
3957
Jens Axboe292cc472013-11-26 20:39:35 -07003958int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3959 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003960{
Steven Langde890a12011-11-09 14:03:34 +01003961 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003962 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003963
Jens Axboe9af4a242012-03-16 10:13:49 +01003964 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003965 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003966
Steven Langde890a12011-11-09 14:03:34 +01003967 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3968 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003969 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003970 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003971
Jens Axboe9c62acd2014-12-09 12:58:15 -07003972 if (!newret && o)
3973 fio_option_mark_set(&td->o, o);
3974
Steven Langde890a12011-11-09 14:03:34 +01003975 if (opts_copy[i]) {
3976 if (newret && !o) {
3977 unknown++;
3978 continue;
3979 }
Steven Langd0c814e2011-10-28 08:37:13 +02003980 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003981 opts_copy[i] = NULL;
3982 }
3983
3984 ret |= newret;
3985 }
3986
3987 if (unknown) {
3988 ret |= ioengine_load(td);
3989 if (td->eo) {
3990 sort_options(opts_copy, td->io_ops->options, num_opts);
3991 opts = opts_copy;
3992 }
3993 for (i = 0; i < num_opts; i++) {
3994 struct fio_option *o = NULL;
3995 int newret = 1;
Jens Axboecf88f2a2014-12-06 09:17:52 -07003996
Steven Langde890a12011-11-09 14:03:34 +01003997 if (!opts_copy[i])
3998 continue;
3999
4000 if (td->eo)
4001 newret = parse_option(opts_copy[i], opts[i],
4002 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07004003 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01004004
4005 ret |= newret;
Jens Axboecf88f2a2014-12-06 09:17:52 -07004006 if (!o) {
Steven Langde890a12011-11-09 14:03:34 +01004007 log_err("Bad option <%s>\n", opts[i]);
Jens Axboecf88f2a2014-12-06 09:17:52 -07004008 show_closest_option(opts[i]);
4009 }
Steven Langde890a12011-11-09 14:03:34 +01004010 free(opts_copy[i]);
4011 opts_copy[i] = NULL;
4012 }
Jens Axboe74929ac2009-08-05 11:42:37 +02004013 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02004014
Steven Langd0c814e2011-10-28 08:37:13 +02004015 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02004016 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004017}
4018
4019int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4020{
Jens Axboe9c62acd2014-12-09 12:58:15 -07004021 int ret;
4022
4023 ret = parse_cmd_option(opt, val, fio_options, td);
4024 if (!ret) {
4025 struct fio_option *o;
4026
4027 o = find_option(fio_options, opt);
4028 if (o)
4029 fio_option_mark_set(&td->o, o);
4030 }
4031
4032 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004033}
4034
Steven Langde890a12011-11-09 14:03:34 +01004035int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4036 char *val)
4037{
Akinobu Mita8a96c802013-10-09 09:32:34 -06004038 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01004039}
4040
Jens Axboe214e1ec2007-03-15 10:48:13 +01004041void fio_fill_default_options(struct thread_data *td)
4042{
Jens Axboecb1402d2014-02-25 11:35:27 -08004043 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01004044 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004045}
4046
4047int fio_show_option_help(const char *opt)
4048{
Jens Axboe9af4a242012-03-16 10:13:49 +01004049 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004050}
Jens Axboed23bb322007-03-23 15:57:56 +01004051
Steven Langde890a12011-11-09 14:03:34 +01004052void options_mem_dupe(void *data, struct fio_option *options)
4053{
4054 struct fio_option *o;
4055 char **ptr;
4056
4057 for (o = &options[0]; o->name; o++) {
4058 if (o->type != FIO_OPT_STR_STORE)
4059 continue;
4060
Jens Axboef0fdbca2014-02-11 15:44:50 -07004061 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01004062 if (*ptr)
4063 *ptr = strdup(*ptr);
4064 }
4065}
4066
Jens Axboe7e356b22011-10-14 10:55:16 +02004067/*
4068 * dupe FIO_OPT_STR_STORE options
4069 */
Steven Langde890a12011-11-09 14:03:34 +01004070void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01004071{
Jens Axboe9af4a242012-03-16 10:13:49 +01004072 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01004073
4074 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01004075 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01004076
Steven Langde890a12011-11-09 14:03:34 +01004077 td->eo = malloc(td->io_ops->option_struct_size);
4078 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4079 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01004080 }
4081}
4082
Jens Axboed6978a32009-07-18 21:04:09 +02004083unsigned int fio_get_kb_base(void *data)
4084{
Jens Axboe83ea4222012-03-28 14:01:46 +02004085 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02004086 unsigned int kb_base = 0;
4087
Jens Axboecb1402d2014-02-25 11:35:27 -08004088 /*
4089 * This is a hack... For private options, *data is not holding
4090 * a pointer to the thread_options, but to private data. This means
4091 * we can't safely dereference it, but magic is first so mem wise
4092 * it is valid. But this also means that if the job first sets
4093 * kb_base and expects that to be honored by private options,
4094 * it will be disappointed. We will return the global default
4095 * for this.
4096 */
4097 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004098 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004099 if (!kb_base)
4100 kb_base = 1024;
4101
4102 return kb_base;
4103}
Jens Axboe9f988e22010-03-04 10:42:38 +01004104
Jens Axboe07b32322010-03-05 09:48:44 +01004105int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004106{
Jens Axboe07b32322010-03-05 09:48:44 +01004107 struct fio_option *__o;
4108 int opt_index = 0;
4109
Jens Axboe9af4a242012-03-16 10:13:49 +01004110 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004111 while (__o->name) {
4112 opt_index++;
4113 __o++;
4114 }
4115
Jens Axboe7b504ed2014-02-11 14:19:38 -07004116 if (opt_index + 1 == FIO_MAX_OPTS) {
4117 log_err("fio: FIO_MAX_OPTS is too small\n");
4118 return 1;
4119 }
4120
Jens Axboe9af4a242012-03-16 10:13:49 +01004121 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004122 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004123 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004124}
Jens Axboee2de69d2010-03-04 14:05:48 +01004125
Jens Axboe07b32322010-03-05 09:48:44 +01004126void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004127{
Jens Axboe07b32322010-03-05 09:48:44 +01004128 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004129
Jens Axboe9af4a242012-03-16 10:13:49 +01004130 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004131 while (o->name) {
4132 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4133 o->type = FIO_OPT_INVALID;
4134 o->prof_name = NULL;
4135 }
4136 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004137 }
4138}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004139
4140void add_opt_posval(const char *optname, const char *ival, const char *help)
4141{
4142 struct fio_option *o;
4143 unsigned int i;
4144
Jens Axboe9af4a242012-03-16 10:13:49 +01004145 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004146 if (!o)
4147 return;
4148
4149 for (i = 0; i < PARSE_MAX_VP; i++) {
4150 if (o->posval[i].ival)
4151 continue;
4152
4153 o->posval[i].ival = ival;
4154 o->posval[i].help = help;
4155 break;
4156 }
4157}
4158
4159void del_opt_posval(const char *optname, const char *ival)
4160{
4161 struct fio_option *o;
4162 unsigned int i;
4163
Jens Axboe9af4a242012-03-16 10:13:49 +01004164 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004165 if (!o)
4166 return;
4167
4168 for (i = 0; i < PARSE_MAX_VP; i++) {
4169 if (!o->posval[i].ival)
4170 continue;
4171 if (strcmp(o->posval[i].ival, ival))
4172 continue;
4173
4174 o->posval[i].ival = NULL;
4175 o->posval[i].help = NULL;
4176 }
4177}
Jens Axboe7e356b22011-10-14 10:55:16 +02004178
4179void fio_options_free(struct thread_data *td)
4180{
Jens Axboe9af4a242012-03-16 10:13:49 +01004181 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004182 if (td->eo && td->io_ops && td->io_ops->options) {
4183 options_free(td->io_ops->options, td->eo);
4184 free(td->eo);
4185 td->eo = NULL;
4186 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004187}
Jens Axboec504ee52012-03-20 11:29:09 +01004188
4189struct fio_option *fio_option_find(const char *name)
4190{
4191 return find_option(fio_options, name);
4192}
4193
Jens Axboef6b79252014-12-22 20:03:50 -07004194static struct fio_option *find_next_opt(struct thread_options *o,
4195 struct fio_option *from,
4196 unsigned int off1)
Jens Axboe9c62acd2014-12-09 12:58:15 -07004197{
Jens Axboef6b79252014-12-22 20:03:50 -07004198 struct fio_option *opt;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004199
Jens Axboef6b79252014-12-22 20:03:50 -07004200 if (!from)
4201 from = &fio_options[0];
4202 else
4203 from++;
4204
4205 opt = NULL;
4206 do {
4207 if (off1 == from->off1) {
4208 opt = from;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004209 break;
4210 }
Jens Axboef6b79252014-12-22 20:03:50 -07004211 from++;
4212 } while (from->name);
Jens Axboe9c62acd2014-12-09 12:58:15 -07004213
Jens Axboef6b79252014-12-22 20:03:50 -07004214 return opt;
4215}
4216
4217static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4218{
4219 unsigned int opt_off, index, offset;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004220
4221 opt_off = opt - &fio_options[0];
4222 index = opt_off / (8 * sizeof(uint64_t));
4223 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4224 return (o->set_options[index] & (1UL << offset)) != 0;
4225}
4226
Jens Axboef6b79252014-12-22 20:03:50 -07004227int __fio_option_is_set(struct thread_options *o, unsigned int off1)
4228{
4229 struct fio_option *opt, *next;
4230
4231 next = NULL;
4232 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4233 if (opt_is_set(o, opt))
4234 return 1;
4235
4236 next = opt;
4237 }
4238
4239 return 0;
4240}
4241
Jens Axboe9c62acd2014-12-09 12:58:15 -07004242void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4243{
4244 unsigned int opt_off, index, offset;
4245
4246 opt_off = opt - &fio_options[0];
4247 index = opt_off / (8 * sizeof(uint64_t));
4248 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4249 o->set_options[index] |= 1UL << offset;
4250}