blob: ab6e399db5208d81689c0ec9752fa0a7e4adeda1 [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)
Jens Axboeb357a222015-01-04 10:02:34 -0700718 val = FIO_DEF_ZIPF;
Jens Axboe925fee32012-11-06 13:50:32 +0100719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
Jens Axboeb357a222015-01-04 10:02:34 -0700720 val = FIO_DEF_PARETO;
Jens Axboe925fee32012-11-06 13:50:32 +0100721 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
887static int str_opendir_cb(void *data, const char fio_unused *str)
888{
889 struct thread_data *td = data;
890
Jens Axboe52c0cea2013-09-06 10:07:37 -0600891 if (parse_dryrun())
892 return 0;
893
Jens Axboe214e1ec2007-03-15 10:48:13 +0100894 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100895 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100896
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100897 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100898}
899
Jens Axboece35b1e2014-01-14 15:35:58 -0700900static int pattern_cb(char *pattern, unsigned int max_size,
901 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200902{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100903 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700904 int i = 0, j = 0, len, k, base = 10;
905 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200906 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200907
Jens Axboe5de855d2014-08-22 14:02:02 -0500908 /*
909 * Check if it's a string input
910 */
911 loc1 = strchr(input, '\"');
912 if (loc1) {
913 do {
914 loc1++;
915 if (*loc1 == '\0' || *loc1 == '\"')
916 break;
917
918 pattern[i] = *loc1;
919 i++;
920 } while (i < max_size);
921
922 if (!i)
923 return 1;
924
925 goto fill;
926 }
927
928 /*
929 * No string, find out if it's decimal or hexidecimal
930 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100931 loc1 = strstr(input, "0x");
932 loc2 = strstr(input, "0X");
933 if (loc1 || loc2)
934 base = 16;
935 off = strtol(input, NULL, base);
936 if (off != LONG_MAX || errno != ERANGE) {
937 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700938 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100939 off >>= 8;
940 i++;
941 }
942 } else {
943 len = strlen(input);
944 k = len - 1;
945 if (base == 16) {
946 if (loc1)
947 j = loc1 - input + 2;
948 else
949 j = loc2 - input + 2;
950 } else
951 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700952 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100953 while (k >= j) {
954 off = converthexchartoint(input[k--]);
955 if (k >= j)
956 off += (converthexchartoint(input[k--])
957 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700958 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100959 }
960 }
961 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100962
963 /*
964 * Fill the pattern all the way to the end. This greatly reduces
965 * the number of memcpy's we have to do when verifying the IO.
966 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500967fill:
Jens Axboee078de42013-04-24 23:07:17 -0600968 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700969 while (i > 1 && i * 2 <= max_size) {
970 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100971 i *= 2;
972 }
Jens Axboee078de42013-04-24 23:07:17 -0600973
974 /*
975 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700976 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600977 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700978 while (i > 1 && i < max_size) {
979 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600980
Jens Axboece35b1e2014-01-14 15:35:58 -0700981 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600982 i += b;
983 }
984
Steven Lang9a2a86d2012-02-07 09:42:59 +0100985 if (i == 1) {
986 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -0500987 * The code in verify_io_u_pattern assumes a single byte
988 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +0100989 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700990 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +0100991 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100992
Jens Axboece35b1e2014-01-14 15:35:58 -0700993 *pattern_bytes = i;
994 return 0;
995}
996
997static int str_buffer_pattern_cb(void *data, const char *input)
998{
999 struct thread_data *td = data;
1000 int ret;
1001
1002 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1003 &td->o.buffer_pattern_bytes);
1004
Jens Axboedf91a1f2014-08-22 10:22:03 -05001005 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboe97f78c42014-12-04 08:27:21 -07001006 if (!td->o.compress_percentage)
1007 td->o.refill_buffers = 0;
Jens Axboece35b1e2014-01-14 15:35:58 -07001008 td->o.scramble_buffers = 0;
1009 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001010 } else {
1011 log_err("fio: failed parsing pattern `%s`\n", input);
1012 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001013 }
1014
1015 return ret;
1016}
1017
Jens Axboebedc9dc2014-03-17 12:51:09 -06001018static int str_buffer_compress_cb(void *data, unsigned long long *il)
1019{
1020 struct thread_data *td = data;
1021
1022 td->flags |= TD_F_COMPRESS;
1023 td->o.compress_percentage = *il;
1024 return 0;
1025}
1026
Jens Axboee66dac22014-09-22 10:02:07 -06001027static int str_dedupe_cb(void *data, unsigned long long *il)
1028{
1029 struct thread_data *td = data;
1030
1031 td->flags |= TD_F_COMPRESS;
1032 td->o.dedupe_percentage = *il;
1033 td->o.refill_buffers = 1;
1034 return 0;
1035}
1036
Jens Axboece35b1e2014-01-14 15:35:58 -07001037static int str_verify_pattern_cb(void *data, const char *input)
1038{
1039 struct thread_data *td = data;
1040 int ret;
1041
1042 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1043 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001044
Jens Axboe92bf48d2011-01-14 21:20:42 +01001045 /*
1046 * VERIFY_META could already be set
1047 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001048 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001049 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001050
Jens Axboece35b1e2014-01-14 15:35:58 -07001051 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001052}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001053
Jens Axboe993bf482008-11-14 13:04:53 +01001054static int str_gtod_reduce_cb(void *data, int *il)
1055{
1056 struct thread_data *td = data;
1057 int val = *il;
1058
Jens Axboe02af0982010-06-24 09:59:34 +02001059 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001060 td->o.disable_clat = !!val;
1061 td->o.disable_slat = !!val;
1062 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001063 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001064 if (val)
1065 td->tv_cache_mask = 63;
1066
1067 return 0;
1068}
1069
Jens Axboe7bb59102011-07-12 19:47:03 +02001070static int str_size_cb(void *data, unsigned long long *__val)
1071{
1072 struct thread_data *td = data;
1073 unsigned long long v = *__val;
1074
1075 if (parse_is_percent(v)) {
1076 td->o.size = 0;
1077 td->o.size_percent = -1ULL - v;
1078 } else
1079 td->o.size = v;
1080
1081 return 0;
1082}
1083
Jens Axboe896cac22009-07-01 10:38:35 +02001084static int rw_verify(struct fio_option *o, void *data)
1085{
1086 struct thread_data *td = data;
1087
1088 if (read_only && td_write(td)) {
1089 log_err("fio: job <%s> has write bit set, but fio is in"
1090 " read-only mode\n", td->o.name);
1091 return 1;
1092 }
1093
1094 return 0;
1095}
1096
Jens Axboe276ca4f2009-07-01 10:43:05 +02001097static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001098{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001099#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001100 struct thread_data *td = data;
1101
Jens Axboe29d43ff2009-07-01 10:42:18 +02001102 if (td->o.gtod_cpu) {
1103 log_err("fio: platform must support CPU affinity for"
1104 "gettimeofday() offloading\n");
1105 return 1;
1106 }
1107#endif
1108
1109 return 0;
1110}
1111
Jens Axboe214e1ec2007-03-15 10:48:13 +01001112/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001113 * Option grouping
1114 */
1115static struct opt_group fio_opt_groups[] = {
1116 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001117 .name = "General",
1118 .mask = FIO_OPT_C_GENERAL,
1119 },
1120 {
1121 .name = "I/O",
1122 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001123 },
1124 {
1125 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001126 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001127 },
1128 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001129 .name = "Statistics",
1130 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001131 },
1132 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001133 .name = "Logging",
1134 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001135 },
1136 {
Jens Axboe13fca822012-03-31 13:55:54 +02001137 .name = "Profiles",
1138 .mask = FIO_OPT_C_PROFILE,
1139 },
1140 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001141 .name = NULL,
1142 },
1143};
1144
Jens Axboee8b0e952012-03-19 14:37:08 +01001145static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1146 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001147{
1148 struct opt_group *og;
1149 int i;
1150
Jens Axboee8b0e952012-03-19 14:37:08 +01001151 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001152 return NULL;
1153
Jens Axboee8b0e952012-03-19 14:37:08 +01001154 for (i = 0; ogs[i].name; i++) {
1155 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001156
1157 if (*mask & og->mask) {
1158 *mask &= ~(og->mask);
1159 return og;
1160 }
1161 }
1162
1163 return NULL;
1164}
1165
Jens Axboee8b0e952012-03-19 14:37:08 +01001166struct opt_group *opt_group_from_mask(unsigned int *mask)
1167{
1168 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1169}
1170
1171static struct opt_group fio_opt_cat_groups[] = {
1172 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001173 .name = "Latency profiling",
1174 .mask = FIO_OPT_G_LATPROF,
1175 },
1176 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001177 .name = "Rate",
1178 .mask = FIO_OPT_G_RATE,
1179 },
1180 {
1181 .name = "Zone",
1182 .mask = FIO_OPT_G_ZONE,
1183 },
1184 {
1185 .name = "Read/write mix",
1186 .mask = FIO_OPT_G_RWMIX,
1187 },
1188 {
1189 .name = "Verify",
1190 .mask = FIO_OPT_G_VERIFY,
1191 },
1192 {
1193 .name = "Trim",
1194 .mask = FIO_OPT_G_TRIM,
1195 },
1196 {
1197 .name = "I/O Logging",
1198 .mask = FIO_OPT_G_IOLOG,
1199 },
1200 {
1201 .name = "I/O Depth",
1202 .mask = FIO_OPT_G_IO_DEPTH,
1203 },
1204 {
1205 .name = "I/O Flow",
1206 .mask = FIO_OPT_G_IO_FLOW,
1207 },
1208 {
Jens Axboe06260372012-03-19 15:16:08 +01001209 .name = "Description",
1210 .mask = FIO_OPT_G_DESC,
1211 },
1212 {
1213 .name = "Filename",
1214 .mask = FIO_OPT_G_FILENAME,
1215 },
1216 {
1217 .name = "General I/O",
1218 .mask = FIO_OPT_G_IO_BASIC,
1219 },
1220 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001221 .name = "Cgroups",
1222 .mask = FIO_OPT_G_CGROUP,
1223 },
1224 {
1225 .name = "Runtime",
1226 .mask = FIO_OPT_G_RUNTIME,
1227 },
1228 {
Jens Axboe10860052012-03-19 20:56:53 +01001229 .name = "Process",
1230 .mask = FIO_OPT_G_PROCESS,
1231 },
1232 {
1233 .name = "Job credentials / priority",
1234 .mask = FIO_OPT_G_CRED,
1235 },
1236 {
1237 .name = "Clock settings",
1238 .mask = FIO_OPT_G_CLOCK,
1239 },
1240 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001241 .name = "I/O Type",
1242 .mask = FIO_OPT_G_IO_TYPE,
1243 },
1244 {
1245 .name = "I/O Thinktime",
1246 .mask = FIO_OPT_G_THINKTIME,
1247 },
1248 {
1249 .name = "Randomizations",
1250 .mask = FIO_OPT_G_RANDOM,
1251 },
1252 {
1253 .name = "I/O buffers",
1254 .mask = FIO_OPT_G_IO_BUF,
1255 },
1256 {
Jens Axboe13fca822012-03-31 13:55:54 +02001257 .name = "Tiobench profile",
1258 .mask = FIO_OPT_G_TIOBENCH,
1259 },
1260
1261 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001262 .name = NULL,
1263 }
1264};
1265
1266struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1267{
1268 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1269}
1270
Jens Axboe9af4a242012-03-16 10:13:49 +01001271/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001272 * Map of job/command line options
1273 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001274struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001275 {
1276 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001277 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001278 .type = FIO_OPT_STR_STORE,
1279 .off1 = td_var_offset(description),
1280 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001281 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001282 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001283 },
1284 {
1285 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001286 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001287 .type = FIO_OPT_STR_STORE,
1288 .off1 = td_var_offset(name),
1289 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001290 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001291 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001292 },
1293 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001294 .name = "filename",
1295 .lname = "Filename(s)",
1296 .type = FIO_OPT_STR_STORE,
1297 .off1 = td_var_offset(filename),
1298 .cb = str_filename_cb,
1299 .prio = -1, /* must come after "directory" */
1300 .help = "File(s) to use for the workload",
1301 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001302 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001303 },
1304 {
1305 .name = "directory",
1306 .lname = "Directory",
1307 .type = FIO_OPT_STR_STORE,
1308 .off1 = td_var_offset(directory),
1309 .cb = str_directory_cb,
1310 .help = "Directory to store files in",
1311 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001312 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001313 },
1314 {
Jens Axboede98bd32013-04-05 11:09:20 +02001315 .name = "filename_format",
1316 .type = FIO_OPT_STR_STORE,
1317 .off1 = td_var_offset(filename_format),
1318 .prio = -1, /* must come after "directory" */
1319 .help = "Override default $jobname.$jobnum.$filenum naming",
1320 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001321 .category = FIO_OPT_C_FILE,
1322 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001323 },
1324 {
Jens Axboe29c13492008-03-01 19:25:20 +01001325 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001326 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001327 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001328 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001329 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001330 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001331 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001332 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001333 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01001334 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001335 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001336 .posval = {
1337 { .ival = "none",
1338 .oval = FILE_LOCK_NONE,
1339 .help = "No file locking",
1340 },
1341 { .ival = "exclusive",
1342 .oval = FILE_LOCK_EXCLUSIVE,
1343 .help = "Exclusive file lock",
1344 },
1345 {
1346 .ival = "readwrite",
1347 .oval = FILE_LOCK_READWRITE,
1348 .help = "Read vs write lock",
1349 },
1350 },
Jens Axboe29c13492008-03-01 19:25:20 +01001351 },
1352 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001353 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001354 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001355 .type = FIO_OPT_STR_STORE,
1356 .off1 = td_var_offset(opendir),
1357 .cb = str_opendir_cb,
1358 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001359 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001360 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001361 },
1362 {
1363 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001364 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001365 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001366 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001367 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001368 .off1 = td_var_offset(td_ddir),
1369 .help = "IO direction",
1370 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001371 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001372 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001373 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001374 .posval = {
1375 { .ival = "read",
1376 .oval = TD_DDIR_READ,
1377 .help = "Sequential read",
1378 },
1379 { .ival = "write",
1380 .oval = TD_DDIR_WRITE,
1381 .help = "Sequential write",
1382 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001383 { .ival = "trim",
1384 .oval = TD_DDIR_TRIM,
1385 .help = "Sequential trim",
1386 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001387 { .ival = "randread",
1388 .oval = TD_DDIR_RANDREAD,
1389 .help = "Random read",
1390 },
1391 { .ival = "randwrite",
1392 .oval = TD_DDIR_RANDWRITE,
1393 .help = "Random write",
1394 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001395 { .ival = "randtrim",
1396 .oval = TD_DDIR_RANDTRIM,
1397 .help = "Random trim",
1398 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001399 { .ival = "rw",
1400 .oval = TD_DDIR_RW,
1401 .help = "Sequential read and write mix",
1402 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001403 { .ival = "readwrite",
1404 .oval = TD_DDIR_RW,
1405 .help = "Sequential read and write mix",
1406 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001407 { .ival = "randrw",
1408 .oval = TD_DDIR_RANDRW,
1409 .help = "Random read and write mix"
1410 },
1411 },
1412 },
1413 {
Jens Axboe38dad622010-07-20 14:46:00 -06001414 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001415 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001416 .type = FIO_OPT_STR,
1417 .off1 = td_var_offset(rw_seq),
1418 .help = "IO offset generator modifier",
1419 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001420 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001421 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001422 .posval = {
1423 { .ival = "sequential",
1424 .oval = RW_SEQ_SEQ,
1425 .help = "Generate sequential offsets",
1426 },
1427 { .ival = "identical",
1428 .oval = RW_SEQ_IDENT,
1429 .help = "Generate identical offsets",
1430 },
1431 },
1432 },
1433
1434 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001435 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001436 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001437 .type = FIO_OPT_STR_STORE,
1438 .off1 = td_var_offset(ioengine),
1439 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001440 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001441 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001442 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001443 .posval = {
1444 { .ival = "sync",
1445 .help = "Use read/write",
1446 },
gurudas paia31041e2007-10-23 15:12:30 +02001447 { .ival = "psync",
1448 .help = "Use pread/pwrite",
1449 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001450 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001451 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001452 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001453#ifdef CONFIG_PWRITEV
1454 { .ival = "pvsync",
1455 .help = "Use preadv/pwritev",
1456 },
1457#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001458#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001459 { .ival = "libaio",
1460 .help = "Linux native asynchronous IO",
1461 },
1462#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001463#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001464 { .ival = "posixaio",
1465 .help = "POSIX asynchronous IO",
1466 },
1467#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001468#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001469 { .ival = "solarisaio",
1470 .help = "Solaris native asynchronous IO",
1471 },
1472#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001473#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001474 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001475 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001476 },
Jens Axboe3be80072011-01-19 11:07:28 -07001477#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001478#ifdef CONFIG_RBD
1479 { .ival = "rbd",
1480 .help = "Rados Block Device asynchronous IO"
1481 },
1482#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001483 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001484 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001485 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001486#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001487 { .ival = "splice",
1488 .help = "splice/vmsplice based IO",
1489 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001490 { .ival = "netsplice",
1491 .help = "splice/vmsplice to/from the network",
1492 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001493#endif
1494#ifdef FIO_HAVE_SGIO
1495 { .ival = "sg",
1496 .help = "SCSI generic v3 IO",
1497 },
1498#endif
1499 { .ival = "null",
1500 .help = "Testing engine (no data transfer)",
1501 },
1502 { .ival = "net",
1503 .help = "Network IO",
1504 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001505 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001506 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001507 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001508#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001509 { .ival = "guasi",
1510 .help = "GUASI IO engine",
1511 },
1512#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001513#ifdef FIO_HAVE_BINJECT
1514 { .ival = "binject",
1515 .help = "binject direct inject block engine",
1516 },
1517#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001518#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001519 { .ival = "rdma",
1520 .help = "RDMA IO engine",
1521 },
1522#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001523#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001524 { .ival = "fusion-aw-sync",
1525 .help = "Fusion-io atomic write engine",
1526 },
1527#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001528#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001529 { .ival = "e4defrag",
1530 .help = "ext4 defrag engine",
1531 },
1532#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001533#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001534 { .ival = "falloc",
1535 .help = "fallocate() file based engine",
1536 },
1537#endif
chenh321fc5a2014-03-31 11:32:29 -04001538#ifdef CONFIG_GFAPI
1539 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001540 .help = "Glusterfs libgfapi(sync) based engine"
1541 },
1542 { .ival = "gfapi_async",
1543 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001544 },
1545#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001546#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001547 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001548 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1549 },
1550#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001551 { .ival = "external",
1552 .help = "Load external engine (append name)",
1553 },
1554 },
1555 },
1556 {
1557 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001558 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001559 .type = FIO_OPT_INT,
1560 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001561 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001562 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001563 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001564 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001565 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001566 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001567 },
1568 {
1569 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001570 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001571 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001572 .type = FIO_OPT_INT,
1573 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001574 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001575 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001576 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001577 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001578 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001579 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001580 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001581 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001582 },
1583 {
Jens Axboe49504212008-06-05 09:03:30 +02001584 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001585 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001586 .type = FIO_OPT_INT,
1587 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001588 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001589 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001590 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001591 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001592 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001593 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001594 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001595 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001596 },
1597 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001598 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001599 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001600 .type = FIO_OPT_INT,
1601 .off1 = td_var_offset(iodepth_low),
1602 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001603 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001604 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001605 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001606 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001607 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001608 },
1609 {
1610 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001611 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001612 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001613 .cb = str_size_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001614 .off1 = td_var_offset(size),
Jens Axboe214e1ec2007-03-15 10:48:13 +01001615 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001616 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001617 .category = FIO_OPT_C_IO,
1618 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001619 },
1620 {
Jens Axboeb65f3922014-12-10 19:21:37 -07001621 .name = "io_size",
1622 .alias = "io_limit",
1623 .lname = "IO Size",
Jens Axboe77731b22014-04-28 12:08:47 -06001624 .type = FIO_OPT_STR_VAL,
1625 .off1 = td_var_offset(io_limit),
1626 .interval = 1024 * 1024,
1627 .category = FIO_OPT_C_IO,
1628 .group = FIO_OPT_G_INVALID,
1629 },
1630 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001631 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001632 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001633 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001634 .type = FIO_OPT_BOOL,
1635 .off1 = td_var_offset(fill_device),
1636 .help = "Write until an ENOSPC error occurs",
1637 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001638 .category = FIO_OPT_C_FILE,
1639 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001640 },
1641 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001642 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001643 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001644 .type = FIO_OPT_STR_VAL,
1645 .off1 = td_var_offset(file_size_low),
1646 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001647 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001648 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001649 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001650 .category = FIO_OPT_C_FILE,
1651 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001652 },
1653 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001654 .name = "file_append",
1655 .lname = "File append",
1656 .type = FIO_OPT_BOOL,
1657 .off1 = td_var_offset(file_append),
1658 .help = "IO will start at the end of the file(s)",
1659 .def = "0",
1660 .category = FIO_OPT_C_FILE,
1661 .group = FIO_OPT_G_INVALID,
1662 },
1663 {
Jens Axboe67a10002007-07-31 23:12:16 +02001664 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001665 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001666 .alias = "fileoffset",
1667 .type = FIO_OPT_STR_VAL,
1668 .off1 = td_var_offset(start_offset),
1669 .help = "Start IO from this offset",
1670 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001671 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001674 },
1675 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001676 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001677 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001678 .type = FIO_OPT_STR_VAL,
1679 .off1 = td_var_offset(offset_increment),
1680 .help = "What is the increment from one offset to the next",
1681 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001682 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001683 .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 Axboe2d7cd862012-03-15 14:53:38 +01001687 },
1688 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001689 .name = "number_ios",
1690 .lname = "Number of IOs to perform",
1691 .type = FIO_OPT_STR_VAL,
1692 .off1 = td_var_offset(number_ios),
Jens Axboe0b24a952014-09-28 16:24:23 -06001693 .help = "Force job completion after this number of IOs",
Jens Axboeddf24e42013-08-09 12:53:44 -06001694 .def = "0",
1695 .category = FIO_OPT_C_IO,
1696 .group = FIO_OPT_G_INVALID,
1697 },
1698 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001699 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001700 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001701 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001702 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001703 .off1 = td_var_offset(bs[DDIR_READ]),
1704 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001705 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001706 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001707 .help = "Block size unit",
1708 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001709 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001710 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001711 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001712 .category = FIO_OPT_C_IO,
1713 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001714 },
1715 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001716 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001717 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001718 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001719 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001720 .off1 = td_var_offset(ba[DDIR_READ]),
1721 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001722 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001723 .minval = 1,
1724 .help = "IO block offset alignment",
1725 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001726 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001727 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001728 .category = FIO_OPT_C_IO,
1729 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001730 },
1731 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001732 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001733 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001734 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001735 .type = FIO_OPT_RANGE,
1736 .off1 = td_var_offset(min_bs[DDIR_READ]),
1737 .off2 = td_var_offset(max_bs[DDIR_READ]),
1738 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1739 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001740 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1741 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001742 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001743 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001744 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001745 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001746 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001747 .category = FIO_OPT_C_IO,
1748 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001749 },
1750 {
Jens Axboe564ca972007-12-14 12:21:19 +01001751 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001752 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001753 .type = FIO_OPT_STR,
1754 .cb = str_bssplit_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001755 .off1 = td_var_offset(bssplit),
Jens Axboe564ca972007-12-14 12:21:19 +01001756 .help = "Set a specific mix of block sizes",
1757 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001758 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001759 .category = FIO_OPT_C_IO,
1760 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001761 },
1762 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001763 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001764 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001765 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001766 .type = FIO_OPT_STR_SET,
1767 .off1 = td_var_offset(bs_unaligned),
1768 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001769 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001770 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001771 .category = FIO_OPT_C_IO,
1772 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001773 },
1774 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001775 .name = "bs_is_seq_rand",
1776 .lname = "Block size division is seq/random (not read/write)",
1777 .type = FIO_OPT_BOOL,
1778 .off1 = td_var_offset(bs_is_seq_rand),
Jens Axboe86051d42014-09-28 16:25:49 -06001779 .help = "Consider any blocksize setting to be sequential,random",
Jens Axboe6aca9b32013-07-25 12:45:26 -06001780 .def = "0",
1781 .parent = "blocksize",
1782 .category = FIO_OPT_C_IO,
1783 .group = FIO_OPT_G_INVALID,
1784 },
1785 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001786 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001787 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001788 .type = FIO_OPT_BOOL,
1789 .off1 = td_var_offset(rand_repeatable),
1790 .help = "Use repeatable random IO pattern",
1791 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001792 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001793 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001794 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001795 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001796 },
1797 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001798 .name = "randseed",
1799 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001800 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001801 .off1 = td_var_offset(rand_seed),
1802 .help = "Set the random generator seed value",
1803 .parent = "rw",
1804 .category = FIO_OPT_C_IO,
1805 .group = FIO_OPT_G_RANDOM,
1806 },
1807 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001808 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001809 .lname = "Use OS random",
Jens Axboe559073f2014-11-05 18:34:02 -07001810 .type = FIO_OPT_DEPRECATED,
1811 .off1 = td_var_offset(dep_use_os_rand),
Jens Axboee8b0e952012-03-19 14:37:08 +01001812 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001813 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001814 },
1815 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001816 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001817 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001818 .type = FIO_OPT_STR_SET,
1819 .off1 = td_var_offset(norandommap),
1820 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001821 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001822 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001823 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001824 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001825 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001826 },
1827 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001828 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001829 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001830 .type = FIO_OPT_BOOL,
1831 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001832 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001833 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001834 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001835 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001836 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001837 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001838 },
1839 {
Jens Axboe8055e412012-11-26 08:43:47 +01001840 .name = "random_generator",
1841 .type = FIO_OPT_STR,
1842 .off1 = td_var_offset(random_generator),
1843 .help = "Type of random number generator to use",
1844 .def = "tausworthe",
1845 .posval = {
1846 { .ival = "tausworthe",
1847 .oval = FIO_RAND_GEN_TAUSWORTHE,
1848 .help = "Strong Tausworthe generator",
1849 },
1850 { .ival = "lfsr",
1851 .oval = FIO_RAND_GEN_LFSR,
1852 .help = "Variable length LFSR",
1853 },
1854 },
Jens Axboe48107592012-12-04 09:43:11 +01001855 .category = FIO_OPT_C_IO,
1856 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001857 },
1858 {
Jens Axboee25839d2012-11-06 10:49:42 +01001859 .name = "random_distribution",
1860 .type = FIO_OPT_STR,
1861 .off1 = td_var_offset(random_distribution),
1862 .cb = str_random_distribution_cb,
1863 .help = "Random offset distribution generator",
1864 .def = "random",
1865 .posval = {
1866 { .ival = "random",
1867 .oval = FIO_RAND_DIST_RANDOM,
1868 .help = "Completely random",
1869 },
1870 { .ival = "zipf",
1871 .oval = FIO_RAND_DIST_ZIPF,
1872 .help = "Zipf distribution",
1873 },
Jens Axboe925fee32012-11-06 13:50:32 +01001874 { .ival = "pareto",
1875 .oval = FIO_RAND_DIST_PARETO,
1876 .help = "Pareto distribution",
1877 },
Jens Axboee25839d2012-11-06 10:49:42 +01001878 },
Jens Axboe48107592012-12-04 09:43:11 +01001879 .category = FIO_OPT_C_IO,
1880 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001881 },
1882 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001883 .name = "percentage_random",
1884 .lname = "Percentage Random",
1885 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001886 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1887 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1888 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001889 .maxval = 100,
1890 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001891 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001892 .interval = 5,
1893 .inverse = "percentage_sequential",
1894 .category = FIO_OPT_C_IO,
1895 .group = FIO_OPT_G_RANDOM,
1896 },
1897 {
1898 .name = "percentage_sequential",
1899 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001900 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001901 .category = FIO_OPT_C_IO,
1902 .group = FIO_OPT_G_RANDOM,
1903 },
1904 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001905 .name = "allrandrepeat",
1906 .type = FIO_OPT_BOOL,
1907 .off1 = td_var_offset(allrand_repeatable),
1908 .help = "Use repeatable random numbers for everything",
1909 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001910 .category = FIO_OPT_C_IO,
1911 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001912 },
1913 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001914 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001915 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001916 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001917 .type = FIO_OPT_INT,
1918 .off1 = td_var_offset(nr_files),
1919 .help = "Split job workload between this number of files",
1920 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001921 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001922 .category = FIO_OPT_C_FILE,
1923 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001924 },
1925 {
1926 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001927 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001928 .type = FIO_OPT_INT,
1929 .off1 = td_var_offset(open_files),
1930 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001931 .category = FIO_OPT_C_FILE,
1932 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001933 },
1934 {
1935 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001936 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001937 .type = FIO_OPT_STR,
1938 .cb = str_fst_cb,
1939 .off1 = td_var_offset(file_service_type),
1940 .help = "How to select which file to service next",
1941 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001942 .category = FIO_OPT_C_FILE,
1943 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001944 .posval = {
1945 { .ival = "random",
1946 .oval = FIO_FSERVICE_RANDOM,
1947 .help = "Choose a file at random",
1948 },
1949 { .ival = "roundrobin",
1950 .oval = FIO_FSERVICE_RR,
1951 .help = "Round robin select files",
1952 },
Jens Axboea086c252009-03-04 08:27:37 +01001953 { .ival = "sequential",
1954 .oval = FIO_FSERVICE_SEQ,
1955 .help = "Finish one file before moving to the next",
1956 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001957 },
Jens Axboe67a10002007-07-31 23:12:16 +02001958 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001959 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001960 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001961#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001962 {
1963 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001964 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001965 .type = FIO_OPT_STR,
1966 .off1 = td_var_offset(fallocate_mode),
1967 .help = "Whether pre-allocation is performed when laying out files",
1968 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001969 .category = FIO_OPT_C_FILE,
1970 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001971 .posval = {
1972 { .ival = "none",
1973 .oval = FIO_FALLOCATE_NONE,
1974 .help = "Do not pre-allocate space",
1975 },
1976 { .ival = "posix",
1977 .oval = FIO_FALLOCATE_POSIX,
1978 .help = "Use posix_fallocate()",
1979 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001980#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001981 { .ival = "keep",
1982 .oval = FIO_FALLOCATE_KEEP_SIZE,
1983 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1984 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001985#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001986 /* Compatibility with former boolean values */
1987 { .ival = "0",
1988 .oval = FIO_FALLOCATE_NONE,
1989 .help = "Alias for 'none'",
1990 },
1991 { .ival = "1",
1992 .oval = FIO_FALLOCATE_POSIX,
1993 .help = "Alias for 'posix'",
1994 },
1995 },
1996 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001997#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001998 {
1999 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002000 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002001 .type = FIO_OPT_BOOL,
2002 .off1 = td_var_offset(fadvise_hint),
2003 .help = "Use fadvise() to advise the kernel on IO pattern",
2004 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002005 .category = FIO_OPT_C_FILE,
2006 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002007 },
2008 {
2009 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002010 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002011 .type = FIO_OPT_INT,
2012 .off1 = td_var_offset(fsync_blocks),
2013 .help = "Issue fsync for writes every given number of blocks",
2014 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002015 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002016 .category = FIO_OPT_C_FILE,
2017 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002018 },
2019 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002020 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002021 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002022 .type = FIO_OPT_INT,
2023 .off1 = td_var_offset(fdatasync_blocks),
2024 .help = "Issue fdatasync for writes every given number of blocks",
2025 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002026 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002027 .category = FIO_OPT_C_FILE,
2028 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002029 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002030 {
2031 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002032 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002033 .type = FIO_OPT_INT,
2034 .off1 = td_var_offset(barrier_blocks),
2035 .help = "Make every Nth write a barrier write",
2036 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002037 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002038 .category = FIO_OPT_C_IO,
2039 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002040 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002041#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002042 {
2043 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002044 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002045 .posval = {
2046 { .ival = "wait_before",
2047 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2048 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002049 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002050 },
2051 { .ival = "write",
2052 .oval = SYNC_FILE_RANGE_WRITE,
2053 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002054 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002055 },
2056 {
2057 .ival = "wait_after",
2058 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2059 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002060 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002061 },
2062 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002063 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002064 .cb = str_sfr_cb,
2065 .off1 = td_var_offset(sync_file_range),
2066 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002067 .category = FIO_OPT_C_FILE,
2068 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002069 },
2070#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002071 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002072 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002073 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002074 .type = FIO_OPT_BOOL,
2075 .off1 = td_var_offset(odirect),
2076 .help = "Use O_DIRECT IO (negates buffered)",
2077 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002078 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002079 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002080 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002081 },
2082 {
Chris Masond01612f2013-11-15 15:52:58 -07002083 .name = "atomic",
2084 .lname = "Atomic I/O",
2085 .type = FIO_OPT_BOOL,
2086 .off1 = td_var_offset(oatomic),
2087 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2088 .def = "0",
2089 .category = FIO_OPT_C_IO,
2090 .group = FIO_OPT_G_IO_TYPE,
2091 },
2092 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002093 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002094 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002095 .type = FIO_OPT_BOOL,
2096 .off1 = td_var_offset(odirect),
2097 .neg = 1,
2098 .help = "Use buffered IO (negates direct)",
2099 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002100 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002101 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002102 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002103 },
2104 {
2105 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002106 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002107 .type = FIO_OPT_BOOL,
2108 .off1 = td_var_offset(overwrite),
2109 .help = "When writing, set whether to overwrite current data",
2110 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002111 .category = FIO_OPT_C_FILE,
2112 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002113 },
2114 {
2115 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002116 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002117 .type = FIO_OPT_INT,
2118 .off1 = td_var_offset(loops),
2119 .help = "Number of times to run the job",
2120 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002121 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002122 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002123 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002124 },
2125 {
2126 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002127 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002128 .type = FIO_OPT_INT,
2129 .off1 = td_var_offset(numjobs),
2130 .help = "Duplicate this job this many times",
2131 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002132 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002133 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002134 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002135 },
2136 {
2137 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002138 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002139 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002140 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002141 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002142 .help = "Only start job when this period has passed",
2143 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002144 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002145 .is_time = 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 = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002151 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002152 .alias = "timeout",
2153 .type = FIO_OPT_STR_VAL_TIME,
2154 .off1 = td_var_offset(timeout),
2155 .help = "Stop workload when this amount of time 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 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002163 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002164 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002165 .type = FIO_OPT_STR_SET,
2166 .off1 = td_var_offset(time_based),
2167 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002168 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002169 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002170 },
2171 {
Juan Casse62167762013-09-17 14:06:13 -07002172 .name = "verify_only",
2173 .lname = "Verify only",
2174 .type = FIO_OPT_STR_SET,
2175 .off1 = td_var_offset(verify_only),
2176 .help = "Verifies previously written data is still valid",
2177 .category = FIO_OPT_C_GENERAL,
2178 .group = FIO_OPT_G_RUNTIME,
2179 },
2180 {
Jens Axboe721938a2008-09-10 09:46:16 +02002181 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002182 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002183 .type = FIO_OPT_STR_VAL_TIME,
2184 .off1 = td_var_offset(ramp_time),
2185 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002186 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002187 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002188 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002189 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002190 },
2191 {
Jens Axboec223da82010-03-24 13:23:53 +01002192 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002193 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002194 .type = FIO_OPT_STR,
2195 .cb = fio_clock_source_cb,
2196 .off1 = td_var_offset(clocksource),
2197 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002198 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002199 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002200 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002201#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002202 { .ival = "gettimeofday",
2203 .oval = CS_GTOD,
2204 .help = "Use gettimeofday(2) for timing",
2205 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002206#endif
2207#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002208 { .ival = "clock_gettime",
2209 .oval = CS_CGETTIME,
2210 .help = "Use clock_gettime(2) for timing",
2211 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002212#endif
Jens Axboec223da82010-03-24 13:23:53 +01002213#ifdef ARCH_HAVE_CPU_CLOCK
2214 { .ival = "cpu",
2215 .oval = CS_CPUCLOCK,
2216 .help = "Use CPU private clock",
2217 },
2218#endif
2219 },
2220 },
2221 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002222 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002223 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002224 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002225 .type = FIO_OPT_STR,
2226 .cb = str_mem_cb,
2227 .off1 = td_var_offset(mem_type),
2228 .help = "Backing type for IO buffers",
2229 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002230 .category = FIO_OPT_C_IO,
2231 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002232 .posval = {
2233 { .ival = "malloc",
2234 .oval = MEM_MALLOC,
2235 .help = "Use malloc(3) for IO buffers",
2236 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002237#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002238 { .ival = "shm",
2239 .oval = MEM_SHM,
2240 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002241 },
2242#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002243 { .ival = "shmhuge",
2244 .oval = MEM_SHMHUGE,
2245 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002246 },
2247#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002248#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002249 { .ival = "mmap",
2250 .oval = MEM_MMAP,
2251 .help = "Use mmap(2) (file or anon) for IO buffers",
2252 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002253#ifdef FIO_HAVE_HUGETLB
2254 { .ival = "mmaphuge",
2255 .oval = MEM_MMAPHUGE,
2256 .help = "Like mmap, but use huge pages",
2257 },
2258#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002259 },
2260 },
2261 {
Jens Axboed529ee12009-07-01 10:33:03 +02002262 .name = "iomem_align",
2263 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002264 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002265 .type = FIO_OPT_INT,
2266 .off1 = td_var_offset(mem_align),
2267 .minval = 0,
2268 .help = "IO memory buffer offset alignment",
2269 .def = "0",
2270 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002271 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002272 .category = FIO_OPT_C_IO,
2273 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002274 },
2275 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002276 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002277 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002278 .type = FIO_OPT_STR,
2279 .off1 = td_var_offset(verify),
2280 .help = "Verify data written",
2281 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002282 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002283 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002284 .posval = {
2285 { .ival = "0",
2286 .oval = VERIFY_NONE,
2287 .help = "Don't do IO verification",
2288 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002289 { .ival = "md5",
2290 .oval = VERIFY_MD5,
2291 .help = "Use md5 checksums for verification",
2292 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002293 { .ival = "crc64",
2294 .oval = VERIFY_CRC64,
2295 .help = "Use crc64 checksums for verification",
2296 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002297 { .ival = "crc32",
2298 .oval = VERIFY_CRC32,
2299 .help = "Use crc32 checksums for verification",
2300 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002301 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002302 .oval = VERIFY_CRC32C,
2303 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002304 },
Jens Axboebac39e02008-06-11 20:46:19 +02002305 { .ival = "crc32c",
2306 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002307 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002308 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002309 { .ival = "crc16",
2310 .oval = VERIFY_CRC16,
2311 .help = "Use crc16 checksums for verification",
2312 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002313 { .ival = "crc7",
2314 .oval = VERIFY_CRC7,
2315 .help = "Use crc7 checksums for verification",
2316 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002317 { .ival = "sha1",
2318 .oval = VERIFY_SHA1,
2319 .help = "Use sha1 checksums for verification",
2320 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002321 { .ival = "sha256",
2322 .oval = VERIFY_SHA256,
2323 .help = "Use sha256 checksums for verification",
2324 },
2325 { .ival = "sha512",
2326 .oval = VERIFY_SHA512,
2327 .help = "Use sha512 checksums for verification",
2328 },
Jens Axboe844ea602014-02-20 13:21:45 -08002329 { .ival = "xxhash",
2330 .oval = VERIFY_XXHASH,
2331 .help = "Use xxhash checksums for verification",
2332 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002333 { .ival = "meta",
2334 .oval = VERIFY_META,
2335 .help = "Use io information",
2336 },
Jens Axboe36690c92007-03-26 10:23:34 +02002337 {
2338 .ival = "null",
2339 .oval = VERIFY_NULL,
2340 .help = "Pretend to verify",
2341 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002342 },
2343 },
2344 {
Jens Axboe005c5652007-08-02 22:21:36 +02002345 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002346 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002347 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002348 .off1 = td_var_offset(do_verify),
2349 .help = "Run verification stage after write",
2350 .def = "1",
2351 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002352 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002353 .category = FIO_OPT_C_IO,
2354 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002355 },
2356 {
Jens Axboe160b9662007-03-27 10:59:49 +02002357 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002358 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002359 .type = FIO_OPT_BOOL,
2360 .off1 = td_var_offset(verifysort),
2361 .help = "Sort written verify blocks for read back",
2362 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002363 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002364 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002365 .category = FIO_OPT_C_IO,
2366 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002367 },
2368 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002369 .name = "verifysort_nr",
2370 .type = FIO_OPT_INT,
2371 .off1 = td_var_offset(verifysort_nr),
2372 .help = "Pre-load and sort verify blocks for a read workload",
2373 .minval = 0,
2374 .maxval = 131072,
2375 .def = "1024",
2376 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002377 .category = FIO_OPT_C_IO,
2378 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002379 },
2380 {
Jens Axboea59e1702007-07-30 08:53:27 +02002381 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002382 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002383 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002384 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002385 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002386 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002387 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002388 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002389 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002392 },
2393 {
Jens Axboea59e1702007-07-30 08:53:27 +02002394 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002395 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002396 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002397 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002398 .off1 = td_var_offset(verify_offset),
2399 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002400 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002401 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002402 .category = FIO_OPT_C_IO,
2403 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002404 },
2405 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002406 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002407 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002408 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002409 .cb = str_verify_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002410 .off1 = td_var_offset(verify_pattern),
Shawn Lewise28218f2008-01-16 11:01:33 +01002411 .help = "Fill pattern for IO buffers",
2412 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002413 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002414 .category = FIO_OPT_C_IO,
2415 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002416 },
2417 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002418 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002419 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002420 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002421 .off1 = td_var_offset(verify_fatal),
2422 .def = "0",
2423 .help = "Exit on a single verify failure, don't continue",
2424 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002425 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002426 .category = FIO_OPT_C_IO,
2427 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002428 },
2429 {
Jens Axboeb463e932011-01-12 09:03:23 +01002430 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002431 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002432 .type = FIO_OPT_BOOL,
2433 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002434 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002435 .help = "Dump contents of good and bad blocks on failure",
2436 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002437 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002438 .category = FIO_OPT_C_IO,
2439 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002440 },
2441 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002442 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002443 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002444 .type = FIO_OPT_INT,
2445 .off1 = td_var_offset(verify_async),
2446 .def = "0",
2447 .help = "Number of async verifier threads to use",
2448 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002449 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002452 },
Jens Axboe9e144182010-06-15 14:25:36 +02002453 {
2454 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002455 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002456 .type = FIO_OPT_STR_VAL,
2457 .off1 = td_var_offset(verify_backlog),
2458 .help = "Verify after this number of blocks are written",
2459 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002460 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002463 },
2464 {
2465 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002466 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002467 .type = FIO_OPT_INT,
2468 .off1 = td_var_offset(verify_batch),
2469 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002470 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002471 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002474 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002475#ifdef FIO_HAVE_CPU_AFFINITY
2476 {
2477 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002478 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002479 .type = FIO_OPT_STR,
2480 .cb = str_verify_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002481 .off1 = td_var_offset(verify_cpumask),
Jens Axboee8462bd2009-07-06 12:59:04 +02002482 .help = "Set CPUs allowed for async verify threads",
2483 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002484 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002487 },
2488#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002489 {
2490 .name = "experimental_verify",
2491 .off1 = td_var_offset(experimental_verify),
2492 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002493 .help = "Enable experimental verification",
Jens Axboede54cfd2014-11-10 20:34:00 -07002494 .parent = "verify",
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_VERIFY,
2497 },
2498 {
2499 .name = "verify_state_load",
2500 .lname = "Load verify state",
2501 .off1 = td_var_offset(verify_state),
2502 .type = FIO_OPT_BOOL,
2503 .help = "Load verify termination state",
2504 .parent = "verify",
2505 .category = FIO_OPT_C_IO,
2506 .group = FIO_OPT_G_VERIFY,
2507 },
2508 {
2509 .name = "verify_state_save",
2510 .lname = "Save verify state",
2511 .off1 = td_var_offset(verify_state_save),
2512 .type = FIO_OPT_BOOL,
2513 .def = "1",
2514 .help = "Save verify state on termination",
2515 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002516 .category = FIO_OPT_C_IO,
2517 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002518 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002519#ifdef FIO_HAVE_TRIM
2520 {
2521 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002522 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002523 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002524 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002525 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002526 .maxval = 100,
2527 .help = "Number of verify blocks to discard/trim",
2528 .parent = "verify",
2529 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002530 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002531 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002532 .category = FIO_OPT_C_IO,
2533 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002534 },
2535 {
2536 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002537 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002538 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002539 .help = "Verify that trim/discarded blocks are returned as zeroes",
2540 .off1 = td_var_offset(trim_zero),
2541 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002542 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002543 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002544 .category = FIO_OPT_C_IO,
2545 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002546 },
2547 {
2548 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002549 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002550 .type = FIO_OPT_STR_VAL,
2551 .off1 = td_var_offset(trim_backlog),
2552 .help = "Trim after this number of blocks are written",
2553 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002554 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002555 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002556 .category = FIO_OPT_C_IO,
2557 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002558 },
2559 {
2560 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002561 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002562 .type = FIO_OPT_INT,
2563 .off1 = td_var_offset(trim_batch),
2564 .help = "Trim this number of IO blocks",
2565 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002566 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002567 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002568 .category = FIO_OPT_C_IO,
2569 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002570 },
2571#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002572 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002573 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002574 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002575 .type = FIO_OPT_STR_STORE,
2576 .off1 = td_var_offset(write_iolog_file),
2577 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002580 },
2581 {
2582 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002583 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002584 .type = FIO_OPT_STR_STORE,
2585 .off1 = td_var_offset(read_iolog_file),
2586 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002587 .category = FIO_OPT_C_IO,
2588 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002589 },
2590 {
David Nellans64bbb862010-08-24 22:13:30 +02002591 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002592 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002593 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002594 .off1 = td_var_offset(no_stall),
2595 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002596 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002597 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002598 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002601 },
2602 {
David Nellansd1c46c02010-08-31 21:20:47 +02002603 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002604 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002605 .type = FIO_OPT_STR_STORE,
2606 .off1 = td_var_offset(replay_redirect),
2607 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002608 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002609 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002612 },
2613 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002614 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002615 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002616 .type = FIO_OPT_STR_STORE,
2617 .off1 = td_var_offset(exec_prerun),
2618 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002619 .category = FIO_OPT_C_GENERAL,
2620 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002621 },
2622 {
2623 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002624 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002625 .type = FIO_OPT_STR_STORE,
2626 .off1 = td_var_offset(exec_postrun),
2627 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002628 .category = FIO_OPT_C_GENERAL,
2629 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002630 },
2631#ifdef FIO_HAVE_IOSCHED_SWITCH
2632 {
2633 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002634 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002635 .type = FIO_OPT_STR_STORE,
2636 .off1 = td_var_offset(ioscheduler),
2637 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002638 .category = FIO_OPT_C_FILE,
2639 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002640 },
2641#endif
2642 {
2643 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002644 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002645 .type = FIO_OPT_STR_VAL,
2646 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002647 .help = "Amount of data to read per zone",
2648 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002649 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002650 .category = FIO_OPT_C_IO,
2651 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002652 },
2653 {
2654 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002655 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002656 .type = FIO_OPT_STR_VAL,
2657 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002658 .help = "Give size of an IO zone",
2659 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002660 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002661 .category = FIO_OPT_C_IO,
2662 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002663 },
2664 {
2665 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002666 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002667 .type = FIO_OPT_STR_VAL,
2668 .off1 = td_var_offset(zone_skip),
2669 .help = "Space between IO zones",
2670 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002671 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002672 .category = FIO_OPT_C_IO,
2673 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002674 },
2675 {
2676 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002677 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002678 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002679 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002680 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002681 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002682 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002683 .category = FIO_OPT_C_GENERAL,
2684 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002685 },
2686 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002687 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002688 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002689 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002690 .cb = str_rwmix_read_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002691 .off1 = td_var_offset(rwmix[DDIR_READ]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002692 .maxval = 100,
2693 .help = "Percentage of mixed workload that is reads",
2694 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002695 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002696 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002699 },
2700 {
2701 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002702 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002703 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002704 .cb = str_rwmix_write_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002705 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002706 .maxval = 100,
2707 .help = "Percentage of mixed workload that is writes",
2708 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002709 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002710 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002711 .category = FIO_OPT_C_IO,
2712 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002713 },
2714 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002715 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002716 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002717 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002718 .category = FIO_OPT_C_IO,
2719 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002720 },
2721 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002722 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002723 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002724 .type = FIO_OPT_INT,
2725 .off1 = td_var_offset(nice),
2726 .help = "Set job CPU nice value",
2727 .minval = -19,
2728 .maxval = 20,
2729 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002730 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002731 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002732 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002733 },
2734#ifdef FIO_HAVE_IOPRIO
2735 {
2736 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002737 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002738 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002739 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002740 .help = "Set job IO priority value",
2741 .minval = 0,
2742 .maxval = 7,
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 {
2748 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002749 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002750 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002751 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002752 .help = "Set job IO priority class",
2753 .minval = 0,
2754 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002755 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002756 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002757 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002758 },
2759#endif
2760 {
2761 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002762 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002763 .type = FIO_OPT_INT,
2764 .off1 = td_var_offset(thinktime),
2765 .help = "Idle time between IO buffers (usec)",
2766 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002767 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002768 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002769 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002770 },
2771 {
2772 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002773 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002774 .type = FIO_OPT_INT,
2775 .off1 = td_var_offset(thinktime_spin),
2776 .help = "Start think time by spinning this amount (usec)",
2777 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002778 .is_time = 1,
Jens Axboeafdf9352007-07-31 16:14:34 +02002779 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002780 .hide = 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_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002786 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002787 .type = FIO_OPT_INT,
2788 .off1 = td_var_offset(thinktime_blocks),
2789 .help = "IO buffer period between 'thinktime'",
2790 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002791 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002792 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002793 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002794 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002795 },
2796 {
2797 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002798 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002799 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002800 .off1 = td_var_offset(rate[DDIR_READ]),
2801 .off2 = td_var_offset(rate[DDIR_WRITE]),
2802 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002803 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002804 .category = FIO_OPT_C_IO,
2805 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002806 },
2807 {
2808 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002809 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002810 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002811 .off1 = td_var_offset(ratemin[DDIR_READ]),
2812 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2813 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002814 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002815 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002816 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002817 .category = FIO_OPT_C_IO,
2818 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002819 },
2820 {
2821 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002822 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002823 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002824 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2825 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2826 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002827 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002828 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002829 .category = FIO_OPT_C_IO,
2830 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002831 },
2832 {
2833 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002834 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002835 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002836 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2837 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2838 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002839 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002840 .parent = "rate_iops",
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 Axboe214e1ec2007-03-15 10:48:13 +01002844 },
2845 {
2846 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002847 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002848 .type = FIO_OPT_INT,
2849 .off1 = td_var_offset(ratecycle),
2850 .help = "Window average for rate limits (msec)",
2851 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002852 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002853 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002854 .category = FIO_OPT_C_IO,
2855 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002856 },
2857 {
Jens Axboe15501532012-10-24 16:37:45 +02002858 .name = "max_latency",
2859 .type = FIO_OPT_INT,
2860 .off1 = td_var_offset(max_latency),
2861 .help = "Maximum tolerated IO latency (usec)",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002862 .is_time = 1,
Jens Axboe1e5324e2012-11-14 14:25:31 -07002863 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002864 .group = FIO_OPT_G_LATPROF,
2865 },
2866 {
2867 .name = "latency_target",
2868 .lname = "Latency Target (usec)",
2869 .type = FIO_OPT_STR_VAL_TIME,
2870 .off1 = td_var_offset(latency_target),
2871 .help = "Ramp to max queue depth supporting this latency",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002872 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002873 .category = FIO_OPT_C_IO,
2874 .group = FIO_OPT_G_LATPROF,
2875 },
2876 {
2877 .name = "latency_window",
2878 .lname = "Latency Window (usec)",
2879 .type = FIO_OPT_STR_VAL_TIME,
2880 .off1 = td_var_offset(latency_window),
2881 .help = "Time to sustain latency_target",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002882 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002883 .category = FIO_OPT_C_IO,
2884 .group = FIO_OPT_G_LATPROF,
2885 },
2886 {
2887 .name = "latency_percentile",
2888 .lname = "Latency Percentile",
2889 .type = FIO_OPT_FLOAT_LIST,
2890 .off1 = td_var_offset(latency_percentile),
2891 .help = "Percentile of IOs must be below latency_target",
2892 .def = "100",
2893 .maxlen = 1,
2894 .minfp = 0.0,
2895 .maxfp = 100.0,
2896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002898 },
2899 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002900 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002901 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002902 .type = FIO_OPT_BOOL,
2903 .off1 = td_var_offset(invalidate_cache),
2904 .help = "Invalidate buffer/page cache prior to running job",
2905 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002906 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002907 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002908 },
2909 {
2910 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002911 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002912 .type = FIO_OPT_BOOL,
2913 .off1 = td_var_offset(sync_io),
2914 .help = "Use O_SYNC for buffered writes",
2915 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002916 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002917 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002918 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002919 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002920 },
2921 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002922 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002923 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002924 .type = FIO_OPT_BOOL,
2925 .off1 = td_var_offset(create_serialize),
2926 .help = "Serialize creating of job files",
2927 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002928 .category = FIO_OPT_C_FILE,
2929 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002930 },
2931 {
2932 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002933 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002934 .type = FIO_OPT_BOOL,
2935 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002936 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002937 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002938 .category = FIO_OPT_C_FILE,
2939 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002940 },
2941 {
Jens Axboe814452b2009-03-04 12:53:13 +01002942 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002943 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002944 .type = FIO_OPT_BOOL,
2945 .off1 = td_var_offset(create_on_open),
2946 .help = "Create files when they are opened for IO",
2947 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002948 .category = FIO_OPT_C_FILE,
2949 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002950 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002951 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002952 .name = "create_only",
2953 .type = FIO_OPT_BOOL,
2954 .off1 = td_var_offset(create_only),
2955 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002956 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002957 .def = "0",
2958 },
2959 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002960 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002961 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002962 .type = FIO_OPT_BOOL,
2963 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002964 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002965 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .category = FIO_OPT_C_FILE,
2967 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002968 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002969#ifdef FIO_HAVE_CPU_AFFINITY
2970 {
2971 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002972 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002973 .type = FIO_OPT_INT,
2974 .cb = str_cpumask_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002975 .off1 = td_var_offset(cpumask),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002976 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002977 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002978 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002979 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002980 {
2981 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002982 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002983 .type = FIO_OPT_STR,
2984 .cb = str_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002985 .off1 = td_var_offset(cpumask),
Jens Axboed2e268b2007-06-15 10:33:49 +02002986 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002987 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002988 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002989 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002990 {
2991 .name = "cpus_allowed_policy",
2992 .lname = "CPUs allowed distribution policy",
2993 .type = FIO_OPT_STR,
2994 .off1 = td_var_offset(cpus_allowed_policy),
2995 .help = "Distribution policy for cpus_allowed",
2996 .parent = "cpus_allowed",
2997 .prio = 1,
2998 .posval = {
2999 { .ival = "shared",
3000 .oval = FIO_CPUS_SHARED,
3001 .help = "Mask shared between threads",
3002 },
3003 { .ival = "split",
3004 .oval = FIO_CPUS_SPLIT,
3005 .help = "Mask split between threads",
3006 },
3007 },
3008 .category = FIO_OPT_C_GENERAL,
3009 .group = FIO_OPT_G_CRED,
3010 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003011#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003012#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003013 {
3014 .name = "numa_cpu_nodes",
3015 .type = FIO_OPT_STR,
3016 .cb = str_numa_cpunodes_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003017 .off1 = td_var_offset(numa_cpunodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003018 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003019 .category = FIO_OPT_C_GENERAL,
3020 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003021 },
3022 {
3023 .name = "numa_mem_policy",
3024 .type = FIO_OPT_STR,
3025 .cb = str_numa_mpol_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003026 .off1 = td_var_offset(numa_memnodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003027 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003028 .category = FIO_OPT_C_GENERAL,
3029 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003030 },
3031#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003032 {
3033 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003034 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003035 .type = FIO_OPT_BOOL,
3036 .off1 = td_var_offset(end_fsync),
3037 .help = "Include fsync at the end of job",
3038 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003039 .category = FIO_OPT_C_FILE,
3040 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003041 },
3042 {
3043 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003044 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003045 .type = FIO_OPT_BOOL,
3046 .off1 = td_var_offset(fsync_on_close),
3047 .help = "fsync files on close",
3048 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003049 .category = FIO_OPT_C_FILE,
3050 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003051 },
3052 {
3053 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003054 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003055 .type = FIO_OPT_BOOL,
3056 .off1 = td_var_offset(unlink),
3057 .help = "Unlink created files after job has completed",
3058 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003059 .category = FIO_OPT_C_FILE,
3060 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003061 },
3062 {
3063 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003064 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003065 .type = FIO_OPT_STR_SET,
3066 .cb = str_exitall_cb,
3067 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003068 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003069 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003070 },
3071 {
3072 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003073 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003074 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003075 .type = FIO_OPT_STR_SET,
3076 .off1 = td_var_offset(stonewall),
3077 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003078 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003079 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003080 },
3081 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003082 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003083 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003084 .type = FIO_OPT_STR_SET,
3085 .off1 = td_var_offset(new_group),
3086 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003087 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003088 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003089 },
3090 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003091 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003092 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003093 .type = FIO_OPT_STR_SET,
3094 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003095 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003096#ifdef CONFIG_NO_SHM
3097 .def = "1",
3098 .no_warn_def = 1,
3099#endif
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 Axboe214e1ec2007-03-15 10:48:13 +01003102 },
3103 {
3104 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003105 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003106 .type = FIO_OPT_STR_STORE,
3107 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003108 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003109 .category = FIO_OPT_C_LOG,
3110 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003111 },
3112 {
3113 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003114 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003115 .type = FIO_OPT_STR_STORE,
3116 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003117 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003118 .category = FIO_OPT_C_LOG,
3119 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003120 },
3121 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003122 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003123 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003124 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003125 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003126 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003127 .category = FIO_OPT_C_LOG,
3128 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003129 },
3130 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003131 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003132 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003133 .type = FIO_OPT_INT,
3134 .off1 = td_var_offset(log_avg_msec),
3135 .help = "Average bw/iops/lat logs over this period of time",
3136 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003137 .category = FIO_OPT_C_LOG,
3138 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003139 },
3140 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003141 .name = "log_offset",
3142 .lname = "Log offset of IO",
3143 .type = FIO_OPT_BOOL,
3144 .off1 = td_var_offset(log_offset),
3145 .help = "Include offset of IO for each log entry",
3146 .def = "0",
3147 .category = FIO_OPT_C_LOG,
3148 .group = FIO_OPT_G_INVALID,
3149 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003150#ifdef CONFIG_ZLIB
3151 {
3152 .name = "log_compression",
3153 .lname = "Log compression",
3154 .type = FIO_OPT_INT,
3155 .off1 = td_var_offset(log_gz),
3156 .help = "Log in compressed chunks of this size",
3157 .minval = 32 * 1024 * 1024ULL,
3158 .maxval = 512 * 1024 * 1024ULL,
3159 .category = FIO_OPT_C_LOG,
3160 .group = FIO_OPT_G_INVALID,
3161 },
Jens Axboebac4af12014-07-03 13:42:28 -06003162 {
3163 .name = "log_store_compressed",
3164 .lname = "Log store compressed",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(log_gz_store),
3167 .help = "Store logs in a compressed format",
3168 .category = FIO_OPT_C_LOG,
3169 .group = FIO_OPT_G_INVALID,
3170 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003171#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003172 {
Jens Axboec504ee52012-03-20 11:29:09 +01003173 .name = "bwavgtime",
3174 .lname = "Bandwidth average time",
3175 .type = FIO_OPT_INT,
3176 .off1 = td_var_offset(bw_avg_time),
3177 .help = "Time window over which to calculate bandwidth"
3178 " (msec)",
3179 .def = "500",
3180 .parent = "write_bw_log",
3181 .hide = 1,
3182 .interval = 100,
3183 .category = FIO_OPT_C_LOG,
3184 .group = FIO_OPT_G_INVALID,
3185 },
3186 {
3187 .name = "iopsavgtime",
3188 .lname = "IOPS average time",
3189 .type = FIO_OPT_INT,
3190 .off1 = td_var_offset(iops_avg_time),
3191 .help = "Time window over which to calculate IOPS (msec)",
3192 .def = "500",
3193 .parent = "write_iops_log",
3194 .hide = 1,
3195 .interval = 100,
3196 .category = FIO_OPT_C_LOG,
3197 .group = FIO_OPT_G_INVALID,
3198 },
3199 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003200 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003201 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003202 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003203 .off1 = td_var_offset(group_reporting),
3204 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003205 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003206 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003207 },
3208 {
Jens Axboee9459e52007-04-17 15:46:32 +02003209 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003210 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003211 .type = FIO_OPT_STR_SET,
3212 .off1 = td_var_offset(zero_buffers),
3213 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003214 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003215 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003216 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003217 {
3218 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003219 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003220 .type = FIO_OPT_STR_SET,
3221 .off1 = td_var_offset(refill_buffers),
3222 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003223 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003224 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003225 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003226 {
Jens Axboefd684182011-09-19 09:24:44 +02003227 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003228 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003229 .type = FIO_OPT_BOOL,
3230 .off1 = td_var_offset(scramble_buffers),
3231 .help = "Slightly scramble buffers on every IO submit",
3232 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003233 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003234 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003235 },
3236 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003237 .name = "buffer_pattern",
3238 .lname = "Buffer pattern",
3239 .type = FIO_OPT_STR,
3240 .cb = str_buffer_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003241 .off1 = td_var_offset(buffer_pattern),
Jens Axboece35b1e2014-01-14 15:35:58 -07003242 .help = "Fill pattern for IO buffers",
3243 .category = FIO_OPT_C_IO,
3244 .group = FIO_OPT_G_IO_BUF,
3245 },
3246 {
Jens Axboe9c426842012-03-02 21:02:12 +01003247 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003248 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003249 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003250 .cb = str_buffer_compress_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003251 .off1 = td_var_offset(compress_percentage),
Jens Axboe9c426842012-03-02 21:02:12 +01003252 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003253 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003254 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003255 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003256 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003257 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003258 },
3259 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003260 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003261 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003262 .type = FIO_OPT_INT,
3263 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003264 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003265 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003266 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003267 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003268 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003269 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003270 },
3271 {
Jens Axboee66dac22014-09-22 10:02:07 -06003272 .name = "dedupe_percentage",
3273 .lname = "Dedupe percentage",
3274 .type = FIO_OPT_INT,
3275 .cb = str_dedupe_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003276 .off1 = td_var_offset(dedupe_percentage),
Jens Axboee66dac22014-09-22 10:02:07 -06003277 .maxval = 100,
3278 .minval = 0,
3279 .help = "Percentage of buffers that are dedupable",
3280 .interval = 1,
3281 .category = FIO_OPT_C_IO,
3282 .group = FIO_OPT_G_IO_BUF,
3283 },
3284 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003285 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003286 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003287 .type = FIO_OPT_BOOL,
3288 .off1 = td_var_offset(clat_percentiles),
3289 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003290 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003291 .category = FIO_OPT_C_STAT,
3292 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003293 },
3294 {
3295 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003296 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003297 .type = FIO_OPT_FLOAT_LIST,
3298 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003299 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003300 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003301 .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 +02003302 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3303 .minfp = 0.0,
3304 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003305 .category = FIO_OPT_C_STAT,
3306 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003307 },
3308
Jens Axboe0a839f32007-04-26 09:02:34 +02003309#ifdef FIO_HAVE_DISK_UTIL
3310 {
3311 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003312 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003313 .type = FIO_OPT_BOOL,
3314 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003315 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003316 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003317 .category = FIO_OPT_C_STAT,
3318 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003319 },
3320#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003321 {
Jens Axboe993bf482008-11-14 13:04:53 +01003322 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003323 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003324 .type = FIO_OPT_BOOL,
3325 .help = "Greatly reduce number of gettimeofday() calls",
3326 .cb = str_gtod_reduce_cb,
3327 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003328 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003329 .category = FIO_OPT_C_STAT,
3330 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003331 },
3332 {
Jens Axboe02af0982010-06-24 09:59:34 +02003333 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003334 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003335 .type = FIO_OPT_BOOL,
3336 .off1 = td_var_offset(disable_lat),
3337 .help = "Disable latency numbers",
3338 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003339 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003340 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003341 .category = FIO_OPT_C_STAT,
3342 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003343 },
3344 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003345 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003346 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003347 .type = FIO_OPT_BOOL,
3348 .off1 = td_var_offset(disable_clat),
3349 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003350 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003351 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003352 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003353 .category = FIO_OPT_C_STAT,
3354 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003355 },
3356 {
3357 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003358 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003359 .type = FIO_OPT_BOOL,
3360 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003361 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003362 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003363 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003364 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003365 .category = FIO_OPT_C_STAT,
3366 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003367 },
3368 {
3369 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003370 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003371 .type = FIO_OPT_BOOL,
3372 .off1 = td_var_offset(disable_bw),
3373 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003374 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003375 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003376 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003377 .category = FIO_OPT_C_STAT,
3378 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003379 },
3380 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003381 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003382 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003383 .type = FIO_OPT_INT,
Jens Axboe80ac0202014-12-16 20:38:53 -07003384 .off1 = td_var_offset(gtod_cpu),
Bruce Cran03e20d62011-01-02 20:14:54 +01003385 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003386 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003387 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003388 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003389 },
3390 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003391 .name = "unified_rw_reporting",
3392 .type = FIO_OPT_BOOL,
3393 .off1 = td_var_offset(unified_rw_rep),
3394 .help = "Unify reporting across data direction",
3395 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003396 .category = FIO_OPT_C_GENERAL,
3397 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003398 },
3399 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003400 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003401 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003402 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003403 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003404 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003405 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003406 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003407 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003408 .posval = {
3409 { .ival = "none",
3410 .oval = ERROR_TYPE_NONE,
3411 .help = "Exit when an error is encountered",
3412 },
3413 { .ival = "read",
3414 .oval = ERROR_TYPE_READ,
3415 .help = "Continue on read errors only",
3416 },
3417 { .ival = "write",
3418 .oval = ERROR_TYPE_WRITE,
3419 .help = "Continue on write errors only",
3420 },
3421 { .ival = "io",
3422 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3423 .help = "Continue on any IO errors",
3424 },
3425 { .ival = "verify",
3426 .oval = ERROR_TYPE_VERIFY,
3427 .help = "Continue on verify errors only",
3428 },
3429 { .ival = "all",
3430 .oval = ERROR_TYPE_ANY,
3431 .help = "Continue on all io and verify errors",
3432 },
3433 { .ival = "0",
3434 .oval = ERROR_TYPE_NONE,
3435 .help = "Alias for 'none'",
3436 },
3437 { .ival = "1",
3438 .oval = ERROR_TYPE_ANY,
3439 .help = "Alias for 'all'",
3440 },
3441 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003442 },
3443 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003444 .name = "ignore_error",
3445 .type = FIO_OPT_STR,
3446 .cb = str_ignore_error_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003447 .off1 = td_var_offset(ignore_error_nr),
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003448 .help = "Set a specific list of errors to ignore",
3449 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003450 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003451 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003452 },
3453 {
3454 .name = "error_dump",
3455 .type = FIO_OPT_BOOL,
3456 .off1 = td_var_offset(error_dump),
3457 .def = "0",
3458 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003459 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003460 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003461 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003462 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003463 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003464 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003465 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003466 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003467 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003468 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003469 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003470 },
3471 {
Jens Axboea696fa22009-12-04 10:05:02 +01003472 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003473 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003474 .type = FIO_OPT_STR_STORE,
3475 .off1 = td_var_offset(cgroup),
3476 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003477 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003478 .group = FIO_OPT_G_CGROUP,
3479 },
3480 {
3481 .name = "cgroup_nodelete",
3482 .lname = "Cgroup no-delete",
3483 .type = FIO_OPT_BOOL,
3484 .off1 = td_var_offset(cgroup_nodelete),
3485 .help = "Do not delete cgroups after job completion",
3486 .def = "0",
3487 .parent = "cgroup",
3488 .category = FIO_OPT_C_GENERAL,
3489 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003490 },
3491 {
3492 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003493 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003494 .type = FIO_OPT_INT,
3495 .off1 = td_var_offset(cgroup_weight),
3496 .help = "Use given weight for cgroup",
3497 .minval = 100,
3498 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003499 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003500 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003501 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003502 },
3503 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003504 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003505 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003506 .type = FIO_OPT_INT,
3507 .off1 = td_var_offset(uid),
3508 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003509 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003510 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003511 },
3512 {
3513 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003514 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003515 .type = FIO_OPT_INT,
3516 .off1 = td_var_offset(gid),
3517 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003518 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003519 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003520 },
3521 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003522 .name = "kb_base",
3523 .lname = "KB Base",
3524 .type = FIO_OPT_INT,
3525 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003526 .prio = 1,
3527 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003528 .posval = {
3529 { .ival = "1024",
3530 .oval = 1024,
3531 .help = "Use 1024 as the K base",
3532 },
3533 { .ival = "1000",
3534 .oval = 1000,
3535 .help = "Use 1000 as the K base",
3536 },
3537 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003538 .help = "How many bytes per KB for reporting (1000 or 1024)",
3539 .category = FIO_OPT_C_GENERAL,
3540 .group = FIO_OPT_G_INVALID,
3541 },
3542 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003543 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003544 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003545 .type = FIO_OPT_INT,
3546 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003547 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003548 .posval = {
3549 { .ival = "0",
3550 .oval = 0,
3551 .help = "Auto-detect",
3552 },
3553 { .ival = "8",
3554 .oval = 8,
3555 .help = "Normal (byte based)",
3556 },
3557 { .ival = "1",
3558 .oval = 1,
3559 .help = "Bit based",
3560 },
3561 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003562 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3563 .category = FIO_OPT_C_GENERAL,
3564 .group = FIO_OPT_G_INVALID,
3565 },
3566 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003567 .name = "hugepage-size",
3568 .lname = "Hugepage size",
3569 .type = FIO_OPT_INT,
3570 .off1 = td_var_offset(hugepage_size),
3571 .help = "When using hugepages, specify size of each page",
3572 .def = __fio_stringify(FIO_HUGE_PAGE),
3573 .interval = 1024 * 1024,
3574 .category = FIO_OPT_C_GENERAL,
3575 .group = FIO_OPT_G_INVALID,
3576 },
3577 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003578 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003579 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003580 .type = FIO_OPT_INT,
3581 .off1 = td_var_offset(flow_id),
3582 .help = "The flow index ID to use",
3583 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003584 .category = FIO_OPT_C_IO,
3585 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003586 },
3587 {
3588 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003589 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003590 .type = FIO_OPT_INT,
3591 .off1 = td_var_offset(flow),
3592 .help = "Weight for flow control of this job",
3593 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003594 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003595 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003596 .category = FIO_OPT_C_IO,
3597 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003598 },
3599 {
3600 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003601 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003602 .type = FIO_OPT_INT,
3603 .off1 = td_var_offset(flow_watermark),
3604 .help = "High watermark for flow control. This option"
3605 " should be set to the same value for all threads"
3606 " with non-zero flow.",
3607 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003608 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003609 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003610 .category = FIO_OPT_C_IO,
3611 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003612 },
3613 {
3614 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003615 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003616 .type = FIO_OPT_INT,
3617 .off1 = td_var_offset(flow_sleep),
3618 .help = "How many microseconds to sleep after being held"
3619 " back by the flow control mechanism",
3620 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003621 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003622 .def = "0",
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 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003627 .name = NULL,
3628 },
3629};
3630
Jens Axboe17af15d2010-04-13 10:38:16 +02003631static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003632 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003633{
Jens Axboe17af15d2010-04-13 10:38:16 +02003634 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003635 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003636 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003637 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003638 else
3639 lopt->has_arg = required_argument;
3640}
3641
Steven Langde890a12011-11-09 14:03:34 +01003642static void options_to_lopts(struct fio_option *opts,
3643 struct option *long_options,
3644 int i, int option_type)
3645{
3646 struct fio_option *o = &opts[0];
3647 while (o->name) {
3648 add_to_lopt(&long_options[i], o, o->name, option_type);
3649 if (o->alias) {
3650 i++;
3651 add_to_lopt(&long_options[i], o, o->alias, option_type);
3652 }
3653
3654 i++;
3655 o++;
3656 assert(i < FIO_NR_OPTIONS);
3657 }
3658}
3659
3660void fio_options_set_ioengine_opts(struct option *long_options,
3661 struct thread_data *td)
3662{
3663 unsigned int i;
3664
3665 i = 0;
3666 while (long_options[i].name) {
3667 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3668 memset(&long_options[i], 0, sizeof(*long_options));
3669 break;
3670 }
3671 i++;
3672 }
3673
3674 /*
3675 * Just clear out the prior ioengine options.
3676 */
3677 if (!td || !td->eo)
3678 return;
3679
3680 options_to_lopts(td->io_ops->options, long_options, i,
3681 FIO_GETOPT_IOENGINE);
3682}
3683
Jens Axboe214e1ec2007-03-15 10:48:13 +01003684void fio_options_dup_and_init(struct option *long_options)
3685{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003686 unsigned int i;
3687
Jens Axboe9af4a242012-03-16 10:13:49 +01003688 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003689
3690 i = 0;
3691 while (long_options[i].name)
3692 i++;
3693
Jens Axboe9af4a242012-03-16 10:13:49 +01003694 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003695}
3696
Jens Axboe74929ac2009-08-05 11:42:37 +02003697struct fio_keyword {
3698 const char *word;
3699 const char *desc;
3700 char *replace;
3701};
3702
3703static struct fio_keyword fio_keywords[] = {
3704 {
3705 .word = "$pagesize",
3706 .desc = "Page size in the system",
3707 },
3708 {
3709 .word = "$mb_memory",
3710 .desc = "Megabytes of memory online",
3711 },
3712 {
3713 .word = "$ncpus",
3714 .desc = "Number of CPUs online in the system",
3715 },
3716 {
3717 .word = NULL,
3718 },
3719};
3720
3721void fio_keywords_init(void)
3722{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003723 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003724 char buf[128];
3725 long l;
3726
Jens Axboea4cfc472012-10-09 10:30:48 -06003727 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003728 fio_keywords[0].replace = strdup(buf);
3729
Jens Axboe8eb016d2011-07-11 10:24:20 +02003730 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003731 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003732 fio_keywords[1].replace = strdup(buf);
3733
Jens Axboec00a2282011-07-08 20:56:06 +02003734 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003735 sprintf(buf, "%lu", l);
3736 fio_keywords[2].replace = strdup(buf);
3737}
3738
Jens Axboe892a6ff2009-11-13 12:19:49 +01003739#define BC_APP "bc"
3740
3741static char *bc_calc(char *str)
3742{
Steven Langd0c814e2011-10-28 08:37:13 +02003743 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003744 FILE *f;
3745 int ret;
3746
3747 /*
3748 * No math, just return string
3749 */
Steven Langd0c814e2011-10-28 08:37:13 +02003750 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3751 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003752 return str;
3753
3754 /*
3755 * Split option from value, we only need to calculate the value
3756 */
3757 tmp = strchr(str, '=');
3758 if (!tmp)
3759 return str;
3760
3761 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003762
Steven Langd0c814e2011-10-28 08:37:13 +02003763 /*
3764 * Prevent buffer overflows; such a case isn't reasonable anyway
3765 */
3766 if (strlen(str) >= 128 || strlen(tmp) > 100)
3767 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003768
3769 sprintf(buf, "which %s > /dev/null", BC_APP);
3770 if (system(buf)) {
3771 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003772 return NULL;
3773 }
3774
Steven Langd0c814e2011-10-28 08:37:13 +02003775 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003776 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003777 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003778 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003779
Steven Langd0c814e2011-10-28 08:37:13 +02003780 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003781 if (ret <= 0) {
3782 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003783 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003784 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003785
Jens Axboe892a6ff2009-11-13 12:19:49 +01003786 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003787 buf[(tmp - str) + ret - 1] = '\0';
3788 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003789 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003790 return strdup(buf);
3791}
3792
3793/*
3794 * Return a copy of the input string with substrings of the form ${VARNAME}
3795 * substituted with the value of the environment variable VARNAME. The
3796 * substitution always occurs, even if VARNAME is empty or the corresponding
3797 * environment variable undefined.
3798 */
3799static char *option_dup_subs(const char *opt)
3800{
3801 char out[OPT_LEN_MAX+1];
3802 char in[OPT_LEN_MAX+1];
3803 char *outptr = out;
3804 char *inptr = in;
3805 char *ch1, *ch2, *env;
3806 ssize_t nchr = OPT_LEN_MAX;
3807 size_t envlen;
3808
3809 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3810 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3811 return NULL;
3812 }
3813
3814 in[OPT_LEN_MAX] = '\0';
3815 strncpy(in, opt, OPT_LEN_MAX);
3816
3817 while (*inptr && nchr > 0) {
3818 if (inptr[0] == '$' && inptr[1] == '{') {
3819 ch2 = strchr(inptr, '}');
3820 if (ch2 && inptr+1 < ch2) {
3821 ch1 = inptr+2;
3822 inptr = ch2+1;
3823 *ch2 = '\0';
3824
3825 env = getenv(ch1);
3826 if (env) {
3827 envlen = strlen(env);
3828 if (envlen <= nchr) {
3829 memcpy(outptr, env, envlen);
3830 outptr += envlen;
3831 nchr -= envlen;
3832 }
3833 }
3834
3835 continue;
3836 }
3837 }
3838
3839 *outptr++ = *inptr++;
3840 --nchr;
3841 }
3842
3843 *outptr = '\0';
3844 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003845}
3846
Jens Axboe74929ac2009-08-05 11:42:37 +02003847/*
3848 * Look for reserved variable names and replace them with real values
3849 */
3850static char *fio_keyword_replace(char *opt)
3851{
3852 char *s;
3853 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003854 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003855
3856 for (i = 0; fio_keywords[i].word != NULL; i++) {
3857 struct fio_keyword *kw = &fio_keywords[i];
3858
3859 while ((s = strstr(opt, kw->word)) != NULL) {
3860 char *new = malloc(strlen(opt) + 1);
3861 char *o_org = opt;
3862 int olen = s - opt;
3863 int len;
3864
3865 /*
3866 * Copy part of the string before the keyword and
3867 * sprintf() the replacement after it.
3868 */
3869 memcpy(new, opt, olen);
3870 len = sprintf(new + olen, "%s", kw->replace);
3871
3872 /*
3873 * If there's more in the original string, copy that
3874 * in too
3875 */
3876 opt += strlen(kw->word) + olen;
3877 if (strlen(opt))
3878 memcpy(new + olen + len, opt, opt - o_org - 1);
3879
3880 /*
3881 * replace opt and free the old opt
3882 */
3883 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003884 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003885
Steven Langd0c814e2011-10-28 08:37:13 +02003886 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003887 }
3888 }
3889
Steven Langd0c814e2011-10-28 08:37:13 +02003890 /*
3891 * Check for potential math and invoke bc, if possible
3892 */
3893 if (docalc)
3894 opt = bc_calc(opt);
3895
Jens Axboe7a958bd2009-11-13 12:33:54 +01003896 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003897}
3898
Steven Langd0c814e2011-10-28 08:37:13 +02003899static char **dup_and_sub_options(char **opts, int num_opts)
3900{
3901 int i;
3902 char **opts_copy = malloc(num_opts * sizeof(*opts));
3903 for (i = 0; i < num_opts; i++) {
3904 opts_copy[i] = option_dup_subs(opts[i]);
3905 if (!opts_copy[i])
3906 continue;
3907 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3908 }
3909 return opts_copy;
3910}
3911
Jens Axboe5b284222014-12-06 09:53:46 -07003912static void show_closest_option(const char *opt)
Jens Axboecf88f2a2014-12-06 09:17:52 -07003913{
3914 int best_option, best_distance;
3915 int i, distance;
Jens Axboe5b284222014-12-06 09:53:46 -07003916 char *name;
3917
3918 if (!strlen(opt))
3919 return;
3920
3921 name = strdup(opt);
3922 i = 0;
3923 while (name[i] != '\0' && name[i] != '=')
3924 i++;
3925 name[i] = '\0';
Jens Axboecf88f2a2014-12-06 09:17:52 -07003926
3927 best_option = -1;
3928 best_distance = INT_MAX;
3929 i = 0;
3930 while (fio_options[i].name) {
3931 distance = string_distance(name, fio_options[i].name);
3932 if (distance < best_distance) {
3933 best_distance = distance;
3934 best_option = i;
3935 }
3936 i++;
3937 }
3938
3939 if (best_option != -1)
3940 log_err("Did you mean %s?\n", fio_options[best_option].name);
Jens Axboe5b284222014-12-06 09:53:46 -07003941
3942 free(name);
Jens Axboecf88f2a2014-12-06 09:17:52 -07003943}
3944
Jens Axboe292cc472013-11-26 20:39:35 -07003945int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3946 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003947{
Steven Langde890a12011-11-09 14:03:34 +01003948 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003949 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003950
Jens Axboe9af4a242012-03-16 10:13:49 +01003951 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003952 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003953
Steven Langde890a12011-11-09 14:03:34 +01003954 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3955 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003956 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003957 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003958
Jens Axboe9c62acd2014-12-09 12:58:15 -07003959 if (!newret && o)
3960 fio_option_mark_set(&td->o, o);
3961
Steven Langde890a12011-11-09 14:03:34 +01003962 if (opts_copy[i]) {
3963 if (newret && !o) {
3964 unknown++;
3965 continue;
3966 }
Steven Langd0c814e2011-10-28 08:37:13 +02003967 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003968 opts_copy[i] = NULL;
3969 }
3970
3971 ret |= newret;
3972 }
3973
3974 if (unknown) {
3975 ret |= ioengine_load(td);
3976 if (td->eo) {
3977 sort_options(opts_copy, td->io_ops->options, num_opts);
3978 opts = opts_copy;
3979 }
3980 for (i = 0; i < num_opts; i++) {
3981 struct fio_option *o = NULL;
3982 int newret = 1;
Jens Axboecf88f2a2014-12-06 09:17:52 -07003983
Steven Langde890a12011-11-09 14:03:34 +01003984 if (!opts_copy[i])
3985 continue;
3986
3987 if (td->eo)
3988 newret = parse_option(opts_copy[i], opts[i],
3989 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003990 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003991
3992 ret |= newret;
Jens Axboecf88f2a2014-12-06 09:17:52 -07003993 if (!o) {
Steven Langde890a12011-11-09 14:03:34 +01003994 log_err("Bad option <%s>\n", opts[i]);
Jens Axboecf88f2a2014-12-06 09:17:52 -07003995 show_closest_option(opts[i]);
3996 }
Steven Langde890a12011-11-09 14:03:34 +01003997 free(opts_copy[i]);
3998 opts_copy[i] = NULL;
3999 }
Jens Axboe74929ac2009-08-05 11:42:37 +02004000 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02004001
Steven Langd0c814e2011-10-28 08:37:13 +02004002 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02004003 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004004}
4005
4006int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4007{
Jens Axboe9c62acd2014-12-09 12:58:15 -07004008 int ret;
4009
4010 ret = parse_cmd_option(opt, val, fio_options, td);
4011 if (!ret) {
4012 struct fio_option *o;
4013
4014 o = find_option(fio_options, opt);
4015 if (o)
4016 fio_option_mark_set(&td->o, o);
4017 }
4018
4019 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004020}
4021
Steven Langde890a12011-11-09 14:03:34 +01004022int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4023 char *val)
4024{
Akinobu Mita8a96c802013-10-09 09:32:34 -06004025 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01004026}
4027
Jens Axboe214e1ec2007-03-15 10:48:13 +01004028void fio_fill_default_options(struct thread_data *td)
4029{
Jens Axboecb1402d2014-02-25 11:35:27 -08004030 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01004031 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004032}
4033
4034int fio_show_option_help(const char *opt)
4035{
Jens Axboe9af4a242012-03-16 10:13:49 +01004036 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004037}
Jens Axboed23bb322007-03-23 15:57:56 +01004038
Steven Langde890a12011-11-09 14:03:34 +01004039void options_mem_dupe(void *data, struct fio_option *options)
4040{
4041 struct fio_option *o;
4042 char **ptr;
4043
4044 for (o = &options[0]; o->name; o++) {
4045 if (o->type != FIO_OPT_STR_STORE)
4046 continue;
4047
Jens Axboef0fdbca2014-02-11 15:44:50 -07004048 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01004049 if (*ptr)
4050 *ptr = strdup(*ptr);
4051 }
4052}
4053
Jens Axboe7e356b22011-10-14 10:55:16 +02004054/*
4055 * dupe FIO_OPT_STR_STORE options
4056 */
Steven Langde890a12011-11-09 14:03:34 +01004057void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01004058{
Jens Axboe9af4a242012-03-16 10:13:49 +01004059 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01004060
4061 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01004062 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01004063
Steven Langde890a12011-11-09 14:03:34 +01004064 td->eo = malloc(td->io_ops->option_struct_size);
4065 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4066 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01004067 }
4068}
4069
Jens Axboed6978a32009-07-18 21:04:09 +02004070unsigned int fio_get_kb_base(void *data)
4071{
Jens Axboe83ea4222012-03-28 14:01:46 +02004072 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02004073 unsigned int kb_base = 0;
4074
Jens Axboecb1402d2014-02-25 11:35:27 -08004075 /*
4076 * This is a hack... For private options, *data is not holding
4077 * a pointer to the thread_options, but to private data. This means
4078 * we can't safely dereference it, but magic is first so mem wise
4079 * it is valid. But this also means that if the job first sets
4080 * kb_base and expects that to be honored by private options,
4081 * it will be disappointed. We will return the global default
4082 * for this.
4083 */
4084 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004085 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004086 if (!kb_base)
4087 kb_base = 1024;
4088
4089 return kb_base;
4090}
Jens Axboe9f988e22010-03-04 10:42:38 +01004091
Jens Axboe07b32322010-03-05 09:48:44 +01004092int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004093{
Jens Axboe07b32322010-03-05 09:48:44 +01004094 struct fio_option *__o;
4095 int opt_index = 0;
4096
Jens Axboe9af4a242012-03-16 10:13:49 +01004097 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004098 while (__o->name) {
4099 opt_index++;
4100 __o++;
4101 }
4102
Jens Axboe7b504ed2014-02-11 14:19:38 -07004103 if (opt_index + 1 == FIO_MAX_OPTS) {
4104 log_err("fio: FIO_MAX_OPTS is too small\n");
4105 return 1;
4106 }
4107
Jens Axboe9af4a242012-03-16 10:13:49 +01004108 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004109 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004110 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004111}
Jens Axboee2de69d2010-03-04 14:05:48 +01004112
Jens Axboe07b32322010-03-05 09:48:44 +01004113void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004114{
Jens Axboe07b32322010-03-05 09:48:44 +01004115 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004116
Jens Axboe9af4a242012-03-16 10:13:49 +01004117 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004118 while (o->name) {
4119 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4120 o->type = FIO_OPT_INVALID;
4121 o->prof_name = NULL;
4122 }
4123 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004124 }
4125}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004126
4127void add_opt_posval(const char *optname, const char *ival, const char *help)
4128{
4129 struct fio_option *o;
4130 unsigned int i;
4131
Jens Axboe9af4a242012-03-16 10:13:49 +01004132 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004133 if (!o)
4134 return;
4135
4136 for (i = 0; i < PARSE_MAX_VP; i++) {
4137 if (o->posval[i].ival)
4138 continue;
4139
4140 o->posval[i].ival = ival;
4141 o->posval[i].help = help;
4142 break;
4143 }
4144}
4145
4146void del_opt_posval(const char *optname, const char *ival)
4147{
4148 struct fio_option *o;
4149 unsigned int i;
4150
Jens Axboe9af4a242012-03-16 10:13:49 +01004151 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004152 if (!o)
4153 return;
4154
4155 for (i = 0; i < PARSE_MAX_VP; i++) {
4156 if (!o->posval[i].ival)
4157 continue;
4158 if (strcmp(o->posval[i].ival, ival))
4159 continue;
4160
4161 o->posval[i].ival = NULL;
4162 o->posval[i].help = NULL;
4163 }
4164}
Jens Axboe7e356b22011-10-14 10:55:16 +02004165
4166void fio_options_free(struct thread_data *td)
4167{
Jens Axboe9af4a242012-03-16 10:13:49 +01004168 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004169 if (td->eo && td->io_ops && td->io_ops->options) {
4170 options_free(td->io_ops->options, td->eo);
4171 free(td->eo);
4172 td->eo = NULL;
4173 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004174}
Jens Axboec504ee52012-03-20 11:29:09 +01004175
4176struct fio_option *fio_option_find(const char *name)
4177{
4178 return find_option(fio_options, name);
4179}
4180
Jens Axboef6b79252014-12-22 20:03:50 -07004181static struct fio_option *find_next_opt(struct thread_options *o,
4182 struct fio_option *from,
4183 unsigned int off1)
Jens Axboe9c62acd2014-12-09 12:58:15 -07004184{
Jens Axboef6b79252014-12-22 20:03:50 -07004185 struct fio_option *opt;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004186
Jens Axboef6b79252014-12-22 20:03:50 -07004187 if (!from)
4188 from = &fio_options[0];
4189 else
4190 from++;
4191
4192 opt = NULL;
4193 do {
4194 if (off1 == from->off1) {
4195 opt = from;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004196 break;
4197 }
Jens Axboef6b79252014-12-22 20:03:50 -07004198 from++;
4199 } while (from->name);
Jens Axboe9c62acd2014-12-09 12:58:15 -07004200
Jens Axboef6b79252014-12-22 20:03:50 -07004201 return opt;
4202}
4203
4204static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4205{
4206 unsigned int opt_off, index, offset;
Jens Axboe9c62acd2014-12-09 12:58:15 -07004207
4208 opt_off = opt - &fio_options[0];
4209 index = opt_off / (8 * sizeof(uint64_t));
4210 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4211 return (o->set_options[index] & (1UL << offset)) != 0;
4212}
4213
Jens Axboef6b79252014-12-22 20:03:50 -07004214int __fio_option_is_set(struct thread_options *o, unsigned int off1)
4215{
4216 struct fio_option *opt, *next;
4217
4218 next = NULL;
4219 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4220 if (opt_is_set(o, opt))
4221 return 1;
4222
4223 next = opt;
4224 }
4225
4226 return 0;
4227}
4228
Jens Axboe9c62acd2014-12-09 12:58:15 -07004229void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4230{
4231 unsigned int opt_off, index, offset;
4232
4233 opt_off = opt - &fio_options[0];
4234 index = opt_off / (8 * sizeof(uint64_t));
4235 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4236 o->set_options[index] |= 1UL << offset;
4237}