blob: ac561bc91da2e5c052371a9fd20ac3b85db54d47 [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 Axboe375b2692007-05-22 09:13:02 +0200456 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100457 return 0;
458}
459
Jens Axboee8462bd2009-07-06 12:59:04 +0200460static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
461 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200462{
Jens Axboed2e268b2007-06-15 10:33:49 +0200463 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100464 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100465 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200466
Jens Axboee8462bd2009-07-06 12:59:04 +0200467 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100468 if (ret < 0) {
469 log_err("fio: cpuset_init failed\n");
470 td_verror(td, ret, "fio_cpuset_init");
471 return 1;
472 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200473
474 p = str = strdup(input);
475
476 strip_blank_front(&str);
477 strip_blank_end(str);
478
Jens Axboec00a2282011-07-08 20:56:06 +0200479 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100480
Jens Axboed2e268b2007-06-15 10:33:49 +0200481 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100482 char *str2, *cpu2;
483 int icpu, icpu2;
484
Jens Axboed2e268b2007-06-15 10:33:49 +0200485 if (!strlen(cpu))
486 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100487
488 str2 = cpu;
489 icpu2 = -1;
490 while ((cpu2 = strsep(&str2, "-")) != NULL) {
491 if (!strlen(cpu2))
492 break;
493
494 icpu2 = atoi(cpu2);
495 }
496
497 icpu = atoi(cpu);
498 if (icpu2 == -1)
499 icpu2 = icpu;
500 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100501 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100502 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100503 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100504 ret = 1;
505 break;
506 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100507 if (icpu > max_cpu) {
508 log_err("fio: CPU %d too large (max=%ld)\n",
509 icpu, max_cpu);
510 ret = 1;
511 break;
512 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200513
Jens Axboe62a72732008-12-08 11:37:01 +0100514 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200515 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100516 icpu++;
517 }
Jens Axboe19608d62008-12-08 15:03:12 +0100518 if (ret)
519 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200520 }
521
522 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100523 if (!ret)
524 td->o.cpumask_set = 1;
525 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200526}
Jens Axboee8462bd2009-07-06 12:59:04 +0200527
528static int str_cpus_allowed_cb(void *data, const char *input)
529{
530 struct thread_data *td = data;
531 int ret;
532
Jens Axboe52c0cea2013-09-06 10:07:37 -0600533 if (parse_dryrun())
534 return 0;
535
Jens Axboee8462bd2009-07-06 12:59:04 +0200536 ret = set_cpus_allowed(td, &td->o.cpumask, input);
537 if (!ret)
538 td->o.cpumask_set = 1;
539
540 return ret;
541}
542
543static int str_verify_cpus_allowed_cb(void *data, const char *input)
544{
545 struct thread_data *td = data;
546 int ret;
547
548 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
549 if (!ret)
550 td->o.verify_cpumask_set = 1;
551
552 return ret;
553}
Jens Axboed2e268b2007-06-15 10:33:49 +0200554#endif
555
Jens Axboe67bf9822013-01-10 11:23:19 +0100556#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400557static int str_numa_cpunodes_cb(void *data, char *input)
558{
559 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200560 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400561
Jens Axboe52c0cea2013-09-06 10:07:37 -0600562 if (parse_dryrun())
563 return 0;
564
Yufei Rend0b937e2012-10-19 23:11:52 -0400565 /* numa_parse_nodestring() parses a character string list
566 * of nodes into a bit mask. The bit mask is allocated by
567 * numa_allocate_nodemask(), so it should be freed by
568 * numa_free_nodemask().
569 */
Daniel Gollub43522842014-05-01 17:07:49 +0200570 verify_bitmask = numa_parse_nodestring(input);
571 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400572 log_err("fio: numa_parse_nodestring failed\n");
573 td_verror(td, 1, "str_numa_cpunodes_cb");
574 return 1;
575 }
Daniel Gollub43522842014-05-01 17:07:49 +0200576 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400577
Daniel Gollub43522842014-05-01 17:07:49 +0200578 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400579 td->o.numa_cpumask_set = 1;
580 return 0;
581}
582
583static int str_numa_mpol_cb(void *data, char *input)
584{
585 struct thread_data *td = data;
586 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600587 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400588 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600589 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200590 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400591
Jens Axboe52c0cea2013-09-06 10:07:37 -0600592 if (parse_dryrun())
593 return 0;
594
595 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400596 if (nodelist) {
597 /* NUL-terminate mode */
598 *nodelist++ = '\0';
599 }
600
601 for (i = 0; i <= MPOL_LOCAL; i++) {
602 if (!strcmp(input, policy_types[i])) {
603 td->o.numa_mem_mode = i;
604 break;
605 }
606 }
607 if (i > MPOL_LOCAL) {
608 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
609 goto out;
610 }
611
612 switch (td->o.numa_mem_mode) {
613 case MPOL_PREFERRED:
614 /*
615 * Insist on a nodelist of one node only
616 */
617 if (nodelist) {
618 char *rest = nodelist;
619 while (isdigit(*rest))
620 rest++;
621 if (*rest) {
622 log_err("fio: one node only for \'prefer\'\n");
623 goto out;
624 }
625 } else {
626 log_err("fio: one node is needed for \'prefer\'\n");
627 goto out;
628 }
629 break;
630 case MPOL_INTERLEAVE:
631 /*
632 * Default to online nodes with memory if no nodelist
633 */
634 if (!nodelist)
635 nodelist = strdup("all");
636 break;
637 case MPOL_LOCAL:
638 case MPOL_DEFAULT:
639 /*
640 * Don't allow a nodelist
641 */
642 if (nodelist) {
643 log_err("fio: NO nodelist for \'local\'\n");
644 goto out;
645 }
646 break;
647 case MPOL_BIND:
648 /*
649 * Insist on a nodelist
650 */
651 if (!nodelist) {
652 log_err("fio: a nodelist is needed for \'bind\'\n");
653 goto out;
654 }
655 break;
656 }
657
658
659 /* numa_parse_nodestring() parses a character string list
660 * of nodes into a bit mask. The bit mask is allocated by
661 * numa_allocate_nodemask(), so it should be freed by
662 * numa_free_nodemask().
663 */
664 switch (td->o.numa_mem_mode) {
665 case MPOL_PREFERRED:
666 td->o.numa_mem_prefer_node = atoi(nodelist);
667 break;
668 case MPOL_INTERLEAVE:
669 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200670 verify_bitmask = numa_parse_nodestring(nodelist);
671 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400672 log_err("fio: numa_parse_nodestring failed\n");
673 td_verror(td, 1, "str_numa_memnodes_cb");
674 return 1;
675 }
Daniel Gollub43522842014-05-01 17:07:49 +0200676 td->o.numa_memnodes = strdup(nodelist);
677 numa_free_nodemask(verify_bitmask);
Manish Mandlik44e2ab52014-08-14 11:45:16 -0600678
Yufei Rend0b937e2012-10-19 23:11:52 -0400679 break;
680 case MPOL_LOCAL:
681 case MPOL_DEFAULT:
682 default:
683 break;
684 }
685
686 td->o.numa_memmask_set = 1;
687 return 0;
688
689out:
690 return 1;
691}
692#endif
693
Jens Axboe214e1ec2007-03-15 10:48:13 +0100694static int str_fst_cb(void *data, const char *str)
695{
696 struct thread_data *td = data;
697 char *nr = get_opt_postfix(str);
698
699 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100700 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100701 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100702 free(nr);
703 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100704
705 return 0;
706}
707
Jens Axboe67bf9822013-01-10 11:23:19 +0100708#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100709static int str_sfr_cb(void *data, const char *str)
710{
711 struct thread_data *td = data;
712 char *nr = get_opt_postfix(str);
713
714 td->sync_file_range_nr = 1;
715 if (nr) {
716 td->sync_file_range_nr = atoi(nr);
717 free(nr);
718 }
719
720 return 0;
721}
Jens Axboe3ae06372010-03-19 19:17:15 +0100722#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100723
Jens Axboee25839d2012-11-06 10:49:42 +0100724static int str_random_distribution_cb(void *data, const char *str)
725{
726 struct thread_data *td = data;
727 double val;
728 char *nr;
729
Jens Axboe52c0cea2013-09-06 10:07:37 -0600730 if (parse_dryrun())
731 return 0;
732
Jens Axboe925fee32012-11-06 13:50:32 +0100733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
734 val = 1.1;
735 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
736 val = 0.2;
737 else
Jens Axboee25839d2012-11-06 10:49:42 +0100738 return 0;
739
740 nr = get_opt_postfix(str);
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700741 if (nr && !str_to_float(nr, &val, 0)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100742 log_err("fio: random postfix parsing failed\n");
743 free(nr);
744 return 1;
745 }
746
Jens Axboe078189c2012-11-07 13:47:22 +0100747 free(nr);
748
Jens Axboe18ded912012-11-08 08:36:00 +0100749 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
750 if (val == 1.00) {
751 log_err("fio: zipf theta must different than 1.0\n");
752 return 1;
753 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700754 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100755 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100756 if (val <= 0.00 || val >= 1.00) {
757 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
758 return 1;
759 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700760 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100761 }
Jens Axboe925fee32012-11-06 13:50:32 +0100762
Jens Axboee25839d2012-11-06 10:49:42 +0100763 return 0;
764}
765
Jens Axboe8e827d32009-08-04 09:51:48 +0200766/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800767 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200768 * is escaped with a '\', then that ':' is part of the filename and does not
769 * indicate a new file.
770 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800771static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200772{
773 char *str = *ptr;
774 char *p, *start;
775
776 if (!str || !strlen(str))
777 return NULL;
778
779 start = str;
780 do {
781 /*
782 * No colon, we are done
783 */
784 p = strchr(str, ':');
785 if (!p) {
786 *ptr = NULL;
787 break;
788 }
789
790 /*
791 * We got a colon, but it's the first character. Skip and
792 * continue
793 */
794 if (p == start) {
795 str = ++start;
796 continue;
797 }
798
799 if (*(p - 1) != '\\') {
800 *p = '\0';
801 *ptr = p + 1;
802 break;
803 }
804
805 memmove(p - 1, p, strlen(p) + 1);
806 str = p;
807 } while (1);
808
809 return start;
810}
811
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800812
813static int get_max_name_idx(char *input)
814{
815 unsigned int cur_idx;
816 char *str, *p;
817
818 p = str = strdup(input);
819 for (cur_idx = 0; ; cur_idx++)
820 if (get_next_name(&str) == NULL)
821 break;
822
823 free(p);
824 return cur_idx;
825}
826
827/*
828 * Returns the directory at the index, indexes > entires will be
829 * assigned via modulo division of the index
830 */
831int set_name_idx(char *target, char *input, int index)
832{
833 unsigned int cur_idx;
834 int len;
835 char *fname, *str, *p;
836
837 p = str = strdup(input);
838
839 index %= get_max_name_idx(input);
840 for (cur_idx = 0; cur_idx <= index; cur_idx++)
841 fname = get_next_name(&str);
842
843 len = sprintf(target, "%s/", fname);
844 free(p);
845
846 return len;
847}
848
Jens Axboe214e1ec2007-03-15 10:48:13 +0100849static int str_filename_cb(void *data, const char *input)
850{
851 struct thread_data *td = data;
852 char *fname, *str, *p;
853
854 p = str = strdup(input);
855
856 strip_blank_front(&str);
857 strip_blank_end(str);
858
859 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100860 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100861
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800862 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100863 if (!strlen(fname))
864 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800865 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100866 }
867
868 free(p);
869 return 0;
870}
871
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800872static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100873{
874 struct thread_data *td = data;
875 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800876 char *dirname, *str, *p;
877 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100878
Jens Axboef9633d72013-09-06 09:59:56 -0600879 if (parse_dryrun())
880 return 0;
881
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800882 p = str = strdup(td->o.directory);
883 while ((dirname = get_next_name(&str)) != NULL) {
884 if (lstat(dirname, &sb) < 0) {
885 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100886
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800887 log_err("fio: %s is not a directory\n", dirname);
888 td_verror(td, ret, "lstat");
889 goto out;
890 }
891 if (!S_ISDIR(sb.st_mode)) {
892 log_err("fio: %s is not a directory\n", dirname);
893 ret = 1;
894 goto out;
895 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100896 }
897
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800898out:
899 free(p);
900 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100901}
902
Jens Axboef2a28032014-02-11 09:12:06 -0700903static int str_lockfile_cb(void *data, const char fio_unused *str)
904{
905 struct thread_data *td = data;
906
907 if (td->files_index) {
908 log_err("fio: lockfile= option must precede filename=\n");
909 return 1;
910 }
911
912 return 0;
913}
914
Jens Axboe214e1ec2007-03-15 10:48:13 +0100915static int str_opendir_cb(void *data, const char fio_unused *str)
916{
917 struct thread_data *td = data;
918
Jens Axboe52c0cea2013-09-06 10:07:37 -0600919 if (parse_dryrun())
920 return 0;
921
Jens Axboe214e1ec2007-03-15 10:48:13 +0100922 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100923 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100924
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100925 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100926}
927
Jens Axboece35b1e2014-01-14 15:35:58 -0700928static int pattern_cb(char *pattern, unsigned int max_size,
929 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200930{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100931 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700932 int i = 0, j = 0, len, k, base = 10;
933 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200934 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200935
Jens Axboe5de855d2014-08-22 14:02:02 -0500936 /*
937 * Check if it's a string input
938 */
939 loc1 = strchr(input, '\"');
940 if (loc1) {
941 do {
942 loc1++;
943 if (*loc1 == '\0' || *loc1 == '\"')
944 break;
945
946 pattern[i] = *loc1;
947 i++;
948 } while (i < max_size);
949
950 if (!i)
951 return 1;
952
953 goto fill;
954 }
955
956 /*
957 * No string, find out if it's decimal or hexidecimal
958 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100959 loc1 = strstr(input, "0x");
960 loc2 = strstr(input, "0X");
961 if (loc1 || loc2)
962 base = 16;
963 off = strtol(input, NULL, base);
964 if (off != LONG_MAX || errno != ERANGE) {
965 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700966 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100967 off >>= 8;
968 i++;
969 }
970 } else {
971 len = strlen(input);
972 k = len - 1;
973 if (base == 16) {
974 if (loc1)
975 j = loc1 - input + 2;
976 else
977 j = loc2 - input + 2;
978 } else
979 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700980 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100981 while (k >= j) {
982 off = converthexchartoint(input[k--]);
983 if (k >= j)
984 off += (converthexchartoint(input[k--])
985 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700986 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100987 }
988 }
989 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100990
991 /*
992 * Fill the pattern all the way to the end. This greatly reduces
993 * the number of memcpy's we have to do when verifying the IO.
994 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500995fill:
Jens Axboee078de42013-04-24 23:07:17 -0600996 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700997 while (i > 1 && i * 2 <= max_size) {
998 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100999 i *= 2;
1000 }
Jens Axboee078de42013-04-24 23:07:17 -06001001
1002 /*
1003 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -07001004 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -06001005 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001006 while (i > 1 && i < max_size) {
1007 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -06001008
Jens Axboece35b1e2014-01-14 15:35:58 -07001009 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -06001010 i += b;
1011 }
1012
Steven Lang9a2a86d2012-02-07 09:42:59 +01001013 if (i == 1) {
1014 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -05001015 * The code in verify_io_u_pattern assumes a single byte
1016 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +01001017 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001018 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +01001019 }
Steven Langefcd9dc2012-02-02 20:22:04 +01001020
Jens Axboece35b1e2014-01-14 15:35:58 -07001021 *pattern_bytes = i;
1022 return 0;
1023}
1024
1025static int str_buffer_pattern_cb(void *data, const char *input)
1026{
1027 struct thread_data *td = data;
1028 int ret;
1029
1030 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1031 &td->o.buffer_pattern_bytes);
1032
Jens Axboedf91a1f2014-08-22 10:22:03 -05001033 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboe97f78c42014-12-04 08:27:21 -07001034 if (!td->o.compress_percentage)
1035 td->o.refill_buffers = 0;
Jens Axboece35b1e2014-01-14 15:35:58 -07001036 td->o.scramble_buffers = 0;
1037 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001038 } else {
1039 log_err("fio: failed parsing pattern `%s`\n", input);
1040 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001041 }
1042
1043 return ret;
1044}
1045
Jens Axboebedc9dc2014-03-17 12:51:09 -06001046static int str_buffer_compress_cb(void *data, unsigned long long *il)
1047{
1048 struct thread_data *td = data;
1049
1050 td->flags |= TD_F_COMPRESS;
1051 td->o.compress_percentage = *il;
1052 return 0;
1053}
1054
Jens Axboee66dac22014-09-22 10:02:07 -06001055static int str_dedupe_cb(void *data, unsigned long long *il)
1056{
1057 struct thread_data *td = data;
1058
1059 td->flags |= TD_F_COMPRESS;
1060 td->o.dedupe_percentage = *il;
1061 td->o.refill_buffers = 1;
1062 return 0;
1063}
1064
Jens Axboece35b1e2014-01-14 15:35:58 -07001065static int str_verify_pattern_cb(void *data, const char *input)
1066{
1067 struct thread_data *td = data;
1068 int ret;
1069
1070 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1071 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001072
Jens Axboe92bf48d2011-01-14 21:20:42 +01001073 /*
1074 * VERIFY_META could already be set
1075 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001076 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001077 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001078
Jens Axboece35b1e2014-01-14 15:35:58 -07001079 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001080}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001081
Jens Axboe993bf482008-11-14 13:04:53 +01001082static int str_gtod_reduce_cb(void *data, int *il)
1083{
1084 struct thread_data *td = data;
1085 int val = *il;
1086
Jens Axboe02af0982010-06-24 09:59:34 +02001087 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001088 td->o.disable_clat = !!val;
1089 td->o.disable_slat = !!val;
1090 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001091 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001092 if (val)
1093 td->tv_cache_mask = 63;
1094
1095 return 0;
1096}
1097
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001098static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001099{
1100 struct thread_data *td = data;
1101 int val = *il;
1102
1103 td->o.gtod_cpu = val;
1104 td->o.gtod_offload = 1;
1105 return 0;
1106}
1107
Jens Axboe7bb59102011-07-12 19:47:03 +02001108static int str_size_cb(void *data, unsigned long long *__val)
1109{
1110 struct thread_data *td = data;
1111 unsigned long long v = *__val;
1112
1113 if (parse_is_percent(v)) {
1114 td->o.size = 0;
1115 td->o.size_percent = -1ULL - v;
1116 } else
1117 td->o.size = v;
1118
1119 return 0;
1120}
1121
Jens Axboe896cac22009-07-01 10:38:35 +02001122static int rw_verify(struct fio_option *o, void *data)
1123{
1124 struct thread_data *td = data;
1125
1126 if (read_only && td_write(td)) {
1127 log_err("fio: job <%s> has write bit set, but fio is in"
1128 " read-only mode\n", td->o.name);
1129 return 1;
1130 }
1131
1132 return 0;
1133}
1134
Jens Axboe276ca4f2009-07-01 10:43:05 +02001135static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001136{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001137#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001138 struct thread_data *td = data;
1139
Jens Axboe29d43ff2009-07-01 10:42:18 +02001140 if (td->o.gtod_cpu) {
1141 log_err("fio: platform must support CPU affinity for"
1142 "gettimeofday() offloading\n");
1143 return 1;
1144 }
1145#endif
1146
1147 return 0;
1148}
1149
Jens Axboe214e1ec2007-03-15 10:48:13 +01001150/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001151 * Option grouping
1152 */
1153static struct opt_group fio_opt_groups[] = {
1154 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001155 .name = "General",
1156 .mask = FIO_OPT_C_GENERAL,
1157 },
1158 {
1159 .name = "I/O",
1160 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001161 },
1162 {
1163 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001164 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001165 },
1166 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001167 .name = "Statistics",
1168 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001169 },
1170 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001171 .name = "Logging",
1172 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001173 },
1174 {
Jens Axboe13fca822012-03-31 13:55:54 +02001175 .name = "Profiles",
1176 .mask = FIO_OPT_C_PROFILE,
1177 },
1178 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001179 .name = NULL,
1180 },
1181};
1182
Jens Axboee8b0e952012-03-19 14:37:08 +01001183static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1184 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001185{
1186 struct opt_group *og;
1187 int i;
1188
Jens Axboee8b0e952012-03-19 14:37:08 +01001189 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001190 return NULL;
1191
Jens Axboee8b0e952012-03-19 14:37:08 +01001192 for (i = 0; ogs[i].name; i++) {
1193 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001194
1195 if (*mask & og->mask) {
1196 *mask &= ~(og->mask);
1197 return og;
1198 }
1199 }
1200
1201 return NULL;
1202}
1203
Jens Axboee8b0e952012-03-19 14:37:08 +01001204struct opt_group *opt_group_from_mask(unsigned int *mask)
1205{
1206 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1207}
1208
1209static struct opt_group fio_opt_cat_groups[] = {
1210 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001211 .name = "Latency profiling",
1212 .mask = FIO_OPT_G_LATPROF,
1213 },
1214 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001215 .name = "Rate",
1216 .mask = FIO_OPT_G_RATE,
1217 },
1218 {
1219 .name = "Zone",
1220 .mask = FIO_OPT_G_ZONE,
1221 },
1222 {
1223 .name = "Read/write mix",
1224 .mask = FIO_OPT_G_RWMIX,
1225 },
1226 {
1227 .name = "Verify",
1228 .mask = FIO_OPT_G_VERIFY,
1229 },
1230 {
1231 .name = "Trim",
1232 .mask = FIO_OPT_G_TRIM,
1233 },
1234 {
1235 .name = "I/O Logging",
1236 .mask = FIO_OPT_G_IOLOG,
1237 },
1238 {
1239 .name = "I/O Depth",
1240 .mask = FIO_OPT_G_IO_DEPTH,
1241 },
1242 {
1243 .name = "I/O Flow",
1244 .mask = FIO_OPT_G_IO_FLOW,
1245 },
1246 {
Jens Axboe06260372012-03-19 15:16:08 +01001247 .name = "Description",
1248 .mask = FIO_OPT_G_DESC,
1249 },
1250 {
1251 .name = "Filename",
1252 .mask = FIO_OPT_G_FILENAME,
1253 },
1254 {
1255 .name = "General I/O",
1256 .mask = FIO_OPT_G_IO_BASIC,
1257 },
1258 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001259 .name = "Cgroups",
1260 .mask = FIO_OPT_G_CGROUP,
1261 },
1262 {
1263 .name = "Runtime",
1264 .mask = FIO_OPT_G_RUNTIME,
1265 },
1266 {
Jens Axboe10860052012-03-19 20:56:53 +01001267 .name = "Process",
1268 .mask = FIO_OPT_G_PROCESS,
1269 },
1270 {
1271 .name = "Job credentials / priority",
1272 .mask = FIO_OPT_G_CRED,
1273 },
1274 {
1275 .name = "Clock settings",
1276 .mask = FIO_OPT_G_CLOCK,
1277 },
1278 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001279 .name = "I/O Type",
1280 .mask = FIO_OPT_G_IO_TYPE,
1281 },
1282 {
1283 .name = "I/O Thinktime",
1284 .mask = FIO_OPT_G_THINKTIME,
1285 },
1286 {
1287 .name = "Randomizations",
1288 .mask = FIO_OPT_G_RANDOM,
1289 },
1290 {
1291 .name = "I/O buffers",
1292 .mask = FIO_OPT_G_IO_BUF,
1293 },
1294 {
Jens Axboe13fca822012-03-31 13:55:54 +02001295 .name = "Tiobench profile",
1296 .mask = FIO_OPT_G_TIOBENCH,
1297 },
1298
1299 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001300 .name = NULL,
1301 }
1302};
1303
1304struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1305{
1306 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1307}
1308
Jens Axboe9af4a242012-03-16 10:13:49 +01001309/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001310 * Map of job/command line options
1311 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001312struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001313 {
1314 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001315 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001316 .type = FIO_OPT_STR_STORE,
1317 .off1 = td_var_offset(description),
1318 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001319 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001320 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001321 },
1322 {
1323 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001324 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001325 .type = FIO_OPT_STR_STORE,
1326 .off1 = td_var_offset(name),
1327 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001328 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001329 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001330 },
1331 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001332 .name = "filename",
1333 .lname = "Filename(s)",
1334 .type = FIO_OPT_STR_STORE,
1335 .off1 = td_var_offset(filename),
1336 .cb = str_filename_cb,
1337 .prio = -1, /* must come after "directory" */
1338 .help = "File(s) to use for the workload",
1339 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001340 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001341 },
1342 {
1343 .name = "directory",
1344 .lname = "Directory",
1345 .type = FIO_OPT_STR_STORE,
1346 .off1 = td_var_offset(directory),
1347 .cb = str_directory_cb,
1348 .help = "Directory to store files in",
1349 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001350 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001351 },
1352 {
Jens Axboede98bd32013-04-05 11:09:20 +02001353 .name = "filename_format",
1354 .type = FIO_OPT_STR_STORE,
1355 .off1 = td_var_offset(filename_format),
1356 .prio = -1, /* must come after "directory" */
1357 .help = "Override default $jobname.$jobnum.$filenum naming",
1358 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001359 .category = FIO_OPT_C_FILE,
1360 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001361 },
1362 {
Jens Axboe29c13492008-03-01 19:25:20 +01001363 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001364 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001365 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001366 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001367 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001368 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001369 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001370 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001371 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001372 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001373 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001374 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001375 .posval = {
1376 { .ival = "none",
1377 .oval = FILE_LOCK_NONE,
1378 .help = "No file locking",
1379 },
1380 { .ival = "exclusive",
1381 .oval = FILE_LOCK_EXCLUSIVE,
1382 .help = "Exclusive file lock",
1383 },
1384 {
1385 .ival = "readwrite",
1386 .oval = FILE_LOCK_READWRITE,
1387 .help = "Read vs write lock",
1388 },
1389 },
Jens Axboe29c13492008-03-01 19:25:20 +01001390 },
1391 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001392 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001393 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001394 .type = FIO_OPT_STR_STORE,
1395 .off1 = td_var_offset(opendir),
1396 .cb = str_opendir_cb,
1397 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001398 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001399 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001400 },
1401 {
1402 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001403 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001404 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001405 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001406 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001407 .off1 = td_var_offset(td_ddir),
1408 .help = "IO direction",
1409 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001410 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001411 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001412 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001413 .posval = {
1414 { .ival = "read",
1415 .oval = TD_DDIR_READ,
1416 .help = "Sequential read",
1417 },
1418 { .ival = "write",
1419 .oval = TD_DDIR_WRITE,
1420 .help = "Sequential write",
1421 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001422 { .ival = "trim",
1423 .oval = TD_DDIR_TRIM,
1424 .help = "Sequential trim",
1425 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001426 { .ival = "randread",
1427 .oval = TD_DDIR_RANDREAD,
1428 .help = "Random read",
1429 },
1430 { .ival = "randwrite",
1431 .oval = TD_DDIR_RANDWRITE,
1432 .help = "Random write",
1433 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001434 { .ival = "randtrim",
1435 .oval = TD_DDIR_RANDTRIM,
1436 .help = "Random trim",
1437 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001438 { .ival = "rw",
1439 .oval = TD_DDIR_RW,
1440 .help = "Sequential read and write mix",
1441 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001442 { .ival = "readwrite",
1443 .oval = TD_DDIR_RW,
1444 .help = "Sequential read and write mix",
1445 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001446 { .ival = "randrw",
1447 .oval = TD_DDIR_RANDRW,
1448 .help = "Random read and write mix"
1449 },
1450 },
1451 },
1452 {
Jens Axboe38dad622010-07-20 14:46:00 -06001453 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001454 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001455 .type = FIO_OPT_STR,
1456 .off1 = td_var_offset(rw_seq),
1457 .help = "IO offset generator modifier",
1458 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001459 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001460 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001461 .posval = {
1462 { .ival = "sequential",
1463 .oval = RW_SEQ_SEQ,
1464 .help = "Generate sequential offsets",
1465 },
1466 { .ival = "identical",
1467 .oval = RW_SEQ_IDENT,
1468 .help = "Generate identical offsets",
1469 },
1470 },
1471 },
1472
1473 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001474 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001475 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001476 .type = FIO_OPT_STR_STORE,
1477 .off1 = td_var_offset(ioengine),
1478 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001479 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001480 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001481 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001482 .posval = {
1483 { .ival = "sync",
1484 .help = "Use read/write",
1485 },
gurudas paia31041e2007-10-23 15:12:30 +02001486 { .ival = "psync",
1487 .help = "Use pread/pwrite",
1488 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001489 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001490 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001491 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001492#ifdef CONFIG_PWRITEV
1493 { .ival = "pvsync",
1494 .help = "Use preadv/pwritev",
1495 },
1496#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001497#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001498 { .ival = "libaio",
1499 .help = "Linux native asynchronous IO",
1500 },
1501#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001502#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001503 { .ival = "posixaio",
1504 .help = "POSIX asynchronous IO",
1505 },
1506#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001507#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001508 { .ival = "solarisaio",
1509 .help = "Solaris native asynchronous IO",
1510 },
1511#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001512#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001513 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001514 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001515 },
Jens Axboe3be80072011-01-19 11:07:28 -07001516#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001517#ifdef CONFIG_RBD
1518 { .ival = "rbd",
1519 .help = "Rados Block Device asynchronous IO"
1520 },
1521#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001522 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001523 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001524 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001525#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001526 { .ival = "splice",
1527 .help = "splice/vmsplice based IO",
1528 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001529 { .ival = "netsplice",
1530 .help = "splice/vmsplice to/from the network",
1531 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001532#endif
1533#ifdef FIO_HAVE_SGIO
1534 { .ival = "sg",
1535 .help = "SCSI generic v3 IO",
1536 },
1537#endif
1538 { .ival = "null",
1539 .help = "Testing engine (no data transfer)",
1540 },
1541 { .ival = "net",
1542 .help = "Network IO",
1543 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001544 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001545 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001546 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001547#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001548 { .ival = "guasi",
1549 .help = "GUASI IO engine",
1550 },
1551#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001552#ifdef FIO_HAVE_BINJECT
1553 { .ival = "binject",
1554 .help = "binject direct inject block engine",
1555 },
1556#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001557#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001558 { .ival = "rdma",
1559 .help = "RDMA IO engine",
1560 },
1561#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001562#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001563 { .ival = "fusion-aw-sync",
1564 .help = "Fusion-io atomic write engine",
1565 },
1566#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001567#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001568 { .ival = "e4defrag",
1569 .help = "ext4 defrag engine",
1570 },
1571#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001572#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001573 { .ival = "falloc",
1574 .help = "fallocate() file based engine",
1575 },
1576#endif
chenh321fc5a2014-03-31 11:32:29 -04001577#ifdef CONFIG_GFAPI
1578 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001579 .help = "Glusterfs libgfapi(sync) based engine"
1580 },
1581 { .ival = "gfapi_async",
1582 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001583 },
1584#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001585#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001586 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001587 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1588 },
1589#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001590 { .ival = "external",
1591 .help = "Load external engine (append name)",
1592 },
1593 },
1594 },
1595 {
1596 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001597 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001598 .type = FIO_OPT_INT,
1599 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001600 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001601 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001602 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001603 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001604 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001605 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001606 },
1607 {
1608 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001609 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001610 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001611 .type = FIO_OPT_INT,
1612 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001613 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001614 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001615 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001616 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001617 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001618 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001619 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001620 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001621 },
1622 {
Jens Axboe49504212008-06-05 09:03:30 +02001623 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001624 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001625 .type = FIO_OPT_INT,
1626 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001627 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001628 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001629 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001630 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001631 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001632 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001633 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001634 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001635 },
1636 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001637 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001638 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001639 .type = FIO_OPT_INT,
1640 .off1 = td_var_offset(iodepth_low),
1641 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001642 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001643 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001644 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001645 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001646 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001647 },
1648 {
1649 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001650 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001651 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001652 .cb = str_size_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001653 .off1 = td_var_offset(size),
Jens Axboe214e1ec2007-03-15 10:48:13 +01001654 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001655 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001656 .category = FIO_OPT_C_IO,
1657 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001658 },
1659 {
Jens Axboe77731b22014-04-28 12:08:47 -06001660 .name = "io_limit",
1661 .lname = "IO Limit",
1662 .type = FIO_OPT_STR_VAL,
1663 .off1 = td_var_offset(io_limit),
1664 .interval = 1024 * 1024,
1665 .category = FIO_OPT_C_IO,
1666 .group = FIO_OPT_G_INVALID,
1667 },
1668 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001669 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001670 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001671 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001672 .type = FIO_OPT_BOOL,
1673 .off1 = td_var_offset(fill_device),
1674 .help = "Write until an ENOSPC error occurs",
1675 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001676 .category = FIO_OPT_C_FILE,
1677 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001678 },
1679 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001680 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001681 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001682 .type = FIO_OPT_STR_VAL,
1683 .off1 = td_var_offset(file_size_low),
1684 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001685 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001686 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001687 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001688 .category = FIO_OPT_C_FILE,
1689 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001690 },
1691 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001692 .name = "file_append",
1693 .lname = "File append",
1694 .type = FIO_OPT_BOOL,
1695 .off1 = td_var_offset(file_append),
1696 .help = "IO will start at the end of the file(s)",
1697 .def = "0",
1698 .category = FIO_OPT_C_FILE,
1699 .group = FIO_OPT_G_INVALID,
1700 },
1701 {
Jens Axboe67a10002007-07-31 23:12:16 +02001702 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001703 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001704 .alias = "fileoffset",
1705 .type = FIO_OPT_STR_VAL,
1706 .off1 = td_var_offset(start_offset),
1707 .help = "Start IO from this offset",
1708 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001709 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001710 .category = FIO_OPT_C_IO,
1711 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001712 },
1713 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001714 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001715 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001716 .type = FIO_OPT_STR_VAL,
1717 .off1 = td_var_offset(offset_increment),
1718 .help = "What is the increment from one offset to the next",
1719 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001720 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001721 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001722 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001723 .category = FIO_OPT_C_IO,
1724 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001725 },
1726 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001727 .name = "number_ios",
1728 .lname = "Number of IOs to perform",
1729 .type = FIO_OPT_STR_VAL,
1730 .off1 = td_var_offset(number_ios),
Jens Axboe0b24a952014-09-28 16:24:23 -06001731 .help = "Force job completion after this number of IOs",
Jens Axboeddf24e42013-08-09 12:53:44 -06001732 .def = "0",
1733 .category = FIO_OPT_C_IO,
1734 .group = FIO_OPT_G_INVALID,
1735 },
1736 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001737 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001738 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001739 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001740 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001741 .off1 = td_var_offset(bs[DDIR_READ]),
1742 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001743 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001744 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001745 .help = "Block size unit",
1746 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001747 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001748 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001749 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001750 .category = FIO_OPT_C_IO,
1751 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001752 },
1753 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001754 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001755 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001756 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001757 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001758 .off1 = td_var_offset(ba[DDIR_READ]),
1759 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001760 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001761 .minval = 1,
1762 .help = "IO block offset alignment",
1763 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001764 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001765 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001766 .category = FIO_OPT_C_IO,
1767 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001768 },
1769 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001770 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001771 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001772 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001773 .type = FIO_OPT_RANGE,
1774 .off1 = td_var_offset(min_bs[DDIR_READ]),
1775 .off2 = td_var_offset(max_bs[DDIR_READ]),
1776 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1777 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001778 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1779 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001780 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001781 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001782 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001783 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001784 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001785 .category = FIO_OPT_C_IO,
1786 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001787 },
1788 {
Jens Axboe564ca972007-12-14 12:21:19 +01001789 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001790 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001791 .type = FIO_OPT_STR,
1792 .cb = str_bssplit_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001793 .off1 = td_var_offset(bssplit),
Jens Axboe564ca972007-12-14 12:21:19 +01001794 .help = "Set a specific mix of block sizes",
1795 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001796 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001797 .category = FIO_OPT_C_IO,
1798 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001799 },
1800 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001801 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001802 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001803 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001804 .type = FIO_OPT_STR_SET,
1805 .off1 = td_var_offset(bs_unaligned),
1806 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001807 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001808 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001809 .category = FIO_OPT_C_IO,
1810 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001811 },
1812 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001813 .name = "bs_is_seq_rand",
1814 .lname = "Block size division is seq/random (not read/write)",
1815 .type = FIO_OPT_BOOL,
1816 .off1 = td_var_offset(bs_is_seq_rand),
Jens Axboe86051d42014-09-28 16:25:49 -06001817 .help = "Consider any blocksize setting to be sequential,random",
Jens Axboe6aca9b32013-07-25 12:45:26 -06001818 .def = "0",
1819 .parent = "blocksize",
1820 .category = FIO_OPT_C_IO,
1821 .group = FIO_OPT_G_INVALID,
1822 },
1823 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001824 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001825 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001826 .type = FIO_OPT_BOOL,
1827 .off1 = td_var_offset(rand_repeatable),
1828 .help = "Use repeatable random IO pattern",
1829 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001830 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001831 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001832 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001833 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001834 },
1835 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001836 .name = "randseed",
1837 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001838 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001839 .off1 = td_var_offset(rand_seed),
1840 .help = "Set the random generator seed value",
1841 .parent = "rw",
1842 .category = FIO_OPT_C_IO,
1843 .group = FIO_OPT_G_RANDOM,
1844 },
1845 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001846 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001847 .lname = "Use OS random",
Jens Axboe559073f2014-11-05 18:34:02 -07001848 .type = FIO_OPT_DEPRECATED,
1849 .off1 = td_var_offset(dep_use_os_rand),
Jens Axboee8b0e952012-03-19 14:37:08 +01001850 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001851 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001852 },
1853 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001854 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001855 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001856 .type = FIO_OPT_STR_SET,
1857 .off1 = td_var_offset(norandommap),
1858 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001859 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001860 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001861 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001862 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001863 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001864 },
1865 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001866 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001867 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001868 .type = FIO_OPT_BOOL,
1869 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001870 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001871 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001872 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001873 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001874 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001875 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001876 },
1877 {
Jens Axboe8055e412012-11-26 08:43:47 +01001878 .name = "random_generator",
1879 .type = FIO_OPT_STR,
1880 .off1 = td_var_offset(random_generator),
1881 .help = "Type of random number generator to use",
1882 .def = "tausworthe",
1883 .posval = {
1884 { .ival = "tausworthe",
1885 .oval = FIO_RAND_GEN_TAUSWORTHE,
1886 .help = "Strong Tausworthe generator",
1887 },
1888 { .ival = "lfsr",
1889 .oval = FIO_RAND_GEN_LFSR,
1890 .help = "Variable length LFSR",
1891 },
1892 },
Jens Axboe48107592012-12-04 09:43:11 +01001893 .category = FIO_OPT_C_IO,
1894 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001895 },
1896 {
Jens Axboee25839d2012-11-06 10:49:42 +01001897 .name = "random_distribution",
1898 .type = FIO_OPT_STR,
1899 .off1 = td_var_offset(random_distribution),
1900 .cb = str_random_distribution_cb,
1901 .help = "Random offset distribution generator",
1902 .def = "random",
1903 .posval = {
1904 { .ival = "random",
1905 .oval = FIO_RAND_DIST_RANDOM,
1906 .help = "Completely random",
1907 },
1908 { .ival = "zipf",
1909 .oval = FIO_RAND_DIST_ZIPF,
1910 .help = "Zipf distribution",
1911 },
Jens Axboe925fee32012-11-06 13:50:32 +01001912 { .ival = "pareto",
1913 .oval = FIO_RAND_DIST_PARETO,
1914 .help = "Pareto distribution",
1915 },
Jens Axboee25839d2012-11-06 10:49:42 +01001916 },
Jens Axboe48107592012-12-04 09:43:11 +01001917 .category = FIO_OPT_C_IO,
1918 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001919 },
1920 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001921 .name = "percentage_random",
1922 .lname = "Percentage Random",
1923 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001924 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1925 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1926 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001927 .maxval = 100,
1928 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001929 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001930 .interval = 5,
1931 .inverse = "percentage_sequential",
1932 .category = FIO_OPT_C_IO,
1933 .group = FIO_OPT_G_RANDOM,
1934 },
1935 {
1936 .name = "percentage_sequential",
1937 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001938 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001939 .category = FIO_OPT_C_IO,
1940 .group = FIO_OPT_G_RANDOM,
1941 },
1942 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001943 .name = "allrandrepeat",
1944 .type = FIO_OPT_BOOL,
1945 .off1 = td_var_offset(allrand_repeatable),
1946 .help = "Use repeatable random numbers for everything",
1947 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001950 },
1951 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001952 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001953 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001954 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001955 .type = FIO_OPT_INT,
1956 .off1 = td_var_offset(nr_files),
1957 .help = "Split job workload between this number of files",
1958 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001959 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001960 .category = FIO_OPT_C_FILE,
1961 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001962 },
1963 {
1964 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001965 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001966 .type = FIO_OPT_INT,
1967 .off1 = td_var_offset(open_files),
1968 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001969 .category = FIO_OPT_C_FILE,
1970 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001971 },
1972 {
1973 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001974 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001975 .type = FIO_OPT_STR,
1976 .cb = str_fst_cb,
1977 .off1 = td_var_offset(file_service_type),
1978 .help = "How to select which file to service next",
1979 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001980 .category = FIO_OPT_C_FILE,
1981 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001982 .posval = {
1983 { .ival = "random",
1984 .oval = FIO_FSERVICE_RANDOM,
1985 .help = "Choose a file at random",
1986 },
1987 { .ival = "roundrobin",
1988 .oval = FIO_FSERVICE_RR,
1989 .help = "Round robin select files",
1990 },
Jens Axboea086c252009-03-04 08:27:37 +01001991 { .ival = "sequential",
1992 .oval = FIO_FSERVICE_SEQ,
1993 .help = "Finish one file before moving to the next",
1994 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001995 },
Jens Axboe67a10002007-07-31 23:12:16 +02001996 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001997 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001998 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001999#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002000 {
2001 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002002 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02002003 .type = FIO_OPT_STR,
2004 .off1 = td_var_offset(fallocate_mode),
2005 .help = "Whether pre-allocation is performed when laying out files",
2006 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01002007 .category = FIO_OPT_C_FILE,
2008 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02002009 .posval = {
2010 { .ival = "none",
2011 .oval = FIO_FALLOCATE_NONE,
2012 .help = "Do not pre-allocate space",
2013 },
2014 { .ival = "posix",
2015 .oval = FIO_FALLOCATE_POSIX,
2016 .help = "Use posix_fallocate()",
2017 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002018#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02002019 { .ival = "keep",
2020 .oval = FIO_FALLOCATE_KEEP_SIZE,
2021 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2022 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002023#endif
Eric Gourioua596f042011-06-17 09:11:45 +02002024 /* Compatibility with former boolean values */
2025 { .ival = "0",
2026 .oval = FIO_FALLOCATE_NONE,
2027 .help = "Alias for 'none'",
2028 },
2029 { .ival = "1",
2030 .oval = FIO_FALLOCATE_POSIX,
2031 .help = "Alias for 'posix'",
2032 },
2033 },
2034 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002035#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02002036 {
2037 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002038 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002039 .type = FIO_OPT_BOOL,
2040 .off1 = td_var_offset(fadvise_hint),
2041 .help = "Use fadvise() to advise the kernel on IO pattern",
2042 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002043 .category = FIO_OPT_C_FILE,
2044 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002045 },
2046 {
2047 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002048 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002049 .type = FIO_OPT_INT,
2050 .off1 = td_var_offset(fsync_blocks),
2051 .help = "Issue fsync for writes every given number of blocks",
2052 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002053 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002054 .category = FIO_OPT_C_FILE,
2055 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002056 },
2057 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002058 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002059 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002060 .type = FIO_OPT_INT,
2061 .off1 = td_var_offset(fdatasync_blocks),
2062 .help = "Issue fdatasync for writes every given number of blocks",
2063 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002064 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002065 .category = FIO_OPT_C_FILE,
2066 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002067 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002068 {
2069 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002070 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002071 .type = FIO_OPT_INT,
2072 .off1 = td_var_offset(barrier_blocks),
2073 .help = "Make every Nth write a barrier write",
2074 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002075 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002076 .category = FIO_OPT_C_IO,
2077 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002078 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002079#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002080 {
2081 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002082 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002083 .posval = {
2084 { .ival = "wait_before",
2085 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2086 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002087 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002088 },
2089 { .ival = "write",
2090 .oval = SYNC_FILE_RANGE_WRITE,
2091 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002092 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002093 },
2094 {
2095 .ival = "wait_after",
2096 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2097 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002098 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002099 },
2100 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002101 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002102 .cb = str_sfr_cb,
2103 .off1 = td_var_offset(sync_file_range),
2104 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002105 .category = FIO_OPT_C_FILE,
2106 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002107 },
2108#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002109 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002110 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002111 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002112 .type = FIO_OPT_BOOL,
2113 .off1 = td_var_offset(odirect),
2114 .help = "Use O_DIRECT IO (negates buffered)",
2115 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002116 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002117 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002118 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002119 },
2120 {
Chris Masond01612f2013-11-15 15:52:58 -07002121 .name = "atomic",
2122 .lname = "Atomic I/O",
2123 .type = FIO_OPT_BOOL,
2124 .off1 = td_var_offset(oatomic),
2125 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2126 .def = "0",
2127 .category = FIO_OPT_C_IO,
2128 .group = FIO_OPT_G_IO_TYPE,
2129 },
2130 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002131 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002132 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002133 .type = FIO_OPT_BOOL,
2134 .off1 = td_var_offset(odirect),
2135 .neg = 1,
2136 .help = "Use buffered IO (negates direct)",
2137 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002138 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002139 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002140 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002141 },
2142 {
2143 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002144 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002145 .type = FIO_OPT_BOOL,
2146 .off1 = td_var_offset(overwrite),
2147 .help = "When writing, set whether to overwrite current data",
2148 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002149 .category = FIO_OPT_C_FILE,
2150 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002151 },
2152 {
2153 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002154 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002155 .type = FIO_OPT_INT,
2156 .off1 = td_var_offset(loops),
2157 .help = "Number of times to run the job",
2158 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002159 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002160 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002161 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002162 },
2163 {
2164 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002165 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002166 .type = FIO_OPT_INT,
2167 .off1 = td_var_offset(numjobs),
2168 .help = "Duplicate this job this many times",
2169 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002170 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002171 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002172 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002173 },
2174 {
2175 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002176 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002177 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002178 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002179 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002180 .help = "Only start job when this period has passed",
2181 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002182 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002183 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002184 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002185 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002186 },
2187 {
2188 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002189 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002190 .alias = "timeout",
2191 .type = FIO_OPT_STR_VAL_TIME,
2192 .off1 = td_var_offset(timeout),
2193 .help = "Stop workload when this amount of time has passed",
2194 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002195 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002196 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002197 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002198 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002199 },
2200 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002201 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002202 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002203 .type = FIO_OPT_STR_SET,
2204 .off1 = td_var_offset(time_based),
2205 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002206 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002207 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002208 },
2209 {
Juan Casse62167762013-09-17 14:06:13 -07002210 .name = "verify_only",
2211 .lname = "Verify only",
2212 .type = FIO_OPT_STR_SET,
2213 .off1 = td_var_offset(verify_only),
2214 .help = "Verifies previously written data is still valid",
2215 .category = FIO_OPT_C_GENERAL,
2216 .group = FIO_OPT_G_RUNTIME,
2217 },
2218 {
Jens Axboe721938a2008-09-10 09:46:16 +02002219 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002220 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002221 .type = FIO_OPT_STR_VAL_TIME,
2222 .off1 = td_var_offset(ramp_time),
2223 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002224 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002225 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002226 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002227 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002228 },
2229 {
Jens Axboec223da82010-03-24 13:23:53 +01002230 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002231 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002232 .type = FIO_OPT_STR,
2233 .cb = fio_clock_source_cb,
2234 .off1 = td_var_offset(clocksource),
2235 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002236 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002237 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002238 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002239#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002240 { .ival = "gettimeofday",
2241 .oval = CS_GTOD,
2242 .help = "Use gettimeofday(2) for timing",
2243 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002244#endif
2245#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002246 { .ival = "clock_gettime",
2247 .oval = CS_CGETTIME,
2248 .help = "Use clock_gettime(2) for timing",
2249 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002250#endif
Jens Axboec223da82010-03-24 13:23:53 +01002251#ifdef ARCH_HAVE_CPU_CLOCK
2252 { .ival = "cpu",
2253 .oval = CS_CPUCLOCK,
2254 .help = "Use CPU private clock",
2255 },
2256#endif
2257 },
2258 },
2259 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002260 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002261 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002262 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002263 .type = FIO_OPT_STR,
2264 .cb = str_mem_cb,
2265 .off1 = td_var_offset(mem_type),
2266 .help = "Backing type for IO buffers",
2267 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002268 .category = FIO_OPT_C_IO,
2269 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002270 .posval = {
2271 { .ival = "malloc",
2272 .oval = MEM_MALLOC,
2273 .help = "Use malloc(3) for IO buffers",
2274 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002275#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002276 { .ival = "shm",
2277 .oval = MEM_SHM,
2278 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002279 },
2280#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002281 { .ival = "shmhuge",
2282 .oval = MEM_SHMHUGE,
2283 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002284 },
2285#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002286#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002287 { .ival = "mmap",
2288 .oval = MEM_MMAP,
2289 .help = "Use mmap(2) (file or anon) for IO buffers",
2290 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002291#ifdef FIO_HAVE_HUGETLB
2292 { .ival = "mmaphuge",
2293 .oval = MEM_MMAPHUGE,
2294 .help = "Like mmap, but use huge pages",
2295 },
2296#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002297 },
2298 },
2299 {
Jens Axboed529ee12009-07-01 10:33:03 +02002300 .name = "iomem_align",
2301 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002302 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002303 .type = FIO_OPT_INT,
2304 .off1 = td_var_offset(mem_align),
2305 .minval = 0,
2306 .help = "IO memory buffer offset alignment",
2307 .def = "0",
2308 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002309 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002310 .category = FIO_OPT_C_IO,
2311 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002312 },
2313 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002314 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002315 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002316 .type = FIO_OPT_STR,
2317 .off1 = td_var_offset(verify),
2318 .help = "Verify data written",
2319 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002320 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002321 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002322 .posval = {
2323 { .ival = "0",
2324 .oval = VERIFY_NONE,
2325 .help = "Don't do IO verification",
2326 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002327 { .ival = "md5",
2328 .oval = VERIFY_MD5,
2329 .help = "Use md5 checksums for verification",
2330 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002331 { .ival = "crc64",
2332 .oval = VERIFY_CRC64,
2333 .help = "Use crc64 checksums for verification",
2334 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002335 { .ival = "crc32",
2336 .oval = VERIFY_CRC32,
2337 .help = "Use crc32 checksums for verification",
2338 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002339 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002340 .oval = VERIFY_CRC32C,
2341 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002342 },
Jens Axboebac39e02008-06-11 20:46:19 +02002343 { .ival = "crc32c",
2344 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002345 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002346 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002347 { .ival = "crc16",
2348 .oval = VERIFY_CRC16,
2349 .help = "Use crc16 checksums for verification",
2350 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002351 { .ival = "crc7",
2352 .oval = VERIFY_CRC7,
2353 .help = "Use crc7 checksums for verification",
2354 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002355 { .ival = "sha1",
2356 .oval = VERIFY_SHA1,
2357 .help = "Use sha1 checksums for verification",
2358 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002359 { .ival = "sha256",
2360 .oval = VERIFY_SHA256,
2361 .help = "Use sha256 checksums for verification",
2362 },
2363 { .ival = "sha512",
2364 .oval = VERIFY_SHA512,
2365 .help = "Use sha512 checksums for verification",
2366 },
Jens Axboe844ea602014-02-20 13:21:45 -08002367 { .ival = "xxhash",
2368 .oval = VERIFY_XXHASH,
2369 .help = "Use xxhash checksums for verification",
2370 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002371 { .ival = "meta",
2372 .oval = VERIFY_META,
2373 .help = "Use io information",
2374 },
Jens Axboe36690c92007-03-26 10:23:34 +02002375 {
2376 .ival = "null",
2377 .oval = VERIFY_NULL,
2378 .help = "Pretend to verify",
2379 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002380 },
2381 },
2382 {
Jens Axboe005c5652007-08-02 22:21:36 +02002383 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002384 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002385 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002386 .off1 = td_var_offset(do_verify),
2387 .help = "Run verification stage after write",
2388 .def = "1",
2389 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002390 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002391 .category = FIO_OPT_C_IO,
2392 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002393 },
2394 {
Jens Axboe160b9662007-03-27 10:59:49 +02002395 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002396 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002397 .type = FIO_OPT_BOOL,
2398 .off1 = td_var_offset(verifysort),
2399 .help = "Sort written verify blocks for read back",
2400 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002401 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002402 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002403 .category = FIO_OPT_C_IO,
2404 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002405 },
2406 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002407 .name = "verifysort_nr",
2408 .type = FIO_OPT_INT,
2409 .off1 = td_var_offset(verifysort_nr),
2410 .help = "Pre-load and sort verify blocks for a read workload",
2411 .minval = 0,
2412 .maxval = 131072,
2413 .def = "1024",
2414 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002417 },
2418 {
Jens Axboea59e1702007-07-30 08:53:27 +02002419 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002420 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002421 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002422 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002423 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002424 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002425 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002426 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002427 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002428 .category = FIO_OPT_C_IO,
2429 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002430 },
2431 {
Jens Axboea59e1702007-07-30 08:53:27 +02002432 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002433 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002434 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002435 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002436 .off1 = td_var_offset(verify_offset),
2437 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002438 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002439 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002440 .category = FIO_OPT_C_IO,
2441 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002442 },
2443 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002444 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002445 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002446 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002447 .cb = str_verify_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002448 .off1 = td_var_offset(verify_pattern),
Shawn Lewise28218f2008-01-16 11:01:33 +01002449 .help = "Fill pattern for IO buffers",
2450 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002451 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002454 },
2455 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002456 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002457 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002458 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002459 .off1 = td_var_offset(verify_fatal),
2460 .def = "0",
2461 .help = "Exit on a single verify failure, don't continue",
2462 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002463 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002464 .category = FIO_OPT_C_IO,
2465 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002466 },
2467 {
Jens Axboeb463e932011-01-12 09:03:23 +01002468 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002469 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002470 .type = FIO_OPT_BOOL,
2471 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002472 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002473 .help = "Dump contents of good and bad blocks on failure",
2474 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002475 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002476 .category = FIO_OPT_C_IO,
2477 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002478 },
2479 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002480 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002481 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002482 .type = FIO_OPT_INT,
2483 .off1 = td_var_offset(verify_async),
2484 .def = "0",
2485 .help = "Number of async verifier threads to use",
2486 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002487 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002488 .category = FIO_OPT_C_IO,
2489 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002490 },
Jens Axboe9e144182010-06-15 14:25:36 +02002491 {
2492 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002493 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002494 .type = FIO_OPT_STR_VAL,
2495 .off1 = td_var_offset(verify_backlog),
2496 .help = "Verify after this number of blocks are written",
2497 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002498 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002499 .category = FIO_OPT_C_IO,
2500 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002501 },
2502 {
2503 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002504 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002505 .type = FIO_OPT_INT,
2506 .off1 = td_var_offset(verify_batch),
2507 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002508 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002509 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002510 .category = FIO_OPT_C_IO,
2511 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002512 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002513#ifdef FIO_HAVE_CPU_AFFINITY
2514 {
2515 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002516 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002517 .type = FIO_OPT_STR,
2518 .cb = str_verify_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002519 .off1 = td_var_offset(verify_cpumask),
Jens Axboee8462bd2009-07-06 12:59:04 +02002520 .help = "Set CPUs allowed for async verify threads",
2521 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002522 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002523 .category = FIO_OPT_C_IO,
2524 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002525 },
2526#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002527 {
2528 .name = "experimental_verify",
2529 .off1 = td_var_offset(experimental_verify),
2530 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002531 .help = "Enable experimental verification",
Jens Axboede54cfd2014-11-10 20:34:00 -07002532 .parent = "verify",
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_VERIFY,
2535 },
2536 {
2537 .name = "verify_state_load",
2538 .lname = "Load verify state",
2539 .off1 = td_var_offset(verify_state),
2540 .type = FIO_OPT_BOOL,
2541 .help = "Load verify termination state",
2542 .parent = "verify",
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_VERIFY,
2545 },
2546 {
2547 .name = "verify_state_save",
2548 .lname = "Save verify state",
2549 .off1 = td_var_offset(verify_state_save),
2550 .type = FIO_OPT_BOOL,
2551 .def = "1",
2552 .help = "Save verify state on termination",
2553 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002554 .category = FIO_OPT_C_IO,
2555 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002556 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002557#ifdef FIO_HAVE_TRIM
2558 {
2559 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002560 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002561 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002562 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002563 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002564 .maxval = 100,
2565 .help = "Number of verify blocks to discard/trim",
2566 .parent = "verify",
2567 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002568 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002569 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002570 .category = FIO_OPT_C_IO,
2571 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002572 },
2573 {
2574 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002575 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002576 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002577 .help = "Verify that trim/discarded blocks are returned as zeroes",
2578 .off1 = td_var_offset(trim_zero),
2579 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002580 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002581 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002582 .category = FIO_OPT_C_IO,
2583 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002584 },
2585 {
2586 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002587 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002588 .type = FIO_OPT_STR_VAL,
2589 .off1 = td_var_offset(trim_backlog),
2590 .help = "Trim after this number of blocks are written",
2591 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002592 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002593 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002594 .category = FIO_OPT_C_IO,
2595 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002596 },
2597 {
2598 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002599 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002600 .type = FIO_OPT_INT,
2601 .off1 = td_var_offset(trim_batch),
2602 .help = "Trim this number of IO blocks",
2603 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002604 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002605 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002606 .category = FIO_OPT_C_IO,
2607 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002608 },
2609#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002610 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002611 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002612 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002613 .type = FIO_OPT_STR_STORE,
2614 .off1 = td_var_offset(write_iolog_file),
2615 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002616 .category = FIO_OPT_C_IO,
2617 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002618 },
2619 {
2620 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002621 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002622 .type = FIO_OPT_STR_STORE,
2623 .off1 = td_var_offset(read_iolog_file),
2624 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002625 .category = FIO_OPT_C_IO,
2626 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002627 },
2628 {
David Nellans64bbb862010-08-24 22:13:30 +02002629 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002630 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002631 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002632 .off1 = td_var_offset(no_stall),
2633 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002634 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002635 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002636 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002637 .category = FIO_OPT_C_IO,
2638 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002639 },
2640 {
David Nellansd1c46c02010-08-31 21:20:47 +02002641 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002642 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002643 .type = FIO_OPT_STR_STORE,
2644 .off1 = td_var_offset(replay_redirect),
2645 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002646 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002647 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002648 .category = FIO_OPT_C_IO,
2649 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002650 },
2651 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002652 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002653 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002654 .type = FIO_OPT_STR_STORE,
2655 .off1 = td_var_offset(exec_prerun),
2656 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002657 .category = FIO_OPT_C_GENERAL,
2658 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002659 },
2660 {
2661 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002662 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002663 .type = FIO_OPT_STR_STORE,
2664 .off1 = td_var_offset(exec_postrun),
2665 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002666 .category = FIO_OPT_C_GENERAL,
2667 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002668 },
2669#ifdef FIO_HAVE_IOSCHED_SWITCH
2670 {
2671 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002672 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002673 .type = FIO_OPT_STR_STORE,
2674 .off1 = td_var_offset(ioscheduler),
2675 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002676 .category = FIO_OPT_C_FILE,
2677 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002678 },
2679#endif
2680 {
2681 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002682 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002683 .type = FIO_OPT_STR_VAL,
2684 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002685 .help = "Amount of data to read per zone",
2686 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002687 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002688 .category = FIO_OPT_C_IO,
2689 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002690 },
2691 {
2692 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002693 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002694 .type = FIO_OPT_STR_VAL,
2695 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002696 .help = "Give size of an IO zone",
2697 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002698 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002699 .category = FIO_OPT_C_IO,
2700 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002701 },
2702 {
2703 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002704 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002705 .type = FIO_OPT_STR_VAL,
2706 .off1 = td_var_offset(zone_skip),
2707 .help = "Space between IO zones",
2708 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002709 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002712 },
2713 {
2714 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002715 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002716 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002717 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002718 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002719 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002720 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002721 .category = FIO_OPT_C_GENERAL,
2722 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002723 },
2724 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002725 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002726 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002727 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002728 .cb = str_rwmix_read_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002729 .off1 = td_var_offset(rwmix[DDIR_READ]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002730 .maxval = 100,
2731 .help = "Percentage of mixed workload that is reads",
2732 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002733 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002734 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002735 .category = FIO_OPT_C_IO,
2736 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002737 },
2738 {
2739 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002740 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002741 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002742 .cb = str_rwmix_write_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002743 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002744 .maxval = 100,
2745 .help = "Percentage of mixed workload that is writes",
2746 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002747 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002748 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002749 .category = FIO_OPT_C_IO,
2750 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002751 },
2752 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002753 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002754 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002755 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002756 .category = FIO_OPT_C_IO,
2757 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002758 },
2759 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002760 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002761 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002762 .type = FIO_OPT_INT,
2763 .off1 = td_var_offset(nice),
2764 .help = "Set job CPU nice value",
2765 .minval = -19,
2766 .maxval = 20,
2767 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002768 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002769 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002770 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002771 },
2772#ifdef FIO_HAVE_IOPRIO
2773 {
2774 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002775 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002776 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002777 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002778 .help = "Set job IO priority value",
2779 .minval = 0,
2780 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002781 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002782 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002783 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002784 },
2785 {
2786 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002787 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002788 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002789 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002790 .help = "Set job IO priority class",
2791 .minval = 0,
2792 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002793 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002794 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002795 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002796 },
2797#endif
2798 {
2799 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002800 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002801 .type = FIO_OPT_INT,
2802 .off1 = td_var_offset(thinktime),
2803 .help = "Idle time between IO buffers (usec)",
2804 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002805 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002807 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002808 },
2809 {
2810 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002811 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002812 .type = FIO_OPT_INT,
2813 .off1 = td_var_offset(thinktime_spin),
2814 .help = "Start think time by spinning this amount (usec)",
2815 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002816 .is_time = 1,
Jens Axboeafdf9352007-07-31 16:14:34 +02002817 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002818 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002819 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002820 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002821 },
2822 {
2823 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002824 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002825 .type = FIO_OPT_INT,
2826 .off1 = td_var_offset(thinktime_blocks),
2827 .help = "IO buffer period between 'thinktime'",
2828 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002829 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002830 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002831 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002832 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002833 },
2834 {
2835 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002836 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002837 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002838 .off1 = td_var_offset(rate[DDIR_READ]),
2839 .off2 = td_var_offset(rate[DDIR_WRITE]),
2840 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002841 .help = "Set bandwidth rate",
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 = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002847 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002848 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002849 .off1 = td_var_offset(ratemin[DDIR_READ]),
2850 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2851 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002852 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002853 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002854 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002855 .category = FIO_OPT_C_IO,
2856 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002857 },
2858 {
2859 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002860 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002861 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002862 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2863 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2864 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002865 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002866 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002867 .category = FIO_OPT_C_IO,
2868 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002869 },
2870 {
2871 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002872 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002873 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002874 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2875 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2876 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002877 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002878 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002879 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002880 .category = FIO_OPT_C_IO,
2881 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002882 },
2883 {
2884 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002885 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002886 .type = FIO_OPT_INT,
2887 .off1 = td_var_offset(ratecycle),
2888 .help = "Window average for rate limits (msec)",
2889 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002890 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002891 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002892 .category = FIO_OPT_C_IO,
2893 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002894 },
2895 {
Jens Axboe15501532012-10-24 16:37:45 +02002896 .name = "max_latency",
2897 .type = FIO_OPT_INT,
2898 .off1 = td_var_offset(max_latency),
2899 .help = "Maximum tolerated IO latency (usec)",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002900 .is_time = 1,
Jens Axboe1e5324e2012-11-14 14:25:31 -07002901 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002902 .group = FIO_OPT_G_LATPROF,
2903 },
2904 {
2905 .name = "latency_target",
2906 .lname = "Latency Target (usec)",
2907 .type = FIO_OPT_STR_VAL_TIME,
2908 .off1 = td_var_offset(latency_target),
2909 .help = "Ramp to max queue depth supporting this latency",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002910 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002911 .category = FIO_OPT_C_IO,
2912 .group = FIO_OPT_G_LATPROF,
2913 },
2914 {
2915 .name = "latency_window",
2916 .lname = "Latency Window (usec)",
2917 .type = FIO_OPT_STR_VAL_TIME,
2918 .off1 = td_var_offset(latency_window),
2919 .help = "Time to sustain latency_target",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002920 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002921 .category = FIO_OPT_C_IO,
2922 .group = FIO_OPT_G_LATPROF,
2923 },
2924 {
2925 .name = "latency_percentile",
2926 .lname = "Latency Percentile",
2927 .type = FIO_OPT_FLOAT_LIST,
2928 .off1 = td_var_offset(latency_percentile),
2929 .help = "Percentile of IOs must be below latency_target",
2930 .def = "100",
2931 .maxlen = 1,
2932 .minfp = 0.0,
2933 .maxfp = 100.0,
2934 .category = FIO_OPT_C_IO,
2935 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002936 },
2937 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002938 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002939 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002940 .type = FIO_OPT_BOOL,
2941 .off1 = td_var_offset(invalidate_cache),
2942 .help = "Invalidate buffer/page cache prior to running job",
2943 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002944 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002945 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002946 },
2947 {
2948 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002949 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002950 .type = FIO_OPT_BOOL,
2951 .off1 = td_var_offset(sync_io),
2952 .help = "Use O_SYNC for buffered writes",
2953 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002954 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002955 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002956 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002957 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002958 },
2959 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002960 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002961 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002962 .type = FIO_OPT_BOOL,
2963 .off1 = td_var_offset(create_serialize),
2964 .help = "Serialize creating of job files",
2965 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .category = FIO_OPT_C_FILE,
2967 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002968 },
2969 {
2970 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002971 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002972 .type = FIO_OPT_BOOL,
2973 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002974 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002975 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002976 .category = FIO_OPT_C_FILE,
2977 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002978 },
2979 {
Jens Axboe814452b2009-03-04 12:53:13 +01002980 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002981 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002982 .type = FIO_OPT_BOOL,
2983 .off1 = td_var_offset(create_on_open),
2984 .help = "Create files when they are opened for IO",
2985 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002986 .category = FIO_OPT_C_FILE,
2987 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002988 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002989 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002990 .name = "create_only",
2991 .type = FIO_OPT_BOOL,
2992 .off1 = td_var_offset(create_only),
2993 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002994 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002995 .def = "0",
2996 },
2997 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002998 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002999 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02003000 .type = FIO_OPT_BOOL,
3001 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01003002 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02003003 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003004 .category = FIO_OPT_C_FILE,
3005 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02003006 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003007#ifdef FIO_HAVE_CPU_AFFINITY
3008 {
3009 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01003010 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003011 .type = FIO_OPT_INT,
3012 .cb = str_cpumask_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003013 .off1 = td_var_offset(cpumask),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003014 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01003015 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003016 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003017 },
Jens Axboed2e268b2007-06-15 10:33:49 +02003018 {
3019 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01003020 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02003021 .type = FIO_OPT_STR,
3022 .cb = str_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003023 .off1 = td_var_offset(cpumask),
Jens Axboed2e268b2007-06-15 10:33:49 +02003024 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01003025 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003026 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02003027 },
Jens Axboec2acfba2014-02-27 15:52:02 -08003028 {
3029 .name = "cpus_allowed_policy",
3030 .lname = "CPUs allowed distribution policy",
3031 .type = FIO_OPT_STR,
3032 .off1 = td_var_offset(cpus_allowed_policy),
3033 .help = "Distribution policy for cpus_allowed",
3034 .parent = "cpus_allowed",
3035 .prio = 1,
3036 .posval = {
3037 { .ival = "shared",
3038 .oval = FIO_CPUS_SHARED,
3039 .help = "Mask shared between threads",
3040 },
3041 { .ival = "split",
3042 .oval = FIO_CPUS_SPLIT,
3043 .help = "Mask split between threads",
3044 },
3045 },
3046 .category = FIO_OPT_C_GENERAL,
3047 .group = FIO_OPT_G_CRED,
3048 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003049#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003050#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003051 {
3052 .name = "numa_cpu_nodes",
3053 .type = FIO_OPT_STR,
3054 .cb = str_numa_cpunodes_cb,
3055 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003056 .category = FIO_OPT_C_GENERAL,
3057 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003058 },
3059 {
3060 .name = "numa_mem_policy",
3061 .type = FIO_OPT_STR,
3062 .cb = str_numa_mpol_cb,
3063 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003064 .category = FIO_OPT_C_GENERAL,
3065 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003066 },
3067#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003068 {
3069 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003070 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003071 .type = FIO_OPT_BOOL,
3072 .off1 = td_var_offset(end_fsync),
3073 .help = "Include fsync at the end of job",
3074 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003075 .category = FIO_OPT_C_FILE,
3076 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003077 },
3078 {
3079 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003080 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003081 .type = FIO_OPT_BOOL,
3082 .off1 = td_var_offset(fsync_on_close),
3083 .help = "fsync files on close",
3084 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003085 .category = FIO_OPT_C_FILE,
3086 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003087 },
3088 {
3089 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003090 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003091 .type = FIO_OPT_BOOL,
3092 .off1 = td_var_offset(unlink),
3093 .help = "Unlink created files after job has completed",
3094 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003095 .category = FIO_OPT_C_FILE,
3096 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003097 },
3098 {
3099 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003100 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003101 .type = FIO_OPT_STR_SET,
3102 .cb = str_exitall_cb,
3103 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003104 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003105 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003106 },
3107 {
3108 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003109 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003110 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003111 .type = FIO_OPT_STR_SET,
3112 .off1 = td_var_offset(stonewall),
3113 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003114 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003115 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003116 },
3117 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003118 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003119 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003120 .type = FIO_OPT_STR_SET,
3121 .off1 = td_var_offset(new_group),
3122 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003123 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003124 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003125 },
3126 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003127 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003128 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003129 .type = FIO_OPT_STR_SET,
3130 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003131 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003132#ifdef CONFIG_NO_SHM
3133 .def = "1",
3134 .no_warn_def = 1,
3135#endif
Jens Axboee8b0e952012-03-19 14:37:08 +01003136 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003137 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003138 },
3139 {
3140 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003141 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003142 .type = FIO_OPT_STR_STORE,
3143 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003144 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003145 .category = FIO_OPT_C_LOG,
3146 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003147 },
3148 {
3149 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003150 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003151 .type = FIO_OPT_STR_STORE,
3152 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003153 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003154 .category = FIO_OPT_C_LOG,
3155 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003156 },
3157 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003158 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003159 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003160 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003161 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003162 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003163 .category = FIO_OPT_C_LOG,
3164 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003165 },
3166 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003167 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003168 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003169 .type = FIO_OPT_INT,
3170 .off1 = td_var_offset(log_avg_msec),
3171 .help = "Average bw/iops/lat logs over this period of time",
3172 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003173 .category = FIO_OPT_C_LOG,
3174 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003175 },
3176 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003177 .name = "log_offset",
3178 .lname = "Log offset of IO",
3179 .type = FIO_OPT_BOOL,
3180 .off1 = td_var_offset(log_offset),
3181 .help = "Include offset of IO for each log entry",
3182 .def = "0",
3183 .category = FIO_OPT_C_LOG,
3184 .group = FIO_OPT_G_INVALID,
3185 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003186#ifdef CONFIG_ZLIB
3187 {
3188 .name = "log_compression",
3189 .lname = "Log compression",
3190 .type = FIO_OPT_INT,
3191 .off1 = td_var_offset(log_gz),
3192 .help = "Log in compressed chunks of this size",
3193 .minval = 32 * 1024 * 1024ULL,
3194 .maxval = 512 * 1024 * 1024ULL,
3195 .category = FIO_OPT_C_LOG,
3196 .group = FIO_OPT_G_INVALID,
3197 },
Jens Axboebac4af12014-07-03 13:42:28 -06003198 {
3199 .name = "log_store_compressed",
3200 .lname = "Log store compressed",
3201 .type = FIO_OPT_BOOL,
3202 .off1 = td_var_offset(log_gz_store),
3203 .help = "Store logs in a compressed format",
3204 .category = FIO_OPT_C_LOG,
3205 .group = FIO_OPT_G_INVALID,
3206 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003207#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003208 {
Jens Axboec504ee52012-03-20 11:29:09 +01003209 .name = "bwavgtime",
3210 .lname = "Bandwidth average time",
3211 .type = FIO_OPT_INT,
3212 .off1 = td_var_offset(bw_avg_time),
3213 .help = "Time window over which to calculate bandwidth"
3214 " (msec)",
3215 .def = "500",
3216 .parent = "write_bw_log",
3217 .hide = 1,
3218 .interval = 100,
3219 .category = FIO_OPT_C_LOG,
3220 .group = FIO_OPT_G_INVALID,
3221 },
3222 {
3223 .name = "iopsavgtime",
3224 .lname = "IOPS average time",
3225 .type = FIO_OPT_INT,
3226 .off1 = td_var_offset(iops_avg_time),
3227 .help = "Time window over which to calculate IOPS (msec)",
3228 .def = "500",
3229 .parent = "write_iops_log",
3230 .hide = 1,
3231 .interval = 100,
3232 .category = FIO_OPT_C_LOG,
3233 .group = FIO_OPT_G_INVALID,
3234 },
3235 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003236 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003237 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003238 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003239 .off1 = td_var_offset(group_reporting),
3240 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003241 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003242 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003243 },
3244 {
Jens Axboee9459e52007-04-17 15:46:32 +02003245 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003246 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003247 .type = FIO_OPT_STR_SET,
3248 .off1 = td_var_offset(zero_buffers),
3249 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003250 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003251 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003252 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003253 {
3254 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003255 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003256 .type = FIO_OPT_STR_SET,
3257 .off1 = td_var_offset(refill_buffers),
3258 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003259 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003260 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003261 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003262 {
Jens Axboefd684182011-09-19 09:24:44 +02003263 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003264 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003265 .type = FIO_OPT_BOOL,
3266 .off1 = td_var_offset(scramble_buffers),
3267 .help = "Slightly scramble buffers on every IO submit",
3268 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003269 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003270 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003271 },
3272 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003273 .name = "buffer_pattern",
3274 .lname = "Buffer pattern",
3275 .type = FIO_OPT_STR,
3276 .cb = str_buffer_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003277 .off1 = td_var_offset(buffer_pattern),
Jens Axboece35b1e2014-01-14 15:35:58 -07003278 .help = "Fill pattern for IO buffers",
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_IO_BUF,
3281 },
3282 {
Jens Axboe9c426842012-03-02 21:02:12 +01003283 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003284 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003285 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003286 .cb = str_buffer_compress_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003287 .off1 = td_var_offset(compress_percentage),
Jens Axboe9c426842012-03-02 21:02:12 +01003288 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003289 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003290 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003291 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003292 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003293 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003294 },
3295 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003296 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003297 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003298 .type = FIO_OPT_INT,
3299 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003300 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003301 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003302 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003303 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003304 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003305 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003306 },
3307 {
Jens Axboee66dac22014-09-22 10:02:07 -06003308 .name = "dedupe_percentage",
3309 .lname = "Dedupe percentage",
3310 .type = FIO_OPT_INT,
3311 .cb = str_dedupe_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003312 .off1 = td_var_offset(dedupe_percentage),
Jens Axboee66dac22014-09-22 10:02:07 -06003313 .maxval = 100,
3314 .minval = 0,
3315 .help = "Percentage of buffers that are dedupable",
3316 .interval = 1,
3317 .category = FIO_OPT_C_IO,
3318 .group = FIO_OPT_G_IO_BUF,
3319 },
3320 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003321 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003322 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003323 .type = FIO_OPT_BOOL,
3324 .off1 = td_var_offset(clat_percentiles),
3325 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003326 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003327 .category = FIO_OPT_C_STAT,
3328 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003329 },
3330 {
3331 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003332 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003333 .type = FIO_OPT_FLOAT_LIST,
3334 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003335 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003336 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003337 .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 +02003338 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3339 .minfp = 0.0,
3340 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003341 .category = FIO_OPT_C_STAT,
3342 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003343 },
3344
Jens Axboe0a839f32007-04-26 09:02:34 +02003345#ifdef FIO_HAVE_DISK_UTIL
3346 {
3347 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003348 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003349 .type = FIO_OPT_BOOL,
3350 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003351 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003352 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003353 .category = FIO_OPT_C_STAT,
3354 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003355 },
3356#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003357 {
Jens Axboe993bf482008-11-14 13:04:53 +01003358 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003359 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003360 .type = FIO_OPT_BOOL,
3361 .help = "Greatly reduce number of gettimeofday() calls",
3362 .cb = str_gtod_reduce_cb,
3363 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003364 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003365 .category = FIO_OPT_C_STAT,
3366 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003367 },
3368 {
Jens Axboe02af0982010-06-24 09:59:34 +02003369 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003370 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003371 .type = FIO_OPT_BOOL,
3372 .off1 = td_var_offset(disable_lat),
3373 .help = "Disable latency numbers",
3374 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003375 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003376 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003377 .category = FIO_OPT_C_STAT,
3378 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003379 },
3380 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003381 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003382 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003383 .type = FIO_OPT_BOOL,
3384 .off1 = td_var_offset(disable_clat),
3385 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003386 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003387 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003388 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003389 .category = FIO_OPT_C_STAT,
3390 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003391 },
3392 {
3393 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003394 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003395 .type = FIO_OPT_BOOL,
3396 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003397 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003398 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003399 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003400 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003401 .category = FIO_OPT_C_STAT,
3402 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003403 },
3404 {
3405 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003406 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003407 .type = FIO_OPT_BOOL,
3408 .off1 = td_var_offset(disable_bw),
3409 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003410 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003411 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003412 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003413 .category = FIO_OPT_C_STAT,
3414 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003415 },
3416 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003417 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003418 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003419 .type = FIO_OPT_INT,
3420 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003421 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003422 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003423 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003424 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003425 },
3426 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003427 .name = "unified_rw_reporting",
3428 .type = FIO_OPT_BOOL,
3429 .off1 = td_var_offset(unified_rw_rep),
3430 .help = "Unify reporting across data direction",
3431 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003432 .category = FIO_OPT_C_GENERAL,
3433 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003434 },
3435 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003436 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003437 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003438 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003439 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003440 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003441 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003442 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003443 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003444 .posval = {
3445 { .ival = "none",
3446 .oval = ERROR_TYPE_NONE,
3447 .help = "Exit when an error is encountered",
3448 },
3449 { .ival = "read",
3450 .oval = ERROR_TYPE_READ,
3451 .help = "Continue on read errors only",
3452 },
3453 { .ival = "write",
3454 .oval = ERROR_TYPE_WRITE,
3455 .help = "Continue on write errors only",
3456 },
3457 { .ival = "io",
3458 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3459 .help = "Continue on any IO errors",
3460 },
3461 { .ival = "verify",
3462 .oval = ERROR_TYPE_VERIFY,
3463 .help = "Continue on verify errors only",
3464 },
3465 { .ival = "all",
3466 .oval = ERROR_TYPE_ANY,
3467 .help = "Continue on all io and verify errors",
3468 },
3469 { .ival = "0",
3470 .oval = ERROR_TYPE_NONE,
3471 .help = "Alias for 'none'",
3472 },
3473 { .ival = "1",
3474 .oval = ERROR_TYPE_ANY,
3475 .help = "Alias for 'all'",
3476 },
3477 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003478 },
3479 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003480 .name = "ignore_error",
3481 .type = FIO_OPT_STR,
3482 .cb = str_ignore_error_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003483 .off1 = td_var_offset(ignore_error_nr),
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003484 .help = "Set a specific list of errors to ignore",
3485 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003486 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003487 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003488 },
3489 {
3490 .name = "error_dump",
3491 .type = FIO_OPT_BOOL,
3492 .off1 = td_var_offset(error_dump),
3493 .def = "0",
3494 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003495 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003496 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003497 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003498 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003499 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003500 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003501 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003502 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003503 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003504 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003505 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003506 },
3507 {
Jens Axboea696fa22009-12-04 10:05:02 +01003508 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003509 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003510 .type = FIO_OPT_STR_STORE,
3511 .off1 = td_var_offset(cgroup),
3512 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003513 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003514 .group = FIO_OPT_G_CGROUP,
3515 },
3516 {
3517 .name = "cgroup_nodelete",
3518 .lname = "Cgroup no-delete",
3519 .type = FIO_OPT_BOOL,
3520 .off1 = td_var_offset(cgroup_nodelete),
3521 .help = "Do not delete cgroups after job completion",
3522 .def = "0",
3523 .parent = "cgroup",
3524 .category = FIO_OPT_C_GENERAL,
3525 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003526 },
3527 {
3528 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003529 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003530 .type = FIO_OPT_INT,
3531 .off1 = td_var_offset(cgroup_weight),
3532 .help = "Use given weight for cgroup",
3533 .minval = 100,
3534 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003535 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003536 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003537 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003538 },
3539 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003540 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003541 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003542 .type = FIO_OPT_INT,
3543 .off1 = td_var_offset(uid),
3544 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003545 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003546 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003547 },
3548 {
3549 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003550 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003551 .type = FIO_OPT_INT,
3552 .off1 = td_var_offset(gid),
3553 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003554 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003555 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003556 },
3557 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003558 .name = "kb_base",
3559 .lname = "KB Base",
3560 .type = FIO_OPT_INT,
3561 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003562 .prio = 1,
3563 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003564 .posval = {
3565 { .ival = "1024",
3566 .oval = 1024,
3567 .help = "Use 1024 as the K base",
3568 },
3569 { .ival = "1000",
3570 .oval = 1000,
3571 .help = "Use 1000 as the K base",
3572 },
3573 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003574 .help = "How many bytes per KB for reporting (1000 or 1024)",
3575 .category = FIO_OPT_C_GENERAL,
3576 .group = FIO_OPT_G_INVALID,
3577 },
3578 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003579 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003580 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003581 .type = FIO_OPT_INT,
3582 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003583 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003584 .posval = {
3585 { .ival = "0",
3586 .oval = 0,
3587 .help = "Auto-detect",
3588 },
3589 { .ival = "8",
3590 .oval = 8,
3591 .help = "Normal (byte based)",
3592 },
3593 { .ival = "1",
3594 .oval = 1,
3595 .help = "Bit based",
3596 },
3597 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003598 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3599 .category = FIO_OPT_C_GENERAL,
3600 .group = FIO_OPT_G_INVALID,
3601 },
3602 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003603 .name = "hugepage-size",
3604 .lname = "Hugepage size",
3605 .type = FIO_OPT_INT,
3606 .off1 = td_var_offset(hugepage_size),
3607 .help = "When using hugepages, specify size of each page",
3608 .def = __fio_stringify(FIO_HUGE_PAGE),
3609 .interval = 1024 * 1024,
3610 .category = FIO_OPT_C_GENERAL,
3611 .group = FIO_OPT_G_INVALID,
3612 },
3613 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003614 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003615 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003616 .type = FIO_OPT_INT,
3617 .off1 = td_var_offset(flow_id),
3618 .help = "The flow index ID to use",
3619 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003620 .category = FIO_OPT_C_IO,
3621 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003622 },
3623 {
3624 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003625 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003626 .type = FIO_OPT_INT,
3627 .off1 = td_var_offset(flow),
3628 .help = "Weight for flow control of this job",
3629 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003630 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003631 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003632 .category = FIO_OPT_C_IO,
3633 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003634 },
3635 {
3636 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003637 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003638 .type = FIO_OPT_INT,
3639 .off1 = td_var_offset(flow_watermark),
3640 .help = "High watermark for flow control. This option"
3641 " should be set to the same value for all threads"
3642 " with non-zero flow.",
3643 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003644 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003645 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003646 .category = FIO_OPT_C_IO,
3647 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003648 },
3649 {
3650 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003651 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003652 .type = FIO_OPT_INT,
3653 .off1 = td_var_offset(flow_sleep),
3654 .help = "How many microseconds to sleep after being held"
3655 " back by the flow control mechanism",
3656 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003657 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003658 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003659 .category = FIO_OPT_C_IO,
3660 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003661 },
3662 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003663 .name = NULL,
3664 },
3665};
3666
Jens Axboe17af15d2010-04-13 10:38:16 +02003667static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003668 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003669{
Jens Axboe17af15d2010-04-13 10:38:16 +02003670 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003671 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003672 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003673 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003674 else
3675 lopt->has_arg = required_argument;
3676}
3677
Steven Langde890a12011-11-09 14:03:34 +01003678static void options_to_lopts(struct fio_option *opts,
3679 struct option *long_options,
3680 int i, int option_type)
3681{
3682 struct fio_option *o = &opts[0];
3683 while (o->name) {
3684 add_to_lopt(&long_options[i], o, o->name, option_type);
3685 if (o->alias) {
3686 i++;
3687 add_to_lopt(&long_options[i], o, o->alias, option_type);
3688 }
3689
3690 i++;
3691 o++;
3692 assert(i < FIO_NR_OPTIONS);
3693 }
3694}
3695
3696void fio_options_set_ioengine_opts(struct option *long_options,
3697 struct thread_data *td)
3698{
3699 unsigned int i;
3700
3701 i = 0;
3702 while (long_options[i].name) {
3703 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3704 memset(&long_options[i], 0, sizeof(*long_options));
3705 break;
3706 }
3707 i++;
3708 }
3709
3710 /*
3711 * Just clear out the prior ioengine options.
3712 */
3713 if (!td || !td->eo)
3714 return;
3715
3716 options_to_lopts(td->io_ops->options, long_options, i,
3717 FIO_GETOPT_IOENGINE);
3718}
3719
Jens Axboe214e1ec2007-03-15 10:48:13 +01003720void fio_options_dup_and_init(struct option *long_options)
3721{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003722 unsigned int i;
3723
Jens Axboe9af4a242012-03-16 10:13:49 +01003724 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003725
3726 i = 0;
3727 while (long_options[i].name)
3728 i++;
3729
Jens Axboe9af4a242012-03-16 10:13:49 +01003730 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003731}
3732
Jens Axboe74929ac2009-08-05 11:42:37 +02003733struct fio_keyword {
3734 const char *word;
3735 const char *desc;
3736 char *replace;
3737};
3738
3739static struct fio_keyword fio_keywords[] = {
3740 {
3741 .word = "$pagesize",
3742 .desc = "Page size in the system",
3743 },
3744 {
3745 .word = "$mb_memory",
3746 .desc = "Megabytes of memory online",
3747 },
3748 {
3749 .word = "$ncpus",
3750 .desc = "Number of CPUs online in the system",
3751 },
3752 {
3753 .word = NULL,
3754 },
3755};
3756
3757void fio_keywords_init(void)
3758{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003759 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003760 char buf[128];
3761 long l;
3762
Jens Axboea4cfc472012-10-09 10:30:48 -06003763 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003764 fio_keywords[0].replace = strdup(buf);
3765
Jens Axboe8eb016d2011-07-11 10:24:20 +02003766 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003767 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003768 fio_keywords[1].replace = strdup(buf);
3769
Jens Axboec00a2282011-07-08 20:56:06 +02003770 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003771 sprintf(buf, "%lu", l);
3772 fio_keywords[2].replace = strdup(buf);
3773}
3774
Jens Axboe892a6ff2009-11-13 12:19:49 +01003775#define BC_APP "bc"
3776
3777static char *bc_calc(char *str)
3778{
Steven Langd0c814e2011-10-28 08:37:13 +02003779 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003780 FILE *f;
3781 int ret;
3782
3783 /*
3784 * No math, just return string
3785 */
Steven Langd0c814e2011-10-28 08:37:13 +02003786 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3787 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003788 return str;
3789
3790 /*
3791 * Split option from value, we only need to calculate the value
3792 */
3793 tmp = strchr(str, '=');
3794 if (!tmp)
3795 return str;
3796
3797 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003798
Steven Langd0c814e2011-10-28 08:37:13 +02003799 /*
3800 * Prevent buffer overflows; such a case isn't reasonable anyway
3801 */
3802 if (strlen(str) >= 128 || strlen(tmp) > 100)
3803 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003804
3805 sprintf(buf, "which %s > /dev/null", BC_APP);
3806 if (system(buf)) {
3807 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003808 return NULL;
3809 }
3810
Steven Langd0c814e2011-10-28 08:37:13 +02003811 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003812 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003813 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003814 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003815
Steven Langd0c814e2011-10-28 08:37:13 +02003816 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003817 if (ret <= 0) {
3818 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003819 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003820 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003821
Jens Axboe892a6ff2009-11-13 12:19:49 +01003822 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003823 buf[(tmp - str) + ret - 1] = '\0';
3824 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003825 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003826 return strdup(buf);
3827}
3828
3829/*
3830 * Return a copy of the input string with substrings of the form ${VARNAME}
3831 * substituted with the value of the environment variable VARNAME. The
3832 * substitution always occurs, even if VARNAME is empty or the corresponding
3833 * environment variable undefined.
3834 */
3835static char *option_dup_subs(const char *opt)
3836{
3837 char out[OPT_LEN_MAX+1];
3838 char in[OPT_LEN_MAX+1];
3839 char *outptr = out;
3840 char *inptr = in;
3841 char *ch1, *ch2, *env;
3842 ssize_t nchr = OPT_LEN_MAX;
3843 size_t envlen;
3844
3845 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3846 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3847 return NULL;
3848 }
3849
3850 in[OPT_LEN_MAX] = '\0';
3851 strncpy(in, opt, OPT_LEN_MAX);
3852
3853 while (*inptr && nchr > 0) {
3854 if (inptr[0] == '$' && inptr[1] == '{') {
3855 ch2 = strchr(inptr, '}');
3856 if (ch2 && inptr+1 < ch2) {
3857 ch1 = inptr+2;
3858 inptr = ch2+1;
3859 *ch2 = '\0';
3860
3861 env = getenv(ch1);
3862 if (env) {
3863 envlen = strlen(env);
3864 if (envlen <= nchr) {
3865 memcpy(outptr, env, envlen);
3866 outptr += envlen;
3867 nchr -= envlen;
3868 }
3869 }
3870
3871 continue;
3872 }
3873 }
3874
3875 *outptr++ = *inptr++;
3876 --nchr;
3877 }
3878
3879 *outptr = '\0';
3880 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003881}
3882
Jens Axboe74929ac2009-08-05 11:42:37 +02003883/*
3884 * Look for reserved variable names and replace them with real values
3885 */
3886static char *fio_keyword_replace(char *opt)
3887{
3888 char *s;
3889 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003890 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003891
3892 for (i = 0; fio_keywords[i].word != NULL; i++) {
3893 struct fio_keyword *kw = &fio_keywords[i];
3894
3895 while ((s = strstr(opt, kw->word)) != NULL) {
3896 char *new = malloc(strlen(opt) + 1);
3897 char *o_org = opt;
3898 int olen = s - opt;
3899 int len;
3900
3901 /*
3902 * Copy part of the string before the keyword and
3903 * sprintf() the replacement after it.
3904 */
3905 memcpy(new, opt, olen);
3906 len = sprintf(new + olen, "%s", kw->replace);
3907
3908 /*
3909 * If there's more in the original string, copy that
3910 * in too
3911 */
3912 opt += strlen(kw->word) + olen;
3913 if (strlen(opt))
3914 memcpy(new + olen + len, opt, opt - o_org - 1);
3915
3916 /*
3917 * replace opt and free the old opt
3918 */
3919 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003920 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003921
Steven Langd0c814e2011-10-28 08:37:13 +02003922 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003923 }
3924 }
3925
Steven Langd0c814e2011-10-28 08:37:13 +02003926 /*
3927 * Check for potential math and invoke bc, if possible
3928 */
3929 if (docalc)
3930 opt = bc_calc(opt);
3931
Jens Axboe7a958bd2009-11-13 12:33:54 +01003932 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003933}
3934
Steven Langd0c814e2011-10-28 08:37:13 +02003935static char **dup_and_sub_options(char **opts, int num_opts)
3936{
3937 int i;
3938 char **opts_copy = malloc(num_opts * sizeof(*opts));
3939 for (i = 0; i < num_opts; i++) {
3940 opts_copy[i] = option_dup_subs(opts[i]);
3941 if (!opts_copy[i])
3942 continue;
3943 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3944 }
3945 return opts_copy;
3946}
3947
Jens Axboe5b284222014-12-06 09:53:46 -07003948static void show_closest_option(const char *opt)
Jens Axboecf88f2a2014-12-06 09:17:52 -07003949{
3950 int best_option, best_distance;
3951 int i, distance;
Jens Axboe5b284222014-12-06 09:53:46 -07003952 char *name;
3953
3954 if (!strlen(opt))
3955 return;
3956
3957 name = strdup(opt);
3958 i = 0;
3959 while (name[i] != '\0' && name[i] != '=')
3960 i++;
3961 name[i] = '\0';
Jens Axboecf88f2a2014-12-06 09:17:52 -07003962
3963 best_option = -1;
3964 best_distance = INT_MAX;
3965 i = 0;
3966 while (fio_options[i].name) {
3967 distance = string_distance(name, fio_options[i].name);
3968 if (distance < best_distance) {
3969 best_distance = distance;
3970 best_option = i;
3971 }
3972 i++;
3973 }
3974
3975 if (best_option != -1)
3976 log_err("Did you mean %s?\n", fio_options[best_option].name);
Jens Axboe5b284222014-12-06 09:53:46 -07003977
3978 free(name);
Jens Axboecf88f2a2014-12-06 09:17:52 -07003979}
3980
Jens Axboe292cc472013-11-26 20:39:35 -07003981int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3982 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003983{
Steven Langde890a12011-11-09 14:03:34 +01003984 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003985 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003986
Jens Axboe9af4a242012-03-16 10:13:49 +01003987 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003988 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003989
Steven Langde890a12011-11-09 14:03:34 +01003990 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3991 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003992 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003993 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003994
Jens Axboe9c62acd2014-12-09 12:58:15 -07003995 if (!newret && o)
3996 fio_option_mark_set(&td->o, o);
3997
Steven Langde890a12011-11-09 14:03:34 +01003998 if (opts_copy[i]) {
3999 if (newret && !o) {
4000 unknown++;
4001 continue;
4002 }
Steven Langd0c814e2011-10-28 08:37:13 +02004003 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01004004 opts_copy[i] = NULL;
4005 }
4006
4007 ret |= newret;
4008 }
4009
4010 if (unknown) {
4011 ret |= ioengine_load(td);
4012 if (td->eo) {
4013 sort_options(opts_copy, td->io_ops->options, num_opts);
4014 opts = opts_copy;
4015 }
4016 for (i = 0; i < num_opts; i++) {
4017 struct fio_option *o = NULL;
4018 int newret = 1;
Jens Axboecf88f2a2014-12-06 09:17:52 -07004019
Steven Langde890a12011-11-09 14:03:34 +01004020 if (!opts_copy[i])
4021 continue;
4022
4023 if (td->eo)
4024 newret = parse_option(opts_copy[i], opts[i],
4025 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07004026 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01004027
4028 ret |= newret;
Jens Axboecf88f2a2014-12-06 09:17:52 -07004029 if (!o) {
Steven Langde890a12011-11-09 14:03:34 +01004030 log_err("Bad option <%s>\n", opts[i]);
Jens Axboecf88f2a2014-12-06 09:17:52 -07004031 show_closest_option(opts[i]);
4032 }
Steven Langde890a12011-11-09 14:03:34 +01004033 free(opts_copy[i]);
4034 opts_copy[i] = NULL;
4035 }
Jens Axboe74929ac2009-08-05 11:42:37 +02004036 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02004037
Steven Langd0c814e2011-10-28 08:37:13 +02004038 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02004039 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004040}
4041
4042int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4043{
Jens Axboe9c62acd2014-12-09 12:58:15 -07004044 int ret;
4045
4046 ret = parse_cmd_option(opt, val, fio_options, td);
4047 if (!ret) {
4048 struct fio_option *o;
4049
4050 o = find_option(fio_options, opt);
4051 if (o)
4052 fio_option_mark_set(&td->o, o);
4053 }
4054
4055 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004056}
4057
Steven Langde890a12011-11-09 14:03:34 +01004058int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4059 char *val)
4060{
Akinobu Mita8a96c802013-10-09 09:32:34 -06004061 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01004062}
4063
Jens Axboe214e1ec2007-03-15 10:48:13 +01004064void fio_fill_default_options(struct thread_data *td)
4065{
Jens Axboecb1402d2014-02-25 11:35:27 -08004066 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01004067 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004068}
4069
4070int fio_show_option_help(const char *opt)
4071{
Jens Axboe9af4a242012-03-16 10:13:49 +01004072 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004073}
Jens Axboed23bb322007-03-23 15:57:56 +01004074
Steven Langde890a12011-11-09 14:03:34 +01004075void options_mem_dupe(void *data, struct fio_option *options)
4076{
4077 struct fio_option *o;
4078 char **ptr;
4079
4080 for (o = &options[0]; o->name; o++) {
4081 if (o->type != FIO_OPT_STR_STORE)
4082 continue;
4083
Jens Axboef0fdbca2014-02-11 15:44:50 -07004084 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01004085 if (*ptr)
4086 *ptr = strdup(*ptr);
4087 }
4088}
4089
Jens Axboe7e356b22011-10-14 10:55:16 +02004090/*
4091 * dupe FIO_OPT_STR_STORE options
4092 */
Steven Langde890a12011-11-09 14:03:34 +01004093void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01004094{
Jens Axboe9af4a242012-03-16 10:13:49 +01004095 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01004096
4097 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01004098 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01004099
Steven Langde890a12011-11-09 14:03:34 +01004100 td->eo = malloc(td->io_ops->option_struct_size);
4101 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4102 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01004103 }
4104}
4105
Jens Axboed6978a32009-07-18 21:04:09 +02004106unsigned int fio_get_kb_base(void *data)
4107{
Jens Axboe83ea4222012-03-28 14:01:46 +02004108 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02004109 unsigned int kb_base = 0;
4110
Jens Axboecb1402d2014-02-25 11:35:27 -08004111 /*
4112 * This is a hack... For private options, *data is not holding
4113 * a pointer to the thread_options, but to private data. This means
4114 * we can't safely dereference it, but magic is first so mem wise
4115 * it is valid. But this also means that if the job first sets
4116 * kb_base and expects that to be honored by private options,
4117 * it will be disappointed. We will return the global default
4118 * for this.
4119 */
4120 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004121 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004122 if (!kb_base)
4123 kb_base = 1024;
4124
4125 return kb_base;
4126}
Jens Axboe9f988e22010-03-04 10:42:38 +01004127
Jens Axboe07b32322010-03-05 09:48:44 +01004128int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004129{
Jens Axboe07b32322010-03-05 09:48:44 +01004130 struct fio_option *__o;
4131 int opt_index = 0;
4132
Jens Axboe9af4a242012-03-16 10:13:49 +01004133 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004134 while (__o->name) {
4135 opt_index++;
4136 __o++;
4137 }
4138
Jens Axboe7b504ed2014-02-11 14:19:38 -07004139 if (opt_index + 1 == FIO_MAX_OPTS) {
4140 log_err("fio: FIO_MAX_OPTS is too small\n");
4141 return 1;
4142 }
4143
Jens Axboe9af4a242012-03-16 10:13:49 +01004144 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004145 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004146 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004147}
Jens Axboee2de69d2010-03-04 14:05:48 +01004148
Jens Axboe07b32322010-03-05 09:48:44 +01004149void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004150{
Jens Axboe07b32322010-03-05 09:48:44 +01004151 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004152
Jens Axboe9af4a242012-03-16 10:13:49 +01004153 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004154 while (o->name) {
4155 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4156 o->type = FIO_OPT_INVALID;
4157 o->prof_name = NULL;
4158 }
4159 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004160 }
4161}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004162
4163void add_opt_posval(const char *optname, const char *ival, const char *help)
4164{
4165 struct fio_option *o;
4166 unsigned int i;
4167
Jens Axboe9af4a242012-03-16 10:13:49 +01004168 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004169 if (!o)
4170 return;
4171
4172 for (i = 0; i < PARSE_MAX_VP; i++) {
4173 if (o->posval[i].ival)
4174 continue;
4175
4176 o->posval[i].ival = ival;
4177 o->posval[i].help = help;
4178 break;
4179 }
4180}
4181
4182void del_opt_posval(const char *optname, const char *ival)
4183{
4184 struct fio_option *o;
4185 unsigned int i;
4186
Jens Axboe9af4a242012-03-16 10:13:49 +01004187 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004188 if (!o)
4189 return;
4190
4191 for (i = 0; i < PARSE_MAX_VP; i++) {
4192 if (!o->posval[i].ival)
4193 continue;
4194 if (strcmp(o->posval[i].ival, ival))
4195 continue;
4196
4197 o->posval[i].ival = NULL;
4198 o->posval[i].help = NULL;
4199 }
4200}
Jens Axboe7e356b22011-10-14 10:55:16 +02004201
4202void fio_options_free(struct thread_data *td)
4203{
Jens Axboe9af4a242012-03-16 10:13:49 +01004204 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004205 if (td->eo && td->io_ops && td->io_ops->options) {
4206 options_free(td->io_ops->options, td->eo);
4207 free(td->eo);
4208 td->eo = NULL;
4209 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004210}
Jens Axboec504ee52012-03-20 11:29:09 +01004211
4212struct fio_option *fio_option_find(const char *name)
4213{
4214 return find_option(fio_options, name);
4215}
4216
Jens Axboe9c62acd2014-12-09 12:58:15 -07004217int __fio_option_is_set(struct thread_options *o, unsigned int off1)
4218{
4219 unsigned int opt_off, index, offset;
4220 struct fio_option *opt = NULL;
4221 int i;
4222
4223 for (i = 0; fio_options[i].name; i++) {
4224 if (off1 == fio_options[i].off1) {
4225 opt = &fio_options[i];
4226 break;
4227 }
4228 }
4229
4230 if (!opt) {
4231 log_err("fio: no option found at offset %u\n", off1);
4232 return 0;
4233 }
4234
4235 opt_off = opt - &fio_options[0];
4236 index = opt_off / (8 * sizeof(uint64_t));
4237 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4238 return (o->set_options[index] & (1UL << offset)) != 0;
4239}
4240
4241void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4242{
4243 unsigned int opt_off, index, offset;
4244
4245 opt_off = opt - &fio_options[0];
4246 index = opt_off / (8 * sizeof(uint64_t));
4247 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4248 o->set_options[index] |= 1UL << offset;
4249}