blob: a01b2d9b0c574621e127c1262ce965fc102e73f7 [file] [log] [blame]
Jens Axboe214e1ec2007-03-15 10:48:13 +01001#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <ctype.h>
5#include <string.h>
Jens Axboe214e1ec2007-03-15 10:48:13 +01006#include <assert.h>
Jens Axboe921c7662008-03-26 09:17:55 +01007#include <libgen.h>
Jens Axboe5921e802008-05-30 15:02:38 +02008#include <fcntl.h>
9#include <sys/types.h>
10#include <sys/stat.h>
Jens Axboe214e1ec2007-03-15 10:48:13 +010011
12#include "fio.h"
Jens Axboe4f5af7b2009-06-03 08:45:40 +020013#include "verify.h"
Jens Axboe214e1ec2007-03-15 10:48:13 +010014#include "parse.h"
Jens Axboeeef32352008-06-02 13:31:26 +020015#include "lib/fls.h"
Jens Axboe9f988e22010-03-04 10:42:38 +010016#include "options.h"
Jens Axboe214e1ec2007-03-15 10:48:13 +010017
Jens Axboe5d7c5d32010-06-21 15:08:17 +020018#include "crc/crc32c.h"
19
Jens Axboe214e1ec2007-03-15 10:48:13 +010020/*
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
22 */
23static char *get_opt_postfix(const char *str)
24{
25 char *p = strstr(str, ":");
26
27 if (!p)
28 return NULL;
29
30 p++;
31 strip_blank_front(&p);
32 strip_blank_end(p);
33 return strdup(p);
34}
35
Radha Ramachandran0e92f872009-10-27 20:14:27 +010036static int converthexchartoint(char a)
37{
38 int base;
39
Jens Axboe3c3ed072012-03-27 09:12:39 +020040 switch (a) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +010041 case '0'...'9':
42 base = '0';
43 break;
44 case 'A'...'F':
45 base = 'A' - 10;
46 break;
47 case 'a'...'f':
48 base = 'a' - 10;
49 break;
50 default:
51 base = 0;
52 }
Jens Axboe3c3ed072012-03-27 09:12:39 +020053 return a - base;
Radha Ramachandran0e92f872009-10-27 20:14:27 +010054}
55
Jens Axboe564ca972007-12-14 12:21:19 +010056static int bs_cmp(const void *p1, const void *p2)
57{
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
60
61 return bsp1->perc < bsp2->perc;
62}
63
Jens Axboe83ea4222012-03-28 14:01:46 +020064static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
Jens Axboe564ca972007-12-14 12:21:19 +010065{
Jens Axboe720e84a2009-04-21 08:29:55 +020066 struct bssplit *bssplit;
Jens Axboe564ca972007-12-14 12:21:19 +010067 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
69 long long val;
Jens Axboe720e84a2009-04-21 08:29:55 +020070 char *fname;
Jens Axboe564ca972007-12-14 12:21:19 +010071
Jens Axboe83ea4222012-03-28 14:01:46 +020072 o->bssplit_nr[ddir] = 4;
Jens Axboe720e84a2009-04-21 08:29:55 +020073 bssplit = malloc(4 * sizeof(struct bssplit));
Jens Axboe564ca972007-12-14 12:21:19 +010074
75 i = 0;
76 max_bs = 0;
77 min_bs = -1;
78 while ((fname = strsep(&str, ":")) != NULL) {
79 char *perc_str;
80
81 if (!strlen(fname))
82 break;
83
84 /*
85 * grow struct buffer, if needed
86 */
Jens Axboe83ea4222012-03-28 14:01:46 +020087 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
Jens Axboe5ec10ea2008-03-06 15:42:00 +010090 * sizeof(struct bssplit));
Jens Axboe564ca972007-12-14 12:21:19 +010091 }
92
93 perc_str = strstr(fname, "/");
94 if (perc_str) {
95 *perc_str = '\0';
96 perc_str++;
97 perc = atoi(perc_str);
98 if (perc > 100)
99 perc = 100;
100 else if (!perc)
Jens Axboe03479882014-09-27 08:08:00 -0600101 perc = -1U;
Jens Axboe564ca972007-12-14 12:21:19 +0100102 } else
Jens Axboe03479882014-09-27 08:08:00 -0600103 perc = -1U;
Jens Axboe564ca972007-12-14 12:21:19 +0100104
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700105 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
Jens Axboe564ca972007-12-14 12:21:19 +0100106 log_err("fio: bssplit conversion failed\n");
Hong Zhiguod8b97c82013-10-08 08:48:47 -0600107 free(bssplit);
Jens Axboe564ca972007-12-14 12:21:19 +0100108 return 1;
109 }
110
111 if (val > max_bs)
112 max_bs = val;
113 if (val < min_bs)
114 min_bs = val;
115
Jens Axboe720e84a2009-04-21 08:29:55 +0200116 bssplit[i].bs = val;
117 bssplit[i].perc = perc;
Jens Axboe564ca972007-12-14 12:21:19 +0100118 i++;
119 }
120
Jens Axboe83ea4222012-03-28 14:01:46 +0200121 o->bssplit_nr[ddir] = i;
Jens Axboe564ca972007-12-14 12:21:19 +0100122
123 /*
124 * Now check if the percentages add up, and how much is missing
125 */
126 perc = perc_missing = 0;
Jens Axboe83ea4222012-03-28 14:01:46 +0200127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200128 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100129
Jens Axboe03479882014-09-27 08:08:00 -0600130 if (bsp->perc == -1U)
Jens Axboe564ca972007-12-14 12:21:19 +0100131 perc_missing++;
132 else
133 perc += bsp->perc;
134 }
135
Jens Axboef3cc9892014-09-15 18:51:32 -0600136 if (perc > 100 && perc_missing > 1) {
Jens Axboe564ca972007-12-14 12:21:19 +0100137 log_err("fio: bssplit percentages add to more than 100%%\n");
Jens Axboe720e84a2009-04-21 08:29:55 +0200138 free(bssplit);
Jens Axboe564ca972007-12-14 12:21:19 +0100139 return 1;
140 }
Jens Axboe03479882014-09-27 08:08:00 -0600141
Jens Axboe564ca972007-12-14 12:21:19 +0100142 /*
143 * If values didn't have a percentage set, divide the remains between
144 * them.
145 */
146 if (perc_missing) {
Jens Axboe03479882014-09-27 08:08:00 -0600147 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
Jens Axboef3cc9892014-09-15 18:51:32 -0600148 perc = 100;
Jens Axboe83ea4222012-03-28 14:01:46 +0200149 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200150 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100151
Jens Axboe03479882014-09-27 08:08:00 -0600152 if (bsp->perc == -1U)
Jens Axboe564ca972007-12-14 12:21:19 +0100153 bsp->perc = (100 - perc) / perc_missing;
154 }
155 }
156
Jens Axboe83ea4222012-03-28 14:01:46 +0200157 o->min_bs[ddir] = min_bs;
158 o->max_bs[ddir] = max_bs;
Jens Axboe564ca972007-12-14 12:21:19 +0100159
160 /*
161 * now sort based on percentages, for ease of lookup
162 */
Jens Axboe83ea4222012-03-28 14:01:46 +0200163 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
164 o->bssplit[ddir] = bssplit;
Jens Axboe720e84a2009-04-21 08:29:55 +0200165 return 0;
Jens Axboe720e84a2009-04-21 08:29:55 +0200166}
167
168static int str_bssplit_cb(void *data, const char *input)
169{
170 struct thread_data *td = data;
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200171 char *str, *p, *odir, *ddir;
Jens Axboe720e84a2009-04-21 08:29:55 +0200172 int ret = 0;
173
Jens Axboe52c0cea2013-09-06 10:07:37 -0600174 if (parse_dryrun())
175 return 0;
176
Jens Axboe720e84a2009-04-21 08:29:55 +0200177 p = str = strdup(input);
178
179 strip_blank_front(&str);
180 strip_blank_end(str);
181
182 odir = strchr(str, ',');
183 if (odir) {
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200184 ddir = strchr(odir + 1, ',');
185 if (ddir) {
Jens Axboed79db122012-09-24 08:51:24 +0200186 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200187 if (!ret)
188 *ddir = '\0';
189 } else {
190 char *op;
191
192 op = strdup(odir + 1);
Jens Axboed79db122012-09-24 08:51:24 +0200193 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200194
195 free(op);
196 }
Jens Axboed79db122012-09-24 08:51:24 +0200197 if (!ret)
198 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
Jens Axboe720e84a2009-04-21 08:29:55 +0200199 if (!ret) {
200 *odir = '\0';
Jens Axboe83ea4222012-03-28 14:01:46 +0200201 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200202 }
203 } else {
204 char *op;
205
206 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200207 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
Jens Axboe720e84a2009-04-21 08:29:55 +0200208 free(op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200209
210 if (!ret) {
211 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200212 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200213 free(op);
214 }
Jens Axboed79db122012-09-24 08:51:24 +0200215 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200216 }
Jens Axboe564ca972007-12-14 12:21:19 +0100217
218 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200219 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100220}
221
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400222static int str2error(char *str)
223{
Jens Axboea94eb992012-09-24 18:46:34 +0200224 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400225 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
226 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
227 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
228 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
229 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
230 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
Jens Axboea94eb992012-09-24 18:46:34 +0200231 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400232 int i = 0, num = sizeof(err) / sizeof(void *);
233
Jens Axboea94eb992012-09-24 18:46:34 +0200234 while (i < num) {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400235 if (!strcmp(err[i], str))
236 return i + 1;
237 i++;
238 }
239 return 0;
240}
241
242static int ignore_error_type(struct thread_data *td, int etype, char *str)
243{
244 unsigned int i;
245 int *error;
246 char *fname;
247
248 if (etype >= ERROR_TYPE_CNT) {
249 log_err("Illegal error type\n");
250 return 1;
251 }
252
253 td->o.ignore_error_nr[etype] = 4;
254 error = malloc(4 * sizeof(struct bssplit));
255
256 i = 0;
257 while ((fname = strsep(&str, ":")) != NULL) {
258
259 if (!strlen(fname))
260 break;
261
262 /*
263 * grow struct buffer, if needed
264 */
265 if (i == td->o.ignore_error_nr[etype]) {
266 td->o.ignore_error_nr[etype] <<= 1;
267 error = realloc(error, td->o.ignore_error_nr[etype]
268 * sizeof(int));
269 }
270 if (fname[0] == 'E') {
271 error[i] = str2error(fname);
272 } else {
273 error[i] = atoi(fname);
274 if (error[i] < 0)
Jens Axboe1616e022014-04-14 08:59:17 -0600275 error[i] = -error[i];
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400276 }
277 if (!error[i]) {
278 log_err("Unknown error %s, please use number value \n",
279 fname);
Erwan Velu0fddbf72013-07-22 23:46:10 +0200280 free(error);
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400281 return 1;
282 }
283 i++;
284 }
285 if (i) {
286 td->o.continue_on_error |= 1 << etype;
287 td->o.ignore_error_nr[etype] = i;
288 td->o.ignore_error[etype] = error;
Jens Axboec7b086b2014-04-11 11:20:29 -0600289 } else
290 free(error);
291
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400292 return 0;
293
294}
295
296static int str_ignore_error_cb(void *data, const char *input)
297{
298 struct thread_data *td = data;
299 char *str, *p, *n;
300 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600301
302 if (parse_dryrun())
303 return 0;
304
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400305 p = str = strdup(input);
306
307 strip_blank_front(&str);
308 strip_blank_end(str);
309
310 while (p) {
311 n = strchr(p, ',');
312 if (n)
313 *n++ = '\0';
314 ret = ignore_error_type(td, type, p);
315 if (ret)
316 break;
317 p = n;
318 type++;
319 }
320 free(str);
321 return ret;
322}
323
Jens Axboe211097b2007-03-22 18:56:45 +0100324static int str_rw_cb(void *data, const char *str)
325{
326 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200327 struct thread_options *o = &td->o;
Jens Axboe27ca9492014-04-11 11:25:32 -0600328 char *nr;
Jens Axboe211097b2007-03-22 18:56:45 +0100329
Jens Axboe52c0cea2013-09-06 10:07:37 -0600330 if (parse_dryrun())
331 return 0;
332
Jens Axboe83ea4222012-03-28 14:01:46 +0200333 o->ddir_seq_nr = 1;
334 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200335
Jens Axboe27ca9492014-04-11 11:25:32 -0600336 nr = get_opt_postfix(str);
Jens Axboe059b0802011-08-25 09:09:37 +0200337 if (!nr)
338 return 0;
339
340 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200341 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200342 else {
343 long long val;
344
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700345 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200346 log_err("fio: rw postfix parsing failed\n");
347 free(nr);
348 return 1;
349 }
350
Jens Axboe83ea4222012-03-28 14:01:46 +0200351 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100352 }
Jens Axboe211097b2007-03-22 18:56:45 +0100353
Jens Axboe059b0802011-08-25 09:09:37 +0200354 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100355 return 0;
356}
357
Jens Axboe214e1ec2007-03-15 10:48:13 +0100358static int str_mem_cb(void *data, const char *mem)
359{
360 struct thread_data *td = data;
361
Shaohua Lid9759b12013-01-17 13:28:15 +0100362 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700363 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100364
365 return 0;
366}
367
Jens Axboec223da82010-03-24 13:23:53 +0100368static int fio_clock_source_cb(void *data, const char *str)
369{
370 struct thread_data *td = data;
371
372 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100373 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100374 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100375 return 0;
376}
377
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400378static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200379{
380 struct thread_data *td = data;
381
382 td->o.rwmix[DDIR_READ] = *val;
383 td->o.rwmix[DDIR_WRITE] = 100 - *val;
384 return 0;
385}
386
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400387static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200388{
389 struct thread_data *td = data;
390
391 td->o.rwmix[DDIR_WRITE] = *val;
392 td->o.rwmix[DDIR_READ] = 100 - *val;
393 return 0;
394}
395
Jens Axboe214e1ec2007-03-15 10:48:13 +0100396static int str_exitall_cb(void)
397{
398 exitall_on_terminate = 1;
399 return 0;
400}
401
Jens Axboe214e1ec2007-03-15 10:48:13 +0100402#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800403int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800404{
Jens Axboe50b58602014-02-28 15:08:25 -0800405 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800406 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800407
Jens Axboe50b58602014-02-28 15:08:25 -0800408 cpus_in_mask = fio_cpu_count(mask);
409 cpu_index = cpu_index % cpus_in_mask;
410
411 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800412 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800413 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800414 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800415
416 if (cpu_index != index)
417 fio_cpu_clear(mask, i);
418
419 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800420 }
421
422 return fio_cpu_count(mask);
423}
424
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400425static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100426{
427 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200428 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100429 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100430 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100431
Jens Axboe52c0cea2013-09-06 10:07:37 -0600432 if (parse_dryrun())
433 return 0;
434
Jens Axboed2ce18b2008-12-12 20:51:40 +0100435 ret = fio_cpuset_init(&td->o.cpumask);
436 if (ret < 0) {
437 log_err("fio: cpuset_init failed\n");
438 td_verror(td, ret, "fio_cpuset_init");
439 return 1;
440 }
441
Jens Axboec00a2282011-07-08 20:56:06 +0200442 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200443
Jens Axboe62a72732008-12-08 11:37:01 +0100444 for (i = 0; i < sizeof(int) * 8; i++) {
445 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100446 if (i > max_cpu) {
447 log_err("fio: CPU %d too large (max=%ld)\n", i,
448 max_cpu);
449 return 1;
450 }
Jens Axboe62a72732008-12-08 11:37:01 +0100451 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100452 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100453 }
454 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200455
Jens Axboe214e1ec2007-03-15 10:48:13 +0100456 return 0;
457}
458
Jens Axboee8462bd2009-07-06 12:59:04 +0200459static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
460 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200461{
Jens Axboed2e268b2007-06-15 10:33:49 +0200462 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100463 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100464 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200465
Jens Axboee8462bd2009-07-06 12:59:04 +0200466 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100467 if (ret < 0) {
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
470 return 1;
471 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200472
473 p = str = strdup(input);
474
475 strip_blank_front(&str);
476 strip_blank_end(str);
477
Jens Axboec00a2282011-07-08 20:56:06 +0200478 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100479
Jens Axboed2e268b2007-06-15 10:33:49 +0200480 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100481 char *str2, *cpu2;
482 int icpu, icpu2;
483
Jens Axboed2e268b2007-06-15 10:33:49 +0200484 if (!strlen(cpu))
485 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100486
487 str2 = cpu;
488 icpu2 = -1;
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
490 if (!strlen(cpu2))
491 break;
492
493 icpu2 = atoi(cpu2);
494 }
495
496 icpu = atoi(cpu);
497 if (icpu2 == -1)
498 icpu2 = icpu;
499 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100500 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100501 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100502 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100503 ret = 1;
504 break;
505 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
508 icpu, max_cpu);
509 ret = 1;
510 break;
511 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200512
Jens Axboe62a72732008-12-08 11:37:01 +0100513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200514 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100515 icpu++;
516 }
Jens Axboe19608d62008-12-08 15:03:12 +0100517 if (ret)
518 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200519 }
520
521 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100522 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200523}
Jens Axboee8462bd2009-07-06 12:59:04 +0200524
525static int str_cpus_allowed_cb(void *data, const char *input)
526{
527 struct thread_data *td = data;
Jens Axboee8462bd2009-07-06 12:59:04 +0200528
Jens Axboe52c0cea2013-09-06 10:07:37 -0600529 if (parse_dryrun())
530 return 0;
531
Jens Axboe94b360f2014-12-09 13:17:33 -0700532 return set_cpus_allowed(td, &td->o.cpumask, input);
Jens Axboee8462bd2009-07-06 12:59:04 +0200533}
534
535static int str_verify_cpus_allowed_cb(void *data, const char *input)
536{
537 struct thread_data *td = data;
Jens Axboee8462bd2009-07-06 12:59:04 +0200538
Jens Axboe94b360f2014-12-09 13:17:33 -0700539 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
Jens Axboee8462bd2009-07-06 12:59:04 +0200540}
Jens Axboed2e268b2007-06-15 10:33:49 +0200541#endif
542
Jens Axboe67bf9822013-01-10 11:23:19 +0100543#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400544static int str_numa_cpunodes_cb(void *data, char *input)
545{
546 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200547 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400548
Jens Axboe52c0cea2013-09-06 10:07:37 -0600549 if (parse_dryrun())
550 return 0;
551
Yufei Rend0b937e2012-10-19 23:11:52 -0400552 /* numa_parse_nodestring() parses a character string list
553 * of nodes into a bit mask. The bit mask is allocated by
554 * numa_allocate_nodemask(), so it should be freed by
555 * numa_free_nodemask().
556 */
Daniel Gollub43522842014-05-01 17:07:49 +0200557 verify_bitmask = numa_parse_nodestring(input);
558 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400559 log_err("fio: numa_parse_nodestring failed\n");
560 td_verror(td, 1, "str_numa_cpunodes_cb");
561 return 1;
562 }
Daniel Gollub43522842014-05-01 17:07:49 +0200563 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400564
Daniel Gollub43522842014-05-01 17:07:49 +0200565 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400566 return 0;
567}
568
569static int str_numa_mpol_cb(void *data, char *input)
570{
571 struct thread_data *td = data;
572 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600573 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400574 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600575 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200576 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400577
Jens Axboe52c0cea2013-09-06 10:07:37 -0600578 if (parse_dryrun())
579 return 0;
580
581 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400582 if (nodelist) {
583 /* NUL-terminate mode */
584 *nodelist++ = '\0';
585 }
586
587 for (i = 0; i <= MPOL_LOCAL; i++) {
588 if (!strcmp(input, policy_types[i])) {
589 td->o.numa_mem_mode = i;
590 break;
591 }
592 }
593 if (i > MPOL_LOCAL) {
594 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
595 goto out;
596 }
597
598 switch (td->o.numa_mem_mode) {
599 case MPOL_PREFERRED:
600 /*
601 * Insist on a nodelist of one node only
602 */
603 if (nodelist) {
604 char *rest = nodelist;
605 while (isdigit(*rest))
606 rest++;
607 if (*rest) {
608 log_err("fio: one node only for \'prefer\'\n");
609 goto out;
610 }
611 } else {
612 log_err("fio: one node is needed for \'prefer\'\n");
613 goto out;
614 }
615 break;
616 case MPOL_INTERLEAVE:
617 /*
618 * Default to online nodes with memory if no nodelist
619 */
620 if (!nodelist)
621 nodelist = strdup("all");
622 break;
623 case MPOL_LOCAL:
624 case MPOL_DEFAULT:
625 /*
626 * Don't allow a nodelist
627 */
628 if (nodelist) {
629 log_err("fio: NO nodelist for \'local\'\n");
630 goto out;
631 }
632 break;
633 case MPOL_BIND:
634 /*
635 * Insist on a nodelist
636 */
637 if (!nodelist) {
638 log_err("fio: a nodelist is needed for \'bind\'\n");
639 goto out;
640 }
641 break;
642 }
643
644
645 /* numa_parse_nodestring() parses a character string list
646 * of nodes into a bit mask. The bit mask is allocated by
647 * numa_allocate_nodemask(), so it should be freed by
648 * numa_free_nodemask().
649 */
650 switch (td->o.numa_mem_mode) {
651 case MPOL_PREFERRED:
652 td->o.numa_mem_prefer_node = atoi(nodelist);
653 break;
654 case MPOL_INTERLEAVE:
655 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200656 verify_bitmask = numa_parse_nodestring(nodelist);
657 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400658 log_err("fio: numa_parse_nodestring failed\n");
659 td_verror(td, 1, "str_numa_memnodes_cb");
660 return 1;
661 }
Daniel Gollub43522842014-05-01 17:07:49 +0200662 td->o.numa_memnodes = strdup(nodelist);
663 numa_free_nodemask(verify_bitmask);
Manish Mandlik44e2ab52014-08-14 11:45:16 -0600664
Yufei Rend0b937e2012-10-19 23:11:52 -0400665 break;
666 case MPOL_LOCAL:
667 case MPOL_DEFAULT:
668 default:
669 break;
670 }
671
Yufei Rend0b937e2012-10-19 23:11:52 -0400672 return 0;
Yufei Rend0b937e2012-10-19 23:11:52 -0400673out:
674 return 1;
675}
676#endif
677
Jens Axboe214e1ec2007-03-15 10:48:13 +0100678static int str_fst_cb(void *data, const char *str)
679{
680 struct thread_data *td = data;
681 char *nr = get_opt_postfix(str);
682
683 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100684 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100685 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100686 free(nr);
687 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100688
689 return 0;
690}
691
Jens Axboe67bf9822013-01-10 11:23:19 +0100692#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100693static int str_sfr_cb(void *data, const char *str)
694{
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
697
698 td->sync_file_range_nr = 1;
699 if (nr) {
700 td->sync_file_range_nr = atoi(nr);
701 free(nr);
702 }
703
704 return 0;
705}
Jens Axboe3ae06372010-03-19 19:17:15 +0100706#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100707
Jens Axboee25839d2012-11-06 10:49:42 +0100708static int str_random_distribution_cb(void *data, const char *str)
709{
710 struct thread_data *td = data;
711 double val;
712 char *nr;
713
Jens Axboe52c0cea2013-09-06 10:07:37 -0600714 if (parse_dryrun())
715 return 0;
716
Jens Axboe925fee32012-11-06 13:50:32 +0100717 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
718 val = 1.1;
719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
720 val = 0.2;
721 else
Jens Axboee25839d2012-11-06 10:49:42 +0100722 return 0;
723
724 nr = get_opt_postfix(str);
Stephen M. Cameron79dc9142014-11-10 20:31:26 -0700725 if (nr && !str_to_float(nr, &val, 0)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100726 log_err("fio: random postfix parsing failed\n");
727 free(nr);
728 return 1;
729 }
730
Jens Axboe078189c2012-11-07 13:47:22 +0100731 free(nr);
732
Jens Axboe18ded912012-11-08 08:36:00 +0100733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
734 if (val == 1.00) {
735 log_err("fio: zipf theta must different than 1.0\n");
736 return 1;
737 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700738 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100739 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100740 if (val <= 0.00 || val >= 1.00) {
741 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
742 return 1;
743 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700744 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100745 }
Jens Axboe925fee32012-11-06 13:50:32 +0100746
Jens Axboee25839d2012-11-06 10:49:42 +0100747 return 0;
748}
749
Jens Axboe8e827d32009-08-04 09:51:48 +0200750/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800751 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200752 * is escaped with a '\', then that ':' is part of the filename and does not
753 * indicate a new file.
754 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800755static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200756{
757 char *str = *ptr;
758 char *p, *start;
759
760 if (!str || !strlen(str))
761 return NULL;
762
763 start = str;
764 do {
765 /*
766 * No colon, we are done
767 */
768 p = strchr(str, ':');
769 if (!p) {
770 *ptr = NULL;
771 break;
772 }
773
774 /*
775 * We got a colon, but it's the first character. Skip and
776 * continue
777 */
778 if (p == start) {
779 str = ++start;
780 continue;
781 }
782
783 if (*(p - 1) != '\\') {
784 *p = '\0';
785 *ptr = p + 1;
786 break;
787 }
788
789 memmove(p - 1, p, strlen(p) + 1);
790 str = p;
791 } while (1);
792
793 return start;
794}
795
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800796
797static int get_max_name_idx(char *input)
798{
799 unsigned int cur_idx;
800 char *str, *p;
801
802 p = str = strdup(input);
803 for (cur_idx = 0; ; cur_idx++)
804 if (get_next_name(&str) == NULL)
805 break;
806
807 free(p);
808 return cur_idx;
809}
810
811/*
812 * Returns the directory at the index, indexes > entires will be
813 * assigned via modulo division of the index
814 */
815int set_name_idx(char *target, char *input, int index)
816{
817 unsigned int cur_idx;
818 int len;
819 char *fname, *str, *p;
820
821 p = str = strdup(input);
822
823 index %= get_max_name_idx(input);
824 for (cur_idx = 0; cur_idx <= index; cur_idx++)
825 fname = get_next_name(&str);
826
827 len = sprintf(target, "%s/", fname);
828 free(p);
829
830 return len;
831}
832
Jens Axboe214e1ec2007-03-15 10:48:13 +0100833static int str_filename_cb(void *data, const char *input)
834{
835 struct thread_data *td = data;
836 char *fname, *str, *p;
837
838 p = str = strdup(input);
839
840 strip_blank_front(&str);
841 strip_blank_end(str);
842
843 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100844 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100845
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800846 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100847 if (!strlen(fname))
848 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800849 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100850 }
851
852 free(p);
853 return 0;
854}
855
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800856static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100857{
858 struct thread_data *td = data;
859 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800860 char *dirname, *str, *p;
861 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100862
Jens Axboef9633d72013-09-06 09:59:56 -0600863 if (parse_dryrun())
864 return 0;
865
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800866 p = str = strdup(td->o.directory);
867 while ((dirname = get_next_name(&str)) != NULL) {
868 if (lstat(dirname, &sb) < 0) {
869 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100870
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800871 log_err("fio: %s is not a directory\n", dirname);
872 td_verror(td, ret, "lstat");
873 goto out;
874 }
875 if (!S_ISDIR(sb.st_mode)) {
876 log_err("fio: %s is not a directory\n", dirname);
877 ret = 1;
878 goto out;
879 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100880 }
881
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800882out:
883 free(p);
884 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100885}
886
Jens Axboef2a28032014-02-11 09:12:06 -0700887static int str_lockfile_cb(void *data, const char fio_unused *str)
888{
889 struct thread_data *td = data;
890
891 if (td->files_index) {
892 log_err("fio: lockfile= option must precede filename=\n");
893 return 1;
894 }
895
896 return 0;
897}
898
Jens Axboe214e1ec2007-03-15 10:48:13 +0100899static int str_opendir_cb(void *data, const char fio_unused *str)
900{
901 struct thread_data *td = data;
902
Jens Axboe52c0cea2013-09-06 10:07:37 -0600903 if (parse_dryrun())
904 return 0;
905
Jens Axboe214e1ec2007-03-15 10:48:13 +0100906 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100907 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100908
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100909 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100910}
911
Jens Axboece35b1e2014-01-14 15:35:58 -0700912static int pattern_cb(char *pattern, unsigned int max_size,
913 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200914{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100915 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700916 int i = 0, j = 0, len, k, base = 10;
917 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200918 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200919
Jens Axboe5de855d2014-08-22 14:02:02 -0500920 /*
921 * Check if it's a string input
922 */
923 loc1 = strchr(input, '\"');
924 if (loc1) {
925 do {
926 loc1++;
927 if (*loc1 == '\0' || *loc1 == '\"')
928 break;
929
930 pattern[i] = *loc1;
931 i++;
932 } while (i < max_size);
933
934 if (!i)
935 return 1;
936
937 goto fill;
938 }
939
940 /*
941 * No string, find out if it's decimal or hexidecimal
942 */
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100943 loc1 = strstr(input, "0x");
944 loc2 = strstr(input, "0X");
945 if (loc1 || loc2)
946 base = 16;
947 off = strtol(input, NULL, base);
948 if (off != LONG_MAX || errno != ERANGE) {
949 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700950 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100951 off >>= 8;
952 i++;
953 }
954 } else {
955 len = strlen(input);
956 k = len - 1;
957 if (base == 16) {
958 if (loc1)
959 j = loc1 - input + 2;
960 else
961 j = loc2 - input + 2;
962 } else
963 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700964 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100965 while (k >= j) {
966 off = converthexchartoint(input[k--]);
967 if (k >= j)
968 off += (converthexchartoint(input[k--])
969 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700970 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100971 }
972 }
973 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100974
975 /*
976 * Fill the pattern all the way to the end. This greatly reduces
977 * the number of memcpy's we have to do when verifying the IO.
978 */
Jens Axboe5de855d2014-08-22 14:02:02 -0500979fill:
Jens Axboee078de42013-04-24 23:07:17 -0600980 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700981 while (i > 1 && i * 2 <= max_size) {
982 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100983 i *= 2;
984 }
Jens Axboee078de42013-04-24 23:07:17 -0600985
986 /*
987 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700988 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600989 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700990 while (i > 1 && i < max_size) {
991 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600992
Jens Axboece35b1e2014-01-14 15:35:58 -0700993 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600994 i += b;
995 }
996
Steven Lang9a2a86d2012-02-07 09:42:59 +0100997 if (i == 1) {
998 /*
Jens Axboedf91a1f2014-08-22 10:22:03 -0500999 * The code in verify_io_u_pattern assumes a single byte
1000 * pattern fills the whole verify pattern buffer.
Steven Lang9a2a86d2012-02-07 09:42:59 +01001001 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001002 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +01001003 }
Steven Langefcd9dc2012-02-02 20:22:04 +01001004
Jens Axboece35b1e2014-01-14 15:35:58 -07001005 *pattern_bytes = i;
1006 return 0;
1007}
1008
1009static int str_buffer_pattern_cb(void *data, const char *input)
1010{
1011 struct thread_data *td = data;
1012 int ret;
1013
1014 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1015 &td->o.buffer_pattern_bytes);
1016
Jens Axboedf91a1f2014-08-22 10:22:03 -05001017 if (!ret && td->o.buffer_pattern_bytes) {
Jens Axboe97f78c42014-12-04 08:27:21 -07001018 if (!td->o.compress_percentage)
1019 td->o.refill_buffers = 0;
Jens Axboece35b1e2014-01-14 15:35:58 -07001020 td->o.scramble_buffers = 0;
1021 td->o.zero_buffers = 0;
Jens Axboedf91a1f2014-08-22 10:22:03 -05001022 } else {
1023 log_err("fio: failed parsing pattern `%s`\n", input);
1024 ret = 1;
Jens Axboece35b1e2014-01-14 15:35:58 -07001025 }
1026
1027 return ret;
1028}
1029
Jens Axboebedc9dc2014-03-17 12:51:09 -06001030static int str_buffer_compress_cb(void *data, unsigned long long *il)
1031{
1032 struct thread_data *td = data;
1033
1034 td->flags |= TD_F_COMPRESS;
1035 td->o.compress_percentage = *il;
1036 return 0;
1037}
1038
Jens Axboee66dac22014-09-22 10:02:07 -06001039static int str_dedupe_cb(void *data, unsigned long long *il)
1040{
1041 struct thread_data *td = data;
1042
1043 td->flags |= TD_F_COMPRESS;
1044 td->o.dedupe_percentage = *il;
1045 td->o.refill_buffers = 1;
1046 return 0;
1047}
1048
Jens Axboece35b1e2014-01-14 15:35:58 -07001049static int str_verify_pattern_cb(void *data, const char *input)
1050{
1051 struct thread_data *td = data;
1052 int ret;
1053
1054 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1055 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001056
Jens Axboe92bf48d2011-01-14 21:20:42 +01001057 /*
1058 * VERIFY_META could already be set
1059 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001060 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001061 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001062
Jens Axboece35b1e2014-01-14 15:35:58 -07001063 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001064}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001065
Jens Axboe993bf482008-11-14 13:04:53 +01001066static int str_gtod_reduce_cb(void *data, int *il)
1067{
1068 struct thread_data *td = data;
1069 int val = *il;
1070
Jens Axboe02af0982010-06-24 09:59:34 +02001071 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001072 td->o.disable_clat = !!val;
1073 td->o.disable_slat = !!val;
1074 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001075 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001076 if (val)
1077 td->tv_cache_mask = 63;
1078
1079 return 0;
1080}
1081
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001082static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001083{
1084 struct thread_data *td = data;
1085 int val = *il;
1086
1087 td->o.gtod_cpu = val;
1088 td->o.gtod_offload = 1;
1089 return 0;
1090}
1091
Jens Axboe7bb59102011-07-12 19:47:03 +02001092static int str_size_cb(void *data, unsigned long long *__val)
1093{
1094 struct thread_data *td = data;
1095 unsigned long long v = *__val;
1096
1097 if (parse_is_percent(v)) {
1098 td->o.size = 0;
1099 td->o.size_percent = -1ULL - v;
1100 } else
1101 td->o.size = v;
1102
1103 return 0;
1104}
1105
Jens Axboe896cac22009-07-01 10:38:35 +02001106static int rw_verify(struct fio_option *o, void *data)
1107{
1108 struct thread_data *td = data;
1109
1110 if (read_only && td_write(td)) {
1111 log_err("fio: job <%s> has write bit set, but fio is in"
1112 " read-only mode\n", td->o.name);
1113 return 1;
1114 }
1115
1116 return 0;
1117}
1118
Jens Axboe276ca4f2009-07-01 10:43:05 +02001119static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001120{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001121#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001122 struct thread_data *td = data;
1123
Jens Axboe29d43ff2009-07-01 10:42:18 +02001124 if (td->o.gtod_cpu) {
1125 log_err("fio: platform must support CPU affinity for"
1126 "gettimeofday() offloading\n");
1127 return 1;
1128 }
1129#endif
1130
1131 return 0;
1132}
1133
Jens Axboe214e1ec2007-03-15 10:48:13 +01001134/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001135 * Option grouping
1136 */
1137static struct opt_group fio_opt_groups[] = {
1138 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001139 .name = "General",
1140 .mask = FIO_OPT_C_GENERAL,
1141 },
1142 {
1143 .name = "I/O",
1144 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001145 },
1146 {
1147 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001148 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001149 },
1150 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001151 .name = "Statistics",
1152 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001153 },
1154 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001155 .name = "Logging",
1156 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001157 },
1158 {
Jens Axboe13fca822012-03-31 13:55:54 +02001159 .name = "Profiles",
1160 .mask = FIO_OPT_C_PROFILE,
1161 },
1162 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001163 .name = NULL,
1164 },
1165};
1166
Jens Axboee8b0e952012-03-19 14:37:08 +01001167static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1168 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001169{
1170 struct opt_group *og;
1171 int i;
1172
Jens Axboee8b0e952012-03-19 14:37:08 +01001173 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001174 return NULL;
1175
Jens Axboee8b0e952012-03-19 14:37:08 +01001176 for (i = 0; ogs[i].name; i++) {
1177 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001178
1179 if (*mask & og->mask) {
1180 *mask &= ~(og->mask);
1181 return og;
1182 }
1183 }
1184
1185 return NULL;
1186}
1187
Jens Axboee8b0e952012-03-19 14:37:08 +01001188struct opt_group *opt_group_from_mask(unsigned int *mask)
1189{
1190 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1191}
1192
1193static struct opt_group fio_opt_cat_groups[] = {
1194 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001195 .name = "Latency profiling",
1196 .mask = FIO_OPT_G_LATPROF,
1197 },
1198 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001199 .name = "Rate",
1200 .mask = FIO_OPT_G_RATE,
1201 },
1202 {
1203 .name = "Zone",
1204 .mask = FIO_OPT_G_ZONE,
1205 },
1206 {
1207 .name = "Read/write mix",
1208 .mask = FIO_OPT_G_RWMIX,
1209 },
1210 {
1211 .name = "Verify",
1212 .mask = FIO_OPT_G_VERIFY,
1213 },
1214 {
1215 .name = "Trim",
1216 .mask = FIO_OPT_G_TRIM,
1217 },
1218 {
1219 .name = "I/O Logging",
1220 .mask = FIO_OPT_G_IOLOG,
1221 },
1222 {
1223 .name = "I/O Depth",
1224 .mask = FIO_OPT_G_IO_DEPTH,
1225 },
1226 {
1227 .name = "I/O Flow",
1228 .mask = FIO_OPT_G_IO_FLOW,
1229 },
1230 {
Jens Axboe06260372012-03-19 15:16:08 +01001231 .name = "Description",
1232 .mask = FIO_OPT_G_DESC,
1233 },
1234 {
1235 .name = "Filename",
1236 .mask = FIO_OPT_G_FILENAME,
1237 },
1238 {
1239 .name = "General I/O",
1240 .mask = FIO_OPT_G_IO_BASIC,
1241 },
1242 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001243 .name = "Cgroups",
1244 .mask = FIO_OPT_G_CGROUP,
1245 },
1246 {
1247 .name = "Runtime",
1248 .mask = FIO_OPT_G_RUNTIME,
1249 },
1250 {
Jens Axboe10860052012-03-19 20:56:53 +01001251 .name = "Process",
1252 .mask = FIO_OPT_G_PROCESS,
1253 },
1254 {
1255 .name = "Job credentials / priority",
1256 .mask = FIO_OPT_G_CRED,
1257 },
1258 {
1259 .name = "Clock settings",
1260 .mask = FIO_OPT_G_CLOCK,
1261 },
1262 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001263 .name = "I/O Type",
1264 .mask = FIO_OPT_G_IO_TYPE,
1265 },
1266 {
1267 .name = "I/O Thinktime",
1268 .mask = FIO_OPT_G_THINKTIME,
1269 },
1270 {
1271 .name = "Randomizations",
1272 .mask = FIO_OPT_G_RANDOM,
1273 },
1274 {
1275 .name = "I/O buffers",
1276 .mask = FIO_OPT_G_IO_BUF,
1277 },
1278 {
Jens Axboe13fca822012-03-31 13:55:54 +02001279 .name = "Tiobench profile",
1280 .mask = FIO_OPT_G_TIOBENCH,
1281 },
1282
1283 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001284 .name = NULL,
1285 }
1286};
1287
1288struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1289{
1290 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1291}
1292
Jens Axboe9af4a242012-03-16 10:13:49 +01001293/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001294 * Map of job/command line options
1295 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001296struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001297 {
1298 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001299 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001300 .type = FIO_OPT_STR_STORE,
1301 .off1 = td_var_offset(description),
1302 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001303 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001304 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001305 },
1306 {
1307 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001308 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001309 .type = FIO_OPT_STR_STORE,
1310 .off1 = td_var_offset(name),
1311 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001312 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001313 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001314 },
1315 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001316 .name = "filename",
1317 .lname = "Filename(s)",
1318 .type = FIO_OPT_STR_STORE,
1319 .off1 = td_var_offset(filename),
1320 .cb = str_filename_cb,
1321 .prio = -1, /* must come after "directory" */
1322 .help = "File(s) to use for the workload",
1323 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001324 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001325 },
1326 {
1327 .name = "directory",
1328 .lname = "Directory",
1329 .type = FIO_OPT_STR_STORE,
1330 .off1 = td_var_offset(directory),
1331 .cb = str_directory_cb,
1332 .help = "Directory to store files in",
1333 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001334 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001335 },
1336 {
Jens Axboede98bd32013-04-05 11:09:20 +02001337 .name = "filename_format",
1338 .type = FIO_OPT_STR_STORE,
1339 .off1 = td_var_offset(filename_format),
1340 .prio = -1, /* must come after "directory" */
1341 .help = "Override default $jobname.$jobnum.$filenum naming",
1342 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001343 .category = FIO_OPT_C_FILE,
1344 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001345 },
1346 {
Jens Axboe29c13492008-03-01 19:25:20 +01001347 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001348 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001349 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001350 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001351 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001352 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001353 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001354 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001355 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001356 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001357 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001358 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001359 .posval = {
1360 { .ival = "none",
1361 .oval = FILE_LOCK_NONE,
1362 .help = "No file locking",
1363 },
1364 { .ival = "exclusive",
1365 .oval = FILE_LOCK_EXCLUSIVE,
1366 .help = "Exclusive file lock",
1367 },
1368 {
1369 .ival = "readwrite",
1370 .oval = FILE_LOCK_READWRITE,
1371 .help = "Read vs write lock",
1372 },
1373 },
Jens Axboe29c13492008-03-01 19:25:20 +01001374 },
1375 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001376 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001377 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001378 .type = FIO_OPT_STR_STORE,
1379 .off1 = td_var_offset(opendir),
1380 .cb = str_opendir_cb,
1381 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001382 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001383 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001384 },
1385 {
1386 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001387 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001388 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001389 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001390 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001391 .off1 = td_var_offset(td_ddir),
1392 .help = "IO direction",
1393 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001394 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001395 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001396 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001397 .posval = {
1398 { .ival = "read",
1399 .oval = TD_DDIR_READ,
1400 .help = "Sequential read",
1401 },
1402 { .ival = "write",
1403 .oval = TD_DDIR_WRITE,
1404 .help = "Sequential write",
1405 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001406 { .ival = "trim",
1407 .oval = TD_DDIR_TRIM,
1408 .help = "Sequential trim",
1409 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001410 { .ival = "randread",
1411 .oval = TD_DDIR_RANDREAD,
1412 .help = "Random read",
1413 },
1414 { .ival = "randwrite",
1415 .oval = TD_DDIR_RANDWRITE,
1416 .help = "Random write",
1417 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001418 { .ival = "randtrim",
1419 .oval = TD_DDIR_RANDTRIM,
1420 .help = "Random trim",
1421 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001422 { .ival = "rw",
1423 .oval = TD_DDIR_RW,
1424 .help = "Sequential read and write mix",
1425 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001426 { .ival = "readwrite",
1427 .oval = TD_DDIR_RW,
1428 .help = "Sequential read and write mix",
1429 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001430 { .ival = "randrw",
1431 .oval = TD_DDIR_RANDRW,
1432 .help = "Random read and write mix"
1433 },
1434 },
1435 },
1436 {
Jens Axboe38dad622010-07-20 14:46:00 -06001437 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001438 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001439 .type = FIO_OPT_STR,
1440 .off1 = td_var_offset(rw_seq),
1441 .help = "IO offset generator modifier",
1442 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001443 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001444 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001445 .posval = {
1446 { .ival = "sequential",
1447 .oval = RW_SEQ_SEQ,
1448 .help = "Generate sequential offsets",
1449 },
1450 { .ival = "identical",
1451 .oval = RW_SEQ_IDENT,
1452 .help = "Generate identical offsets",
1453 },
1454 },
1455 },
1456
1457 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001458 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001459 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001460 .type = FIO_OPT_STR_STORE,
1461 .off1 = td_var_offset(ioengine),
1462 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001463 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001464 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001465 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001466 .posval = {
1467 { .ival = "sync",
1468 .help = "Use read/write",
1469 },
gurudas paia31041e2007-10-23 15:12:30 +02001470 { .ival = "psync",
1471 .help = "Use pread/pwrite",
1472 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001473 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001474 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001475 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001476#ifdef CONFIG_PWRITEV
1477 { .ival = "pvsync",
1478 .help = "Use preadv/pwritev",
1479 },
1480#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001481#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001482 { .ival = "libaio",
1483 .help = "Linux native asynchronous IO",
1484 },
1485#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001486#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001487 { .ival = "posixaio",
1488 .help = "POSIX asynchronous IO",
1489 },
1490#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001491#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001492 { .ival = "solarisaio",
1493 .help = "Solaris native asynchronous IO",
1494 },
1495#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001496#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001497 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001498 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001499 },
Jens Axboe3be80072011-01-19 11:07:28 -07001500#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001501#ifdef CONFIG_RBD
1502 { .ival = "rbd",
1503 .help = "Rados Block Device asynchronous IO"
1504 },
1505#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001506 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001507 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001508 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001509#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001510 { .ival = "splice",
1511 .help = "splice/vmsplice based IO",
1512 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001513 { .ival = "netsplice",
1514 .help = "splice/vmsplice to/from the network",
1515 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001516#endif
1517#ifdef FIO_HAVE_SGIO
1518 { .ival = "sg",
1519 .help = "SCSI generic v3 IO",
1520 },
1521#endif
1522 { .ival = "null",
1523 .help = "Testing engine (no data transfer)",
1524 },
1525 { .ival = "net",
1526 .help = "Network IO",
1527 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001528 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001529 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001530 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001531#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001532 { .ival = "guasi",
1533 .help = "GUASI IO engine",
1534 },
1535#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001536#ifdef FIO_HAVE_BINJECT
1537 { .ival = "binject",
1538 .help = "binject direct inject block engine",
1539 },
1540#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001541#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001542 { .ival = "rdma",
1543 .help = "RDMA IO engine",
1544 },
1545#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001546#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001547 { .ival = "fusion-aw-sync",
1548 .help = "Fusion-io atomic write engine",
1549 },
1550#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001551#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001552 { .ival = "e4defrag",
1553 .help = "ext4 defrag engine",
1554 },
1555#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001556#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001557 { .ival = "falloc",
1558 .help = "fallocate() file based engine",
1559 },
1560#endif
chenh321fc5a2014-03-31 11:32:29 -04001561#ifdef CONFIG_GFAPI
1562 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001563 .help = "Glusterfs libgfapi(sync) based engine"
1564 },
1565 { .ival = "gfapi_async",
1566 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001567 },
1568#endif
Manish Mandlikd60aa362014-08-13 13:36:52 -06001569#ifdef CONFIG_LIBHDFS
Manish Mandlik44e2ab52014-08-14 11:45:16 -06001570 { .ival = "libhdfs",
Manish Mandlikd60aa362014-08-13 13:36:52 -06001571 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1572 },
1573#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001574 { .ival = "external",
1575 .help = "Load external engine (append name)",
1576 },
1577 },
1578 },
1579 {
1580 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001581 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001582 .type = FIO_OPT_INT,
1583 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001584 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001585 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001586 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001587 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001588 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001589 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001590 },
1591 {
1592 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001593 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001594 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001595 .type = FIO_OPT_INT,
1596 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001597 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001598 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001599 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001600 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001601 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001602 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001603 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001604 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001605 },
1606 {
Jens Axboe49504212008-06-05 09:03:30 +02001607 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001608 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001609 .type = FIO_OPT_INT,
1610 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001611 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001612 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001613 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001614 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001615 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001616 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001617 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001618 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001619 },
1620 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001621 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001622 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001623 .type = FIO_OPT_INT,
1624 .off1 = td_var_offset(iodepth_low),
1625 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001626 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001627 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001628 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001629 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001630 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001631 },
1632 {
1633 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001634 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001635 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001636 .cb = str_size_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001637 .off1 = td_var_offset(size),
Jens Axboe214e1ec2007-03-15 10:48:13 +01001638 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001639 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001640 .category = FIO_OPT_C_IO,
1641 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001642 },
1643 {
Jens Axboeb65f3922014-12-10 19:21:37 -07001644 .name = "io_size",
1645 .alias = "io_limit",
1646 .lname = "IO Size",
Jens Axboe77731b22014-04-28 12:08:47 -06001647 .type = FIO_OPT_STR_VAL,
1648 .off1 = td_var_offset(io_limit),
1649 .interval = 1024 * 1024,
1650 .category = FIO_OPT_C_IO,
1651 .group = FIO_OPT_G_INVALID,
1652 },
1653 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001654 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001655 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001656 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001657 .type = FIO_OPT_BOOL,
1658 .off1 = td_var_offset(fill_device),
1659 .help = "Write until an ENOSPC error occurs",
1660 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001661 .category = FIO_OPT_C_FILE,
1662 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001663 },
1664 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001665 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001666 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001667 .type = FIO_OPT_STR_VAL,
1668 .off1 = td_var_offset(file_size_low),
1669 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001670 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001671 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001672 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001673 .category = FIO_OPT_C_FILE,
1674 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001675 },
1676 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001677 .name = "file_append",
1678 .lname = "File append",
1679 .type = FIO_OPT_BOOL,
1680 .off1 = td_var_offset(file_append),
1681 .help = "IO will start at the end of the file(s)",
1682 .def = "0",
1683 .category = FIO_OPT_C_FILE,
1684 .group = FIO_OPT_G_INVALID,
1685 },
1686 {
Jens Axboe67a10002007-07-31 23:12:16 +02001687 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001688 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001689 .alias = "fileoffset",
1690 .type = FIO_OPT_STR_VAL,
1691 .off1 = td_var_offset(start_offset),
1692 .help = "Start IO from this offset",
1693 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001694 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001695 .category = FIO_OPT_C_IO,
1696 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001697 },
1698 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001699 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001700 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001701 .type = FIO_OPT_STR_VAL,
1702 .off1 = td_var_offset(offset_increment),
1703 .help = "What is the increment from one offset to the next",
1704 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001705 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001706 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001707 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001710 },
1711 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001712 .name = "number_ios",
1713 .lname = "Number of IOs to perform",
1714 .type = FIO_OPT_STR_VAL,
1715 .off1 = td_var_offset(number_ios),
Jens Axboe0b24a952014-09-28 16:24:23 -06001716 .help = "Force job completion after this number of IOs",
Jens Axboeddf24e42013-08-09 12:53:44 -06001717 .def = "0",
1718 .category = FIO_OPT_C_IO,
1719 .group = FIO_OPT_G_INVALID,
1720 },
1721 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001722 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001723 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001724 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001725 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001726 .off1 = td_var_offset(bs[DDIR_READ]),
1727 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001728 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001729 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001730 .help = "Block size unit",
1731 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001732 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001733 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001734 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001735 .category = FIO_OPT_C_IO,
1736 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001737 },
1738 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001739 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001740 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001741 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001742 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001743 .off1 = td_var_offset(ba[DDIR_READ]),
1744 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001745 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001746 .minval = 1,
1747 .help = "IO block offset alignment",
1748 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001749 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001750 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001751 .category = FIO_OPT_C_IO,
1752 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001753 },
1754 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001755 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001756 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001757 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001758 .type = FIO_OPT_RANGE,
1759 .off1 = td_var_offset(min_bs[DDIR_READ]),
1760 .off2 = td_var_offset(max_bs[DDIR_READ]),
1761 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1762 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001763 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1764 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001765 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001766 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001767 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001768 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001769 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001770 .category = FIO_OPT_C_IO,
1771 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001772 },
1773 {
Jens Axboe564ca972007-12-14 12:21:19 +01001774 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001775 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001776 .type = FIO_OPT_STR,
1777 .cb = str_bssplit_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07001778 .off1 = td_var_offset(bssplit),
Jens Axboe564ca972007-12-14 12:21:19 +01001779 .help = "Set a specific mix of block sizes",
1780 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001781 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001782 .category = FIO_OPT_C_IO,
1783 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001784 },
1785 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001786 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001787 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001788 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001789 .type = FIO_OPT_STR_SET,
1790 .off1 = td_var_offset(bs_unaligned),
1791 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001792 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001793 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001794 .category = FIO_OPT_C_IO,
1795 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001796 },
1797 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001798 .name = "bs_is_seq_rand",
1799 .lname = "Block size division is seq/random (not read/write)",
1800 .type = FIO_OPT_BOOL,
1801 .off1 = td_var_offset(bs_is_seq_rand),
Jens Axboe86051d42014-09-28 16:25:49 -06001802 .help = "Consider any blocksize setting to be sequential,random",
Jens Axboe6aca9b32013-07-25 12:45:26 -06001803 .def = "0",
1804 .parent = "blocksize",
1805 .category = FIO_OPT_C_IO,
1806 .group = FIO_OPT_G_INVALID,
1807 },
1808 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001809 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001810 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001811 .type = FIO_OPT_BOOL,
1812 .off1 = td_var_offset(rand_repeatable),
1813 .help = "Use repeatable random IO pattern",
1814 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001815 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001816 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001817 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001818 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001819 },
1820 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001821 .name = "randseed",
1822 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001823 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001824 .off1 = td_var_offset(rand_seed),
1825 .help = "Set the random generator seed value",
1826 .parent = "rw",
1827 .category = FIO_OPT_C_IO,
1828 .group = FIO_OPT_G_RANDOM,
1829 },
1830 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001831 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001832 .lname = "Use OS random",
Jens Axboe559073f2014-11-05 18:34:02 -07001833 .type = FIO_OPT_DEPRECATED,
1834 .off1 = td_var_offset(dep_use_os_rand),
Jens Axboee8b0e952012-03-19 14:37:08 +01001835 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001836 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001837 },
1838 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001839 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001840 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001841 .type = FIO_OPT_STR_SET,
1842 .off1 = td_var_offset(norandommap),
1843 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001844 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001845 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001846 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001847 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001848 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001849 },
1850 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001851 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001852 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001853 .type = FIO_OPT_BOOL,
1854 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001855 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001856 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001857 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001858 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001859 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001860 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001861 },
1862 {
Jens Axboe8055e412012-11-26 08:43:47 +01001863 .name = "random_generator",
1864 .type = FIO_OPT_STR,
1865 .off1 = td_var_offset(random_generator),
1866 .help = "Type of random number generator to use",
1867 .def = "tausworthe",
1868 .posval = {
1869 { .ival = "tausworthe",
1870 .oval = FIO_RAND_GEN_TAUSWORTHE,
1871 .help = "Strong Tausworthe generator",
1872 },
1873 { .ival = "lfsr",
1874 .oval = FIO_RAND_GEN_LFSR,
1875 .help = "Variable length LFSR",
1876 },
1877 },
Jens Axboe48107592012-12-04 09:43:11 +01001878 .category = FIO_OPT_C_IO,
1879 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001880 },
1881 {
Jens Axboee25839d2012-11-06 10:49:42 +01001882 .name = "random_distribution",
1883 .type = FIO_OPT_STR,
1884 .off1 = td_var_offset(random_distribution),
1885 .cb = str_random_distribution_cb,
1886 .help = "Random offset distribution generator",
1887 .def = "random",
1888 .posval = {
1889 { .ival = "random",
1890 .oval = FIO_RAND_DIST_RANDOM,
1891 .help = "Completely random",
1892 },
1893 { .ival = "zipf",
1894 .oval = FIO_RAND_DIST_ZIPF,
1895 .help = "Zipf distribution",
1896 },
Jens Axboe925fee32012-11-06 13:50:32 +01001897 { .ival = "pareto",
1898 .oval = FIO_RAND_DIST_PARETO,
1899 .help = "Pareto distribution",
1900 },
Jens Axboee25839d2012-11-06 10:49:42 +01001901 },
Jens Axboe48107592012-12-04 09:43:11 +01001902 .category = FIO_OPT_C_IO,
1903 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001904 },
1905 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001906 .name = "percentage_random",
1907 .lname = "Percentage Random",
1908 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001909 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1910 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1911 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001912 .maxval = 100,
1913 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001914 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001915 .interval = 5,
1916 .inverse = "percentage_sequential",
1917 .category = FIO_OPT_C_IO,
1918 .group = FIO_OPT_G_RANDOM,
1919 },
1920 {
1921 .name = "percentage_sequential",
1922 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001923 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001924 .category = FIO_OPT_C_IO,
1925 .group = FIO_OPT_G_RANDOM,
1926 },
1927 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001928 .name = "allrandrepeat",
1929 .type = FIO_OPT_BOOL,
1930 .off1 = td_var_offset(allrand_repeatable),
1931 .help = "Use repeatable random numbers for everything",
1932 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001935 },
1936 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001937 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001938 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001939 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001940 .type = FIO_OPT_INT,
1941 .off1 = td_var_offset(nr_files),
1942 .help = "Split job workload between this number of files",
1943 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001944 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001945 .category = FIO_OPT_C_FILE,
1946 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001947 },
1948 {
1949 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001950 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001951 .type = FIO_OPT_INT,
1952 .off1 = td_var_offset(open_files),
1953 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001954 .category = FIO_OPT_C_FILE,
1955 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001956 },
1957 {
1958 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001959 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001960 .type = FIO_OPT_STR,
1961 .cb = str_fst_cb,
1962 .off1 = td_var_offset(file_service_type),
1963 .help = "How to select which file to service next",
1964 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001965 .category = FIO_OPT_C_FILE,
1966 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001967 .posval = {
1968 { .ival = "random",
1969 .oval = FIO_FSERVICE_RANDOM,
1970 .help = "Choose a file at random",
1971 },
1972 { .ival = "roundrobin",
1973 .oval = FIO_FSERVICE_RR,
1974 .help = "Round robin select files",
1975 },
Jens Axboea086c252009-03-04 08:27:37 +01001976 { .ival = "sequential",
1977 .oval = FIO_FSERVICE_SEQ,
1978 .help = "Finish one file before moving to the next",
1979 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001980 },
Jens Axboe67a10002007-07-31 23:12:16 +02001981 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001982 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001983 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001984#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001985 {
1986 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001987 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001988 .type = FIO_OPT_STR,
1989 .off1 = td_var_offset(fallocate_mode),
1990 .help = "Whether pre-allocation is performed when laying out files",
1991 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001992 .category = FIO_OPT_C_FILE,
1993 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001994 .posval = {
1995 { .ival = "none",
1996 .oval = FIO_FALLOCATE_NONE,
1997 .help = "Do not pre-allocate space",
1998 },
1999 { .ival = "posix",
2000 .oval = FIO_FALLOCATE_POSIX,
2001 .help = "Use posix_fallocate()",
2002 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002003#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02002004 { .ival = "keep",
2005 .oval = FIO_FALLOCATE_KEEP_SIZE,
2006 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2007 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01002008#endif
Eric Gourioua596f042011-06-17 09:11:45 +02002009 /* Compatibility with former boolean values */
2010 { .ival = "0",
2011 .oval = FIO_FALLOCATE_NONE,
2012 .help = "Alias for 'none'",
2013 },
2014 { .ival = "1",
2015 .oval = FIO_FALLOCATE_POSIX,
2016 .help = "Alias for 'posix'",
2017 },
2018 },
2019 },
Jens Axboe97ac9922013-01-24 15:00:25 -07002020#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02002021 {
2022 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01002023 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02002024 .type = FIO_OPT_BOOL,
2025 .off1 = td_var_offset(fadvise_hint),
2026 .help = "Use fadvise() to advise the kernel on IO pattern",
2027 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002028 .category = FIO_OPT_C_FILE,
2029 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002030 },
2031 {
2032 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002033 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002034 .type = FIO_OPT_INT,
2035 .off1 = td_var_offset(fsync_blocks),
2036 .help = "Issue fsync for writes every given number of blocks",
2037 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002038 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002039 .category = FIO_OPT_C_FILE,
2040 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002041 },
2042 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002043 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002044 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002045 .type = FIO_OPT_INT,
2046 .off1 = td_var_offset(fdatasync_blocks),
2047 .help = "Issue fdatasync for writes every given number of blocks",
2048 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002049 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002050 .category = FIO_OPT_C_FILE,
2051 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002052 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002053 {
2054 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002055 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002056 .type = FIO_OPT_INT,
2057 .off1 = td_var_offset(barrier_blocks),
2058 .help = "Make every Nth write a barrier write",
2059 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002060 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002061 .category = FIO_OPT_C_IO,
2062 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002063 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002064#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002065 {
2066 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002067 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002068 .posval = {
2069 { .ival = "wait_before",
2070 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2071 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002072 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002073 },
2074 { .ival = "write",
2075 .oval = SYNC_FILE_RANGE_WRITE,
2076 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002077 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002078 },
2079 {
2080 .ival = "wait_after",
2081 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2082 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002083 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002084 },
2085 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002086 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002087 .cb = str_sfr_cb,
2088 .off1 = td_var_offset(sync_file_range),
2089 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002090 .category = FIO_OPT_C_FILE,
2091 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002092 },
2093#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002094 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002095 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002096 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002097 .type = FIO_OPT_BOOL,
2098 .off1 = td_var_offset(odirect),
2099 .help = "Use O_DIRECT IO (negates buffered)",
2100 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002101 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002102 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002103 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002104 },
2105 {
Chris Masond01612f2013-11-15 15:52:58 -07002106 .name = "atomic",
2107 .lname = "Atomic I/O",
2108 .type = FIO_OPT_BOOL,
2109 .off1 = td_var_offset(oatomic),
2110 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2111 .def = "0",
2112 .category = FIO_OPT_C_IO,
2113 .group = FIO_OPT_G_IO_TYPE,
2114 },
2115 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002116 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002117 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002118 .type = FIO_OPT_BOOL,
2119 .off1 = td_var_offset(odirect),
2120 .neg = 1,
2121 .help = "Use buffered IO (negates direct)",
2122 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002123 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002124 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002125 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002126 },
2127 {
2128 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002129 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002130 .type = FIO_OPT_BOOL,
2131 .off1 = td_var_offset(overwrite),
2132 .help = "When writing, set whether to overwrite current data",
2133 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002134 .category = FIO_OPT_C_FILE,
2135 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002136 },
2137 {
2138 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002139 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002140 .type = FIO_OPT_INT,
2141 .off1 = td_var_offset(loops),
2142 .help = "Number of times to run the job",
2143 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002144 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002145 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002146 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002147 },
2148 {
2149 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002150 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002151 .type = FIO_OPT_INT,
2152 .off1 = td_var_offset(numjobs),
2153 .help = "Duplicate this job this many times",
2154 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002155 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002156 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002157 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002158 },
2159 {
2160 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002161 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002162 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002163 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002164 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002165 .help = "Only start job when this period has passed",
2166 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002167 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002168 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002169 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002170 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002171 },
2172 {
2173 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002174 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002175 .alias = "timeout",
2176 .type = FIO_OPT_STR_VAL_TIME,
2177 .off1 = td_var_offset(timeout),
2178 .help = "Stop workload when this amount of time has passed",
2179 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002180 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002181 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002182 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002183 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002184 },
2185 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002186 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002187 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002188 .type = FIO_OPT_STR_SET,
2189 .off1 = td_var_offset(time_based),
2190 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002191 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002192 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002193 },
2194 {
Juan Casse62167762013-09-17 14:06:13 -07002195 .name = "verify_only",
2196 .lname = "Verify only",
2197 .type = FIO_OPT_STR_SET,
2198 .off1 = td_var_offset(verify_only),
2199 .help = "Verifies previously written data is still valid",
2200 .category = FIO_OPT_C_GENERAL,
2201 .group = FIO_OPT_G_RUNTIME,
2202 },
2203 {
Jens Axboe721938a2008-09-10 09:46:16 +02002204 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002205 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002206 .type = FIO_OPT_STR_VAL_TIME,
2207 .off1 = td_var_offset(ramp_time),
2208 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002209 .is_seconds = 1,
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002210 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002211 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002212 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002213 },
2214 {
Jens Axboec223da82010-03-24 13:23:53 +01002215 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002216 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002217 .type = FIO_OPT_STR,
2218 .cb = fio_clock_source_cb,
2219 .off1 = td_var_offset(clocksource),
2220 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002221 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002222 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002223 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002224#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002225 { .ival = "gettimeofday",
2226 .oval = CS_GTOD,
2227 .help = "Use gettimeofday(2) for timing",
2228 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002229#endif
2230#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002231 { .ival = "clock_gettime",
2232 .oval = CS_CGETTIME,
2233 .help = "Use clock_gettime(2) for timing",
2234 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002235#endif
Jens Axboec223da82010-03-24 13:23:53 +01002236#ifdef ARCH_HAVE_CPU_CLOCK
2237 { .ival = "cpu",
2238 .oval = CS_CPUCLOCK,
2239 .help = "Use CPU private clock",
2240 },
2241#endif
2242 },
2243 },
2244 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002245 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002246 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002247 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002248 .type = FIO_OPT_STR,
2249 .cb = str_mem_cb,
2250 .off1 = td_var_offset(mem_type),
2251 .help = "Backing type for IO buffers",
2252 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002253 .category = FIO_OPT_C_IO,
2254 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002255 .posval = {
2256 { .ival = "malloc",
2257 .oval = MEM_MALLOC,
2258 .help = "Use malloc(3) for IO buffers",
2259 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002260#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002261 { .ival = "shm",
2262 .oval = MEM_SHM,
2263 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002264 },
2265#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002266 { .ival = "shmhuge",
2267 .oval = MEM_SHMHUGE,
2268 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002269 },
2270#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002271#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002272 { .ival = "mmap",
2273 .oval = MEM_MMAP,
2274 .help = "Use mmap(2) (file or anon) for IO buffers",
2275 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002276#ifdef FIO_HAVE_HUGETLB
2277 { .ival = "mmaphuge",
2278 .oval = MEM_MMAPHUGE,
2279 .help = "Like mmap, but use huge pages",
2280 },
2281#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002282 },
2283 },
2284 {
Jens Axboed529ee12009-07-01 10:33:03 +02002285 .name = "iomem_align",
2286 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002287 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002288 .type = FIO_OPT_INT,
2289 .off1 = td_var_offset(mem_align),
2290 .minval = 0,
2291 .help = "IO memory buffer offset alignment",
2292 .def = "0",
2293 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002294 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002295 .category = FIO_OPT_C_IO,
2296 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002297 },
2298 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002299 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002300 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002301 .type = FIO_OPT_STR,
2302 .off1 = td_var_offset(verify),
2303 .help = "Verify data written",
2304 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002305 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002306 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002307 .posval = {
2308 { .ival = "0",
2309 .oval = VERIFY_NONE,
2310 .help = "Don't do IO verification",
2311 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002312 { .ival = "md5",
2313 .oval = VERIFY_MD5,
2314 .help = "Use md5 checksums for verification",
2315 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002316 { .ival = "crc64",
2317 .oval = VERIFY_CRC64,
2318 .help = "Use crc64 checksums for verification",
2319 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002320 { .ival = "crc32",
2321 .oval = VERIFY_CRC32,
2322 .help = "Use crc32 checksums for verification",
2323 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002324 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002325 .oval = VERIFY_CRC32C,
2326 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002327 },
Jens Axboebac39e02008-06-11 20:46:19 +02002328 { .ival = "crc32c",
2329 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002330 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002331 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002332 { .ival = "crc16",
2333 .oval = VERIFY_CRC16,
2334 .help = "Use crc16 checksums for verification",
2335 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002336 { .ival = "crc7",
2337 .oval = VERIFY_CRC7,
2338 .help = "Use crc7 checksums for verification",
2339 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002340 { .ival = "sha1",
2341 .oval = VERIFY_SHA1,
2342 .help = "Use sha1 checksums for verification",
2343 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002344 { .ival = "sha256",
2345 .oval = VERIFY_SHA256,
2346 .help = "Use sha256 checksums for verification",
2347 },
2348 { .ival = "sha512",
2349 .oval = VERIFY_SHA512,
2350 .help = "Use sha512 checksums for verification",
2351 },
Jens Axboe844ea602014-02-20 13:21:45 -08002352 { .ival = "xxhash",
2353 .oval = VERIFY_XXHASH,
2354 .help = "Use xxhash checksums for verification",
2355 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002356 { .ival = "meta",
2357 .oval = VERIFY_META,
2358 .help = "Use io information",
2359 },
Jens Axboe36690c92007-03-26 10:23:34 +02002360 {
2361 .ival = "null",
2362 .oval = VERIFY_NULL,
2363 .help = "Pretend to verify",
2364 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002365 },
2366 },
2367 {
Jens Axboe005c5652007-08-02 22:21:36 +02002368 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002369 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002370 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002371 .off1 = td_var_offset(do_verify),
2372 .help = "Run verification stage after write",
2373 .def = "1",
2374 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002375 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002376 .category = FIO_OPT_C_IO,
2377 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002378 },
2379 {
Jens Axboe160b9662007-03-27 10:59:49 +02002380 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002381 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002382 .type = FIO_OPT_BOOL,
2383 .off1 = td_var_offset(verifysort),
2384 .help = "Sort written verify blocks for read back",
2385 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002386 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002387 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002388 .category = FIO_OPT_C_IO,
2389 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002390 },
2391 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002392 .name = "verifysort_nr",
2393 .type = FIO_OPT_INT,
2394 .off1 = td_var_offset(verifysort_nr),
2395 .help = "Pre-load and sort verify blocks for a read workload",
2396 .minval = 0,
2397 .maxval = 131072,
2398 .def = "1024",
2399 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002400 .category = FIO_OPT_C_IO,
2401 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002402 },
2403 {
Jens Axboea59e1702007-07-30 08:53:27 +02002404 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002405 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002406 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002407 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002408 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002409 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002410 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002411 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002412 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002415 },
2416 {
Jens Axboea59e1702007-07-30 08:53:27 +02002417 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002418 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002419 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002420 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002421 .off1 = td_var_offset(verify_offset),
2422 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002423 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002424 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002425 .category = FIO_OPT_C_IO,
2426 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002427 },
2428 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002429 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002430 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002431 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002432 .cb = str_verify_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002433 .off1 = td_var_offset(verify_pattern),
Shawn Lewise28218f2008-01-16 11:01:33 +01002434 .help = "Fill pattern for IO buffers",
2435 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002436 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002437 .category = FIO_OPT_C_IO,
2438 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002439 },
2440 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002441 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002442 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002443 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002444 .off1 = td_var_offset(verify_fatal),
2445 .def = "0",
2446 .help = "Exit on a single verify failure, don't continue",
2447 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002448 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002449 .category = FIO_OPT_C_IO,
2450 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002451 },
2452 {
Jens Axboeb463e932011-01-12 09:03:23 +01002453 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002454 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002455 .type = FIO_OPT_BOOL,
2456 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002457 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002458 .help = "Dump contents of good and bad blocks on failure",
2459 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002460 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002463 },
2464 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002465 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002466 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002467 .type = FIO_OPT_INT,
2468 .off1 = td_var_offset(verify_async),
2469 .def = "0",
2470 .help = "Number of async verifier threads to use",
2471 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002472 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002475 },
Jens Axboe9e144182010-06-15 14:25:36 +02002476 {
2477 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002478 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002479 .type = FIO_OPT_STR_VAL,
2480 .off1 = td_var_offset(verify_backlog),
2481 .help = "Verify after this number of blocks are written",
2482 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002483 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002486 },
2487 {
2488 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002489 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002490 .type = FIO_OPT_INT,
2491 .off1 = td_var_offset(verify_batch),
2492 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002493 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002494 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002497 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002498#ifdef FIO_HAVE_CPU_AFFINITY
2499 {
2500 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002501 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002502 .type = FIO_OPT_STR,
2503 .cb = str_verify_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002504 .off1 = td_var_offset(verify_cpumask),
Jens Axboee8462bd2009-07-06 12:59:04 +02002505 .help = "Set CPUs allowed for async verify threads",
2506 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002507 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002510 },
2511#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002512 {
2513 .name = "experimental_verify",
2514 .off1 = td_var_offset(experimental_verify),
2515 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002516 .help = "Enable experimental verification",
Jens Axboede54cfd2014-11-10 20:34:00 -07002517 .parent = "verify",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_VERIFY,
2520 },
2521 {
2522 .name = "verify_state_load",
2523 .lname = "Load verify state",
2524 .off1 = td_var_offset(verify_state),
2525 .type = FIO_OPT_BOOL,
2526 .help = "Load verify termination state",
2527 .parent = "verify",
2528 .category = FIO_OPT_C_IO,
2529 .group = FIO_OPT_G_VERIFY,
2530 },
2531 {
2532 .name = "verify_state_save",
2533 .lname = "Save verify state",
2534 .off1 = td_var_offset(verify_state_save),
2535 .type = FIO_OPT_BOOL,
2536 .def = "1",
2537 .help = "Save verify state on termination",
2538 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002539 .category = FIO_OPT_C_IO,
2540 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002541 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002542#ifdef FIO_HAVE_TRIM
2543 {
2544 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002545 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002546 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002547 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002548 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002549 .maxval = 100,
2550 .help = "Number of verify blocks to discard/trim",
2551 .parent = "verify",
2552 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002553 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002554 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002557 },
2558 {
2559 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002560 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002561 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002562 .help = "Verify that trim/discarded blocks are returned as zeroes",
2563 .off1 = td_var_offset(trim_zero),
2564 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002565 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002566 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002569 },
2570 {
2571 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002572 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002573 .type = FIO_OPT_STR_VAL,
2574 .off1 = td_var_offset(trim_backlog),
2575 .help = "Trim after this number of blocks are written",
2576 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002577 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002578 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002581 },
2582 {
2583 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002584 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002585 .type = FIO_OPT_INT,
2586 .off1 = td_var_offset(trim_batch),
2587 .help = "Trim this number of IO blocks",
2588 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002589 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002590 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002593 },
2594#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002595 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002596 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002597 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002598 .type = FIO_OPT_STR_STORE,
2599 .off1 = td_var_offset(write_iolog_file),
2600 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002601 .category = FIO_OPT_C_IO,
2602 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002603 },
2604 {
2605 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002606 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002607 .type = FIO_OPT_STR_STORE,
2608 .off1 = td_var_offset(read_iolog_file),
2609 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002612 },
2613 {
David Nellans64bbb862010-08-24 22:13:30 +02002614 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002615 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002616 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002617 .off1 = td_var_offset(no_stall),
2618 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002619 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002620 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002621 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002622 .category = FIO_OPT_C_IO,
2623 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002624 },
2625 {
David Nellansd1c46c02010-08-31 21:20:47 +02002626 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002627 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002628 .type = FIO_OPT_STR_STORE,
2629 .off1 = td_var_offset(replay_redirect),
2630 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002631 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002632 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002633 .category = FIO_OPT_C_IO,
2634 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002635 },
2636 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002637 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002638 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002639 .type = FIO_OPT_STR_STORE,
2640 .off1 = td_var_offset(exec_prerun),
2641 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002642 .category = FIO_OPT_C_GENERAL,
2643 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002644 },
2645 {
2646 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002647 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002648 .type = FIO_OPT_STR_STORE,
2649 .off1 = td_var_offset(exec_postrun),
2650 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002653 },
2654#ifdef FIO_HAVE_IOSCHED_SWITCH
2655 {
2656 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002657 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002658 .type = FIO_OPT_STR_STORE,
2659 .off1 = td_var_offset(ioscheduler),
2660 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002661 .category = FIO_OPT_C_FILE,
2662 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002663 },
2664#endif
2665 {
2666 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002667 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002670 .help = "Amount of data to read per zone",
2671 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002672 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002675 },
2676 {
2677 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002678 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002679 .type = FIO_OPT_STR_VAL,
2680 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002681 .help = "Give size of an IO zone",
2682 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002683 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002686 },
2687 {
2688 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002689 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002690 .type = FIO_OPT_STR_VAL,
2691 .off1 = td_var_offset(zone_skip),
2692 .help = "Space between IO zones",
2693 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002694 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002695 .category = FIO_OPT_C_IO,
2696 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002697 },
2698 {
2699 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002700 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002701 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002702 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002703 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002704 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002705 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002706 .category = FIO_OPT_C_GENERAL,
2707 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002708 },
2709 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002710 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002711 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002712 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002713 .cb = str_rwmix_read_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002714 .off1 = td_var_offset(rwmix[DDIR_READ]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002715 .maxval = 100,
2716 .help = "Percentage of mixed workload that is reads",
2717 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002718 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002719 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002720 .category = FIO_OPT_C_IO,
2721 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002722 },
2723 {
2724 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002725 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002726 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002727 .cb = str_rwmix_write_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002728 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002729 .maxval = 100,
2730 .help = "Percentage of mixed workload that is writes",
2731 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002732 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002733 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002734 .category = FIO_OPT_C_IO,
2735 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002736 },
2737 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002738 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002739 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002740 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002741 .category = FIO_OPT_C_IO,
2742 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002743 },
2744 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002745 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002746 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002747 .type = FIO_OPT_INT,
2748 .off1 = td_var_offset(nice),
2749 .help = "Set job CPU nice value",
2750 .minval = -19,
2751 .maxval = 20,
2752 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002753 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002754 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002755 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002756 },
2757#ifdef FIO_HAVE_IOPRIO
2758 {
2759 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002760 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002761 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002762 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002763 .help = "Set job IO priority value",
2764 .minval = 0,
2765 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002766 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002767 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002768 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002769 },
2770 {
2771 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002772 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002773 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002774 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002775 .help = "Set job IO priority class",
2776 .minval = 0,
2777 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002778 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002779 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002780 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002781 },
2782#endif
2783 {
2784 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002785 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002786 .type = FIO_OPT_INT,
2787 .off1 = td_var_offset(thinktime),
2788 .help = "Idle time between IO buffers (usec)",
2789 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002790 .is_time = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002791 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002792 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002793 },
2794 {
2795 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002796 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002797 .type = FIO_OPT_INT,
2798 .off1 = td_var_offset(thinktime_spin),
2799 .help = "Start think time by spinning this amount (usec)",
2800 .def = "0",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002801 .is_time = 1,
Jens Axboeafdf9352007-07-31 16:14:34 +02002802 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002803 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002804 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002805 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002806 },
2807 {
2808 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002809 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002810 .type = FIO_OPT_INT,
2811 .off1 = td_var_offset(thinktime_blocks),
2812 .help = "IO buffer period between 'thinktime'",
2813 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002814 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002815 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002816 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002817 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002818 },
2819 {
2820 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002821 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002822 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002823 .off1 = td_var_offset(rate[DDIR_READ]),
2824 .off2 = td_var_offset(rate[DDIR_WRITE]),
2825 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002826 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002827 .category = FIO_OPT_C_IO,
2828 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002829 },
2830 {
2831 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002832 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002833 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002834 .off1 = td_var_offset(ratemin[DDIR_READ]),
2835 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2836 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002837 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002838 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002839 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002840 .category = FIO_OPT_C_IO,
2841 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002842 },
2843 {
2844 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002845 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002846 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002847 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2848 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2849 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002850 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002851 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002852 .category = FIO_OPT_C_IO,
2853 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002854 },
2855 {
2856 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002857 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002858 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002859 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2860 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2861 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002862 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002863 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002864 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002865 .category = FIO_OPT_C_IO,
2866 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002867 },
2868 {
2869 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002870 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002871 .type = FIO_OPT_INT,
2872 .off1 = td_var_offset(ratecycle),
2873 .help = "Window average for rate limits (msec)",
2874 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002875 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002876 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002879 },
2880 {
Jens Axboe15501532012-10-24 16:37:45 +02002881 .name = "max_latency",
2882 .type = FIO_OPT_INT,
2883 .off1 = td_var_offset(max_latency),
2884 .help = "Maximum tolerated IO latency (usec)",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002885 .is_time = 1,
Jens Axboe1e5324e2012-11-14 14:25:31 -07002886 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002887 .group = FIO_OPT_G_LATPROF,
2888 },
2889 {
2890 .name = "latency_target",
2891 .lname = "Latency Target (usec)",
2892 .type = FIO_OPT_STR_VAL_TIME,
2893 .off1 = td_var_offset(latency_target),
2894 .help = "Ramp to max queue depth supporting this latency",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002895 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_LATPROF,
2898 },
2899 {
2900 .name = "latency_window",
2901 .lname = "Latency Window (usec)",
2902 .type = FIO_OPT_STR_VAL_TIME,
2903 .off1 = td_var_offset(latency_window),
2904 .help = "Time to sustain latency_target",
Stephen M. Cameron79dc9142014-11-10 20:31:26 -07002905 .is_time = 1,
Jens Axboe3e260a42013-12-09 12:38:53 -07002906 .category = FIO_OPT_C_IO,
2907 .group = FIO_OPT_G_LATPROF,
2908 },
2909 {
2910 .name = "latency_percentile",
2911 .lname = "Latency Percentile",
2912 .type = FIO_OPT_FLOAT_LIST,
2913 .off1 = td_var_offset(latency_percentile),
2914 .help = "Percentile of IOs must be below latency_target",
2915 .def = "100",
2916 .maxlen = 1,
2917 .minfp = 0.0,
2918 .maxfp = 100.0,
2919 .category = FIO_OPT_C_IO,
2920 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002921 },
2922 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002923 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002924 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002925 .type = FIO_OPT_BOOL,
2926 .off1 = td_var_offset(invalidate_cache),
2927 .help = "Invalidate buffer/page cache prior to running job",
2928 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002929 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002930 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002931 },
2932 {
2933 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002934 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002935 .type = FIO_OPT_BOOL,
2936 .off1 = td_var_offset(sync_io),
2937 .help = "Use O_SYNC for buffered writes",
2938 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002939 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002940 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002941 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002942 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002943 },
2944 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002945 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002946 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_serialize),
2949 .help = "Serialize creating of job files",
2950 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002951 .category = FIO_OPT_C_FILE,
2952 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002953 },
2954 {
2955 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002956 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002957 .type = FIO_OPT_BOOL,
2958 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002959 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002960 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002961 .category = FIO_OPT_C_FILE,
2962 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002963 },
2964 {
Jens Axboe814452b2009-03-04 12:53:13 +01002965 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(create_on_open),
2969 .help = "Create files when they are opened for IO",
2970 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002971 .category = FIO_OPT_C_FILE,
2972 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002973 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002974 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002975 .name = "create_only",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = td_var_offset(create_only),
2978 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002979 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002980 .def = "0",
2981 },
2982 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002983 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002984 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002985 .type = FIO_OPT_BOOL,
2986 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002987 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002988 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002989 .category = FIO_OPT_C_FILE,
2990 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002991 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002992#ifdef FIO_HAVE_CPU_AFFINITY
2993 {
2994 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002995 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002996 .type = FIO_OPT_INT,
2997 .cb = str_cpumask_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07002998 .off1 = td_var_offset(cpumask),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002999 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01003000 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003001 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003002 },
Jens Axboed2e268b2007-06-15 10:33:49 +02003003 {
3004 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01003005 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02003006 .type = FIO_OPT_STR,
3007 .cb = str_cpus_allowed_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003008 .off1 = td_var_offset(cpumask),
Jens Axboed2e268b2007-06-15 10:33:49 +02003009 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01003010 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003011 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02003012 },
Jens Axboec2acfba2014-02-27 15:52:02 -08003013 {
3014 .name = "cpus_allowed_policy",
3015 .lname = "CPUs allowed distribution policy",
3016 .type = FIO_OPT_STR,
3017 .off1 = td_var_offset(cpus_allowed_policy),
3018 .help = "Distribution policy for cpus_allowed",
3019 .parent = "cpus_allowed",
3020 .prio = 1,
3021 .posval = {
3022 { .ival = "shared",
3023 .oval = FIO_CPUS_SHARED,
3024 .help = "Mask shared between threads",
3025 },
3026 { .ival = "split",
3027 .oval = FIO_CPUS_SPLIT,
3028 .help = "Mask split between threads",
3029 },
3030 },
3031 .category = FIO_OPT_C_GENERAL,
3032 .group = FIO_OPT_G_CRED,
3033 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01003034#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01003035#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04003036 {
3037 .name = "numa_cpu_nodes",
3038 .type = FIO_OPT_STR,
3039 .cb = str_numa_cpunodes_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003040 .off1 = td_var_offset(numa_cpunodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003041 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02003042 .category = FIO_OPT_C_GENERAL,
3043 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003044 },
3045 {
3046 .name = "numa_mem_policy",
3047 .type = FIO_OPT_STR,
3048 .cb = str_numa_mpol_cb,
Jens Axboe94b360f2014-12-09 13:17:33 -07003049 .off1 = td_var_offset(numa_memnodes),
Yufei Rend0b937e2012-10-19 23:11:52 -04003050 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02003051 .category = FIO_OPT_C_GENERAL,
3052 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04003053 },
3054#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01003055 {
3056 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01003057 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003058 .type = FIO_OPT_BOOL,
3059 .off1 = td_var_offset(end_fsync),
3060 .help = "Include fsync at the end of job",
3061 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003062 .category = FIO_OPT_C_FILE,
3063 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003064 },
3065 {
3066 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003067 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003068 .type = FIO_OPT_BOOL,
3069 .off1 = td_var_offset(fsync_on_close),
3070 .help = "fsync files on close",
3071 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003072 .category = FIO_OPT_C_FILE,
3073 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003074 },
3075 {
3076 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003077 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003078 .type = FIO_OPT_BOOL,
3079 .off1 = td_var_offset(unlink),
3080 .help = "Unlink created files after job has completed",
3081 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003082 .category = FIO_OPT_C_FILE,
3083 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003084 },
3085 {
3086 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003087 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003088 .type = FIO_OPT_STR_SET,
3089 .cb = str_exitall_cb,
3090 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003091 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003092 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003093 },
3094 {
3095 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003096 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003097 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003098 .type = FIO_OPT_STR_SET,
3099 .off1 = td_var_offset(stonewall),
3100 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003101 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003102 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003103 },
3104 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003105 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003106 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003107 .type = FIO_OPT_STR_SET,
3108 .off1 = td_var_offset(new_group),
3109 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003110 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003111 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003112 },
3113 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003114 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003115 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003116 .type = FIO_OPT_STR_SET,
3117 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003118 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003119#ifdef CONFIG_NO_SHM
3120 .def = "1",
3121 .no_warn_def = 1,
3122#endif
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 Axboe214e1ec2007-03-15 10:48:13 +01003125 },
3126 {
3127 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003128 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003129 .type = FIO_OPT_STR_STORE,
3130 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003131 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003132 .category = FIO_OPT_C_LOG,
3133 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003134 },
3135 {
3136 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003137 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003138 .type = FIO_OPT_STR_STORE,
3139 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003140 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003141 .category = FIO_OPT_C_LOG,
3142 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003143 },
3144 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003145 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003146 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003147 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003148 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003149 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003150 .category = FIO_OPT_C_LOG,
3151 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003152 },
3153 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003154 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003155 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003156 .type = FIO_OPT_INT,
3157 .off1 = td_var_offset(log_avg_msec),
3158 .help = "Average bw/iops/lat logs over this period of time",
3159 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003162 },
3163 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003164 .name = "log_offset",
3165 .lname = "Log offset of IO",
3166 .type = FIO_OPT_BOOL,
3167 .off1 = td_var_offset(log_offset),
3168 .help = "Include offset of IO for each log entry",
3169 .def = "0",
3170 .category = FIO_OPT_C_LOG,
3171 .group = FIO_OPT_G_INVALID,
3172 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003173#ifdef CONFIG_ZLIB
3174 {
3175 .name = "log_compression",
3176 .lname = "Log compression",
3177 .type = FIO_OPT_INT,
3178 .off1 = td_var_offset(log_gz),
3179 .help = "Log in compressed chunks of this size",
3180 .minval = 32 * 1024 * 1024ULL,
3181 .maxval = 512 * 1024 * 1024ULL,
3182 .category = FIO_OPT_C_LOG,
3183 .group = FIO_OPT_G_INVALID,
3184 },
Jens Axboebac4af12014-07-03 13:42:28 -06003185 {
3186 .name = "log_store_compressed",
3187 .lname = "Log store compressed",
3188 .type = FIO_OPT_BOOL,
3189 .off1 = td_var_offset(log_gz_store),
3190 .help = "Store logs in a compressed format",
3191 .category = FIO_OPT_C_LOG,
3192 .group = FIO_OPT_G_INVALID,
3193 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003194#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003195 {
Jens Axboec504ee52012-03-20 11:29:09 +01003196 .name = "bwavgtime",
3197 .lname = "Bandwidth average time",
3198 .type = FIO_OPT_INT,
3199 .off1 = td_var_offset(bw_avg_time),
3200 .help = "Time window over which to calculate bandwidth"
3201 " (msec)",
3202 .def = "500",
3203 .parent = "write_bw_log",
3204 .hide = 1,
3205 .interval = 100,
3206 .category = FIO_OPT_C_LOG,
3207 .group = FIO_OPT_G_INVALID,
3208 },
3209 {
3210 .name = "iopsavgtime",
3211 .lname = "IOPS average time",
3212 .type = FIO_OPT_INT,
3213 .off1 = td_var_offset(iops_avg_time),
3214 .help = "Time window over which to calculate IOPS (msec)",
3215 .def = "500",
3216 .parent = "write_iops_log",
3217 .hide = 1,
3218 .interval = 100,
3219 .category = FIO_OPT_C_LOG,
3220 .group = FIO_OPT_G_INVALID,
3221 },
3222 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003223 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003224 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003225 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003226 .off1 = td_var_offset(group_reporting),
3227 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003228 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003229 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003230 },
3231 {
Jens Axboee9459e52007-04-17 15:46:32 +02003232 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003233 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003234 .type = FIO_OPT_STR_SET,
3235 .off1 = td_var_offset(zero_buffers),
3236 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003237 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003238 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003239 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003240 {
3241 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003242 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003243 .type = FIO_OPT_STR_SET,
3244 .off1 = td_var_offset(refill_buffers),
3245 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003246 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003247 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003248 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003249 {
Jens Axboefd684182011-09-19 09:24:44 +02003250 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003251 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003252 .type = FIO_OPT_BOOL,
3253 .off1 = td_var_offset(scramble_buffers),
3254 .help = "Slightly scramble buffers on every IO submit",
3255 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003256 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003257 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003258 },
3259 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003260 .name = "buffer_pattern",
3261 .lname = "Buffer pattern",
3262 .type = FIO_OPT_STR,
3263 .cb = str_buffer_pattern_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003264 .off1 = td_var_offset(buffer_pattern),
Jens Axboece35b1e2014-01-14 15:35:58 -07003265 .help = "Fill pattern for IO buffers",
3266 .category = FIO_OPT_C_IO,
3267 .group = FIO_OPT_G_IO_BUF,
3268 },
3269 {
Jens Axboe9c426842012-03-02 21:02:12 +01003270 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003271 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003272 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003273 .cb = str_buffer_compress_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003274 .off1 = td_var_offset(compress_percentage),
Jens Axboe9c426842012-03-02 21:02:12 +01003275 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003276 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003277 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003278 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003279 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003280 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003281 },
3282 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003283 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003284 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003285 .type = FIO_OPT_INT,
3286 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003287 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003288 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003289 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003290 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003291 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003292 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003293 },
3294 {
Jens Axboee66dac22014-09-22 10:02:07 -06003295 .name = "dedupe_percentage",
3296 .lname = "Dedupe percentage",
3297 .type = FIO_OPT_INT,
3298 .cb = str_dedupe_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003299 .off1 = td_var_offset(dedupe_percentage),
Jens Axboee66dac22014-09-22 10:02:07 -06003300 .maxval = 100,
3301 .minval = 0,
3302 .help = "Percentage of buffers that are dedupable",
3303 .interval = 1,
3304 .category = FIO_OPT_C_IO,
3305 .group = FIO_OPT_G_IO_BUF,
3306 },
3307 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003308 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003309 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(clat_percentiles),
3312 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003313 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003314 .category = FIO_OPT_C_STAT,
3315 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003316 },
3317 {
3318 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003319 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003320 .type = FIO_OPT_FLOAT_LIST,
3321 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003322 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003323 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003324 .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 +02003325 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3326 .minfp = 0.0,
3327 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003328 .category = FIO_OPT_C_STAT,
3329 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003330 },
3331
Jens Axboe0a839f32007-04-26 09:02:34 +02003332#ifdef FIO_HAVE_DISK_UTIL
3333 {
3334 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003335 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003336 .type = FIO_OPT_BOOL,
3337 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003338 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003339 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003340 .category = FIO_OPT_C_STAT,
3341 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003342 },
3343#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003344 {
Jens Axboe993bf482008-11-14 13:04:53 +01003345 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003346 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003347 .type = FIO_OPT_BOOL,
3348 .help = "Greatly reduce number of gettimeofday() calls",
3349 .cb = str_gtod_reduce_cb,
3350 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003351 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003352 .category = FIO_OPT_C_STAT,
3353 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003354 },
3355 {
Jens Axboe02af0982010-06-24 09:59:34 +02003356 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003357 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003358 .type = FIO_OPT_BOOL,
3359 .off1 = td_var_offset(disable_lat),
3360 .help = "Disable latency numbers",
3361 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003362 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003363 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003364 .category = FIO_OPT_C_STAT,
3365 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003366 },
3367 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003368 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003369 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003370 .type = FIO_OPT_BOOL,
3371 .off1 = td_var_offset(disable_clat),
3372 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003373 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003374 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003375 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003376 .category = FIO_OPT_C_STAT,
3377 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003378 },
3379 {
3380 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003381 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003382 .type = FIO_OPT_BOOL,
3383 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003384 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003385 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003386 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003387 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003388 .category = FIO_OPT_C_STAT,
3389 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003390 },
3391 {
3392 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003393 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003394 .type = FIO_OPT_BOOL,
3395 .off1 = td_var_offset(disable_bw),
3396 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003397 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003398 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003399 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003400 .category = FIO_OPT_C_STAT,
3401 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003402 },
3403 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003404 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003405 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003406 .type = FIO_OPT_INT,
3407 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003408 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003409 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003410 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003411 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003412 },
3413 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003414 .name = "unified_rw_reporting",
3415 .type = FIO_OPT_BOOL,
3416 .off1 = td_var_offset(unified_rw_rep),
3417 .help = "Unify reporting across data direction",
3418 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003419 .category = FIO_OPT_C_GENERAL,
3420 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003421 },
3422 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003423 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003424 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003425 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003426 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003427 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003428 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003429 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003430 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003431 .posval = {
3432 { .ival = "none",
3433 .oval = ERROR_TYPE_NONE,
3434 .help = "Exit when an error is encountered",
3435 },
3436 { .ival = "read",
3437 .oval = ERROR_TYPE_READ,
3438 .help = "Continue on read errors only",
3439 },
3440 { .ival = "write",
3441 .oval = ERROR_TYPE_WRITE,
3442 .help = "Continue on write errors only",
3443 },
3444 { .ival = "io",
3445 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3446 .help = "Continue on any IO errors",
3447 },
3448 { .ival = "verify",
3449 .oval = ERROR_TYPE_VERIFY,
3450 .help = "Continue on verify errors only",
3451 },
3452 { .ival = "all",
3453 .oval = ERROR_TYPE_ANY,
3454 .help = "Continue on all io and verify errors",
3455 },
3456 { .ival = "0",
3457 .oval = ERROR_TYPE_NONE,
3458 .help = "Alias for 'none'",
3459 },
3460 { .ival = "1",
3461 .oval = ERROR_TYPE_ANY,
3462 .help = "Alias for 'all'",
3463 },
3464 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003465 },
3466 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003467 .name = "ignore_error",
3468 .type = FIO_OPT_STR,
3469 .cb = str_ignore_error_cb,
Jens Axboe9c62acd2014-12-09 12:58:15 -07003470 .off1 = td_var_offset(ignore_error_nr),
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003471 .help = "Set a specific list of errors to ignore",
3472 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003473 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003474 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003475 },
3476 {
3477 .name = "error_dump",
3478 .type = FIO_OPT_BOOL,
3479 .off1 = td_var_offset(error_dump),
3480 .def = "0",
3481 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003482 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003483 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003484 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003485 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003486 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003487 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003488 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003489 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003490 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003491 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003492 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003493 },
3494 {
Jens Axboea696fa22009-12-04 10:05:02 +01003495 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003496 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003497 .type = FIO_OPT_STR_STORE,
3498 .off1 = td_var_offset(cgroup),
3499 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003500 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003501 .group = FIO_OPT_G_CGROUP,
3502 },
3503 {
3504 .name = "cgroup_nodelete",
3505 .lname = "Cgroup no-delete",
3506 .type = FIO_OPT_BOOL,
3507 .off1 = td_var_offset(cgroup_nodelete),
3508 .help = "Do not delete cgroups after job completion",
3509 .def = "0",
3510 .parent = "cgroup",
3511 .category = FIO_OPT_C_GENERAL,
3512 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003513 },
3514 {
3515 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003516 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003517 .type = FIO_OPT_INT,
3518 .off1 = td_var_offset(cgroup_weight),
3519 .help = "Use given weight for cgroup",
3520 .minval = 100,
3521 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003522 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003523 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003524 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003525 },
3526 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003527 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003528 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003529 .type = FIO_OPT_INT,
3530 .off1 = td_var_offset(uid),
3531 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003532 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003533 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003534 },
3535 {
3536 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003537 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003538 .type = FIO_OPT_INT,
3539 .off1 = td_var_offset(gid),
3540 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003541 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003542 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003543 },
3544 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003545 .name = "kb_base",
3546 .lname = "KB Base",
3547 .type = FIO_OPT_INT,
3548 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003549 .prio = 1,
3550 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003551 .posval = {
3552 { .ival = "1024",
3553 .oval = 1024,
3554 .help = "Use 1024 as the K base",
3555 },
3556 { .ival = "1000",
3557 .oval = 1000,
3558 .help = "Use 1000 as the K base",
3559 },
3560 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003561 .help = "How many bytes per KB for reporting (1000 or 1024)",
3562 .category = FIO_OPT_C_GENERAL,
3563 .group = FIO_OPT_G_INVALID,
3564 },
3565 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003566 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003567 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003568 .type = FIO_OPT_INT,
3569 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003570 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003571 .posval = {
3572 { .ival = "0",
3573 .oval = 0,
3574 .help = "Auto-detect",
3575 },
3576 { .ival = "8",
3577 .oval = 8,
3578 .help = "Normal (byte based)",
3579 },
3580 { .ival = "1",
3581 .oval = 1,
3582 .help = "Bit based",
3583 },
3584 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003585 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3586 .category = FIO_OPT_C_GENERAL,
3587 .group = FIO_OPT_G_INVALID,
3588 },
3589 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003590 .name = "hugepage-size",
3591 .lname = "Hugepage size",
3592 .type = FIO_OPT_INT,
3593 .off1 = td_var_offset(hugepage_size),
3594 .help = "When using hugepages, specify size of each page",
3595 .def = __fio_stringify(FIO_HUGE_PAGE),
3596 .interval = 1024 * 1024,
3597 .category = FIO_OPT_C_GENERAL,
3598 .group = FIO_OPT_G_INVALID,
3599 },
3600 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003601 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003602 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003603 .type = FIO_OPT_INT,
3604 .off1 = td_var_offset(flow_id),
3605 .help = "The flow index ID to use",
3606 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003607 .category = FIO_OPT_C_IO,
3608 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003609 },
3610 {
3611 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003612 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003613 .type = FIO_OPT_INT,
3614 .off1 = td_var_offset(flow),
3615 .help = "Weight for flow control of this job",
3616 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003617 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003618 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003619 .category = FIO_OPT_C_IO,
3620 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003621 },
3622 {
3623 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003624 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003625 .type = FIO_OPT_INT,
3626 .off1 = td_var_offset(flow_watermark),
3627 .help = "High watermark for flow control. This option"
3628 " should be set to the same value for all threads"
3629 " with non-zero flow.",
3630 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003631 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003632 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003633 .category = FIO_OPT_C_IO,
3634 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003635 },
3636 {
3637 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003638 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003639 .type = FIO_OPT_INT,
3640 .off1 = td_var_offset(flow_sleep),
3641 .help = "How many microseconds to sleep after being held"
3642 " back by the flow control mechanism",
3643 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003644 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003645 .def = "0",
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 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003650 .name = NULL,
3651 },
3652};
3653
Jens Axboe17af15d2010-04-13 10:38:16 +02003654static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003655 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003656{
Jens Axboe17af15d2010-04-13 10:38:16 +02003657 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003658 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003659 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003660 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003661 else
3662 lopt->has_arg = required_argument;
3663}
3664
Steven Langde890a12011-11-09 14:03:34 +01003665static void options_to_lopts(struct fio_option *opts,
3666 struct option *long_options,
3667 int i, int option_type)
3668{
3669 struct fio_option *o = &opts[0];
3670 while (o->name) {
3671 add_to_lopt(&long_options[i], o, o->name, option_type);
3672 if (o->alias) {
3673 i++;
3674 add_to_lopt(&long_options[i], o, o->alias, option_type);
3675 }
3676
3677 i++;
3678 o++;
3679 assert(i < FIO_NR_OPTIONS);
3680 }
3681}
3682
3683void fio_options_set_ioengine_opts(struct option *long_options,
3684 struct thread_data *td)
3685{
3686 unsigned int i;
3687
3688 i = 0;
3689 while (long_options[i].name) {
3690 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3691 memset(&long_options[i], 0, sizeof(*long_options));
3692 break;
3693 }
3694 i++;
3695 }
3696
3697 /*
3698 * Just clear out the prior ioengine options.
3699 */
3700 if (!td || !td->eo)
3701 return;
3702
3703 options_to_lopts(td->io_ops->options, long_options, i,
3704 FIO_GETOPT_IOENGINE);
3705}
3706
Jens Axboe214e1ec2007-03-15 10:48:13 +01003707void fio_options_dup_and_init(struct option *long_options)
3708{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003709 unsigned int i;
3710
Jens Axboe9af4a242012-03-16 10:13:49 +01003711 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003712
3713 i = 0;
3714 while (long_options[i].name)
3715 i++;
3716
Jens Axboe9af4a242012-03-16 10:13:49 +01003717 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003718}
3719
Jens Axboe74929ac2009-08-05 11:42:37 +02003720struct fio_keyword {
3721 const char *word;
3722 const char *desc;
3723 char *replace;
3724};
3725
3726static struct fio_keyword fio_keywords[] = {
3727 {
3728 .word = "$pagesize",
3729 .desc = "Page size in the system",
3730 },
3731 {
3732 .word = "$mb_memory",
3733 .desc = "Megabytes of memory online",
3734 },
3735 {
3736 .word = "$ncpus",
3737 .desc = "Number of CPUs online in the system",
3738 },
3739 {
3740 .word = NULL,
3741 },
3742};
3743
3744void fio_keywords_init(void)
3745{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003746 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003747 char buf[128];
3748 long l;
3749
Jens Axboea4cfc472012-10-09 10:30:48 -06003750 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003751 fio_keywords[0].replace = strdup(buf);
3752
Jens Axboe8eb016d2011-07-11 10:24:20 +02003753 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003754 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003755 fio_keywords[1].replace = strdup(buf);
3756
Jens Axboec00a2282011-07-08 20:56:06 +02003757 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003758 sprintf(buf, "%lu", l);
3759 fio_keywords[2].replace = strdup(buf);
3760}
3761
Jens Axboe892a6ff2009-11-13 12:19:49 +01003762#define BC_APP "bc"
3763
3764static char *bc_calc(char *str)
3765{
Steven Langd0c814e2011-10-28 08:37:13 +02003766 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003767 FILE *f;
3768 int ret;
3769
3770 /*
3771 * No math, just return string
3772 */
Steven Langd0c814e2011-10-28 08:37:13 +02003773 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3774 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003775 return str;
3776
3777 /*
3778 * Split option from value, we only need to calculate the value
3779 */
3780 tmp = strchr(str, '=');
3781 if (!tmp)
3782 return str;
3783
3784 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003785
Steven Langd0c814e2011-10-28 08:37:13 +02003786 /*
3787 * Prevent buffer overflows; such a case isn't reasonable anyway
3788 */
3789 if (strlen(str) >= 128 || strlen(tmp) > 100)
3790 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003791
3792 sprintf(buf, "which %s > /dev/null", BC_APP);
3793 if (system(buf)) {
3794 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003795 return NULL;
3796 }
3797
Steven Langd0c814e2011-10-28 08:37:13 +02003798 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003799 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003800 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003801 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003802
Steven Langd0c814e2011-10-28 08:37:13 +02003803 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003804 if (ret <= 0) {
3805 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003806 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003807 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003808
Jens Axboe892a6ff2009-11-13 12:19:49 +01003809 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003810 buf[(tmp - str) + ret - 1] = '\0';
3811 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003812 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003813 return strdup(buf);
3814}
3815
3816/*
3817 * Return a copy of the input string with substrings of the form ${VARNAME}
3818 * substituted with the value of the environment variable VARNAME. The
3819 * substitution always occurs, even if VARNAME is empty or the corresponding
3820 * environment variable undefined.
3821 */
3822static char *option_dup_subs(const char *opt)
3823{
3824 char out[OPT_LEN_MAX+1];
3825 char in[OPT_LEN_MAX+1];
3826 char *outptr = out;
3827 char *inptr = in;
3828 char *ch1, *ch2, *env;
3829 ssize_t nchr = OPT_LEN_MAX;
3830 size_t envlen;
3831
3832 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3833 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3834 return NULL;
3835 }
3836
3837 in[OPT_LEN_MAX] = '\0';
3838 strncpy(in, opt, OPT_LEN_MAX);
3839
3840 while (*inptr && nchr > 0) {
3841 if (inptr[0] == '$' && inptr[1] == '{') {
3842 ch2 = strchr(inptr, '}');
3843 if (ch2 && inptr+1 < ch2) {
3844 ch1 = inptr+2;
3845 inptr = ch2+1;
3846 *ch2 = '\0';
3847
3848 env = getenv(ch1);
3849 if (env) {
3850 envlen = strlen(env);
3851 if (envlen <= nchr) {
3852 memcpy(outptr, env, envlen);
3853 outptr += envlen;
3854 nchr -= envlen;
3855 }
3856 }
3857
3858 continue;
3859 }
3860 }
3861
3862 *outptr++ = *inptr++;
3863 --nchr;
3864 }
3865
3866 *outptr = '\0';
3867 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003868}
3869
Jens Axboe74929ac2009-08-05 11:42:37 +02003870/*
3871 * Look for reserved variable names and replace them with real values
3872 */
3873static char *fio_keyword_replace(char *opt)
3874{
3875 char *s;
3876 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003877 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003878
3879 for (i = 0; fio_keywords[i].word != NULL; i++) {
3880 struct fio_keyword *kw = &fio_keywords[i];
3881
3882 while ((s = strstr(opt, kw->word)) != NULL) {
3883 char *new = malloc(strlen(opt) + 1);
3884 char *o_org = opt;
3885 int olen = s - opt;
3886 int len;
3887
3888 /*
3889 * Copy part of the string before the keyword and
3890 * sprintf() the replacement after it.
3891 */
3892 memcpy(new, opt, olen);
3893 len = sprintf(new + olen, "%s", kw->replace);
3894
3895 /*
3896 * If there's more in the original string, copy that
3897 * in too
3898 */
3899 opt += strlen(kw->word) + olen;
3900 if (strlen(opt))
3901 memcpy(new + olen + len, opt, opt - o_org - 1);
3902
3903 /*
3904 * replace opt and free the old opt
3905 */
3906 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003907 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003908
Steven Langd0c814e2011-10-28 08:37:13 +02003909 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003910 }
3911 }
3912
Steven Langd0c814e2011-10-28 08:37:13 +02003913 /*
3914 * Check for potential math and invoke bc, if possible
3915 */
3916 if (docalc)
3917 opt = bc_calc(opt);
3918
Jens Axboe7a958bd2009-11-13 12:33:54 +01003919 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003920}
3921
Steven Langd0c814e2011-10-28 08:37:13 +02003922static char **dup_and_sub_options(char **opts, int num_opts)
3923{
3924 int i;
3925 char **opts_copy = malloc(num_opts * sizeof(*opts));
3926 for (i = 0; i < num_opts; i++) {
3927 opts_copy[i] = option_dup_subs(opts[i]);
3928 if (!opts_copy[i])
3929 continue;
3930 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3931 }
3932 return opts_copy;
3933}
3934
Jens Axboe5b284222014-12-06 09:53:46 -07003935static void show_closest_option(const char *opt)
Jens Axboecf88f2a2014-12-06 09:17:52 -07003936{
3937 int best_option, best_distance;
3938 int i, distance;
Jens Axboe5b284222014-12-06 09:53:46 -07003939 char *name;
3940
3941 if (!strlen(opt))
3942 return;
3943
3944 name = strdup(opt);
3945 i = 0;
3946 while (name[i] != '\0' && name[i] != '=')
3947 i++;
3948 name[i] = '\0';
Jens Axboecf88f2a2014-12-06 09:17:52 -07003949
3950 best_option = -1;
3951 best_distance = INT_MAX;
3952 i = 0;
3953 while (fio_options[i].name) {
3954 distance = string_distance(name, fio_options[i].name);
3955 if (distance < best_distance) {
3956 best_distance = distance;
3957 best_option = i;
3958 }
3959 i++;
3960 }
3961
3962 if (best_option != -1)
3963 log_err("Did you mean %s?\n", fio_options[best_option].name);
Jens Axboe5b284222014-12-06 09:53:46 -07003964
3965 free(name);
Jens Axboecf88f2a2014-12-06 09:17:52 -07003966}
3967
Jens Axboe292cc472013-11-26 20:39:35 -07003968int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3969 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003970{
Steven Langde890a12011-11-09 14:03:34 +01003971 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003972 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003973
Jens Axboe9af4a242012-03-16 10:13:49 +01003974 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003975 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003976
Steven Langde890a12011-11-09 14:03:34 +01003977 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3978 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003979 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003980 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003981
Jens Axboe9c62acd2014-12-09 12:58:15 -07003982 if (!newret && o)
3983 fio_option_mark_set(&td->o, o);
3984
Steven Langde890a12011-11-09 14:03:34 +01003985 if (opts_copy[i]) {
3986 if (newret && !o) {
3987 unknown++;
3988 continue;
3989 }
Steven Langd0c814e2011-10-28 08:37:13 +02003990 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003991 opts_copy[i] = NULL;
3992 }
3993
3994 ret |= newret;
3995 }
3996
3997 if (unknown) {
3998 ret |= ioengine_load(td);
3999 if (td->eo) {
4000 sort_options(opts_copy, td->io_ops->options, num_opts);
4001 opts = opts_copy;
4002 }
4003 for (i = 0; i < num_opts; i++) {
4004 struct fio_option *o = NULL;
4005 int newret = 1;
Jens Axboecf88f2a2014-12-06 09:17:52 -07004006
Steven Langde890a12011-11-09 14:03:34 +01004007 if (!opts_copy[i])
4008 continue;
4009
4010 if (td->eo)
4011 newret = parse_option(opts_copy[i], opts[i],
4012 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07004013 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01004014
4015 ret |= newret;
Jens Axboecf88f2a2014-12-06 09:17:52 -07004016 if (!o) {
Steven Langde890a12011-11-09 14:03:34 +01004017 log_err("Bad option <%s>\n", opts[i]);
Jens Axboecf88f2a2014-12-06 09:17:52 -07004018 show_closest_option(opts[i]);
4019 }
Steven Langde890a12011-11-09 14:03:34 +01004020 free(opts_copy[i]);
4021 opts_copy[i] = NULL;
4022 }
Jens Axboe74929ac2009-08-05 11:42:37 +02004023 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02004024
Steven Langd0c814e2011-10-28 08:37:13 +02004025 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02004026 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004027}
4028
4029int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
4030{
Jens Axboe9c62acd2014-12-09 12:58:15 -07004031 int ret;
4032
4033 ret = parse_cmd_option(opt, val, fio_options, td);
4034 if (!ret) {
4035 struct fio_option *o;
4036
4037 o = find_option(fio_options, opt);
4038 if (o)
4039 fio_option_mark_set(&td->o, o);
4040 }
4041
4042 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01004043}
4044
Steven Langde890a12011-11-09 14:03:34 +01004045int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4046 char *val)
4047{
Akinobu Mita8a96c802013-10-09 09:32:34 -06004048 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01004049}
4050
Jens Axboe214e1ec2007-03-15 10:48:13 +01004051void fio_fill_default_options(struct thread_data *td)
4052{
Jens Axboecb1402d2014-02-25 11:35:27 -08004053 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01004054 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004055}
4056
4057int fio_show_option_help(const char *opt)
4058{
Jens Axboe9af4a242012-03-16 10:13:49 +01004059 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01004060}
Jens Axboed23bb322007-03-23 15:57:56 +01004061
Steven Langde890a12011-11-09 14:03:34 +01004062void options_mem_dupe(void *data, struct fio_option *options)
4063{
4064 struct fio_option *o;
4065 char **ptr;
4066
4067 for (o = &options[0]; o->name; o++) {
4068 if (o->type != FIO_OPT_STR_STORE)
4069 continue;
4070
Jens Axboef0fdbca2014-02-11 15:44:50 -07004071 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01004072 if (*ptr)
4073 *ptr = strdup(*ptr);
4074 }
4075}
4076
Jens Axboe7e356b22011-10-14 10:55:16 +02004077/*
4078 * dupe FIO_OPT_STR_STORE options
4079 */
Steven Langde890a12011-11-09 14:03:34 +01004080void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01004081{
Jens Axboe9af4a242012-03-16 10:13:49 +01004082 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01004083
4084 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01004085 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01004086
Steven Langde890a12011-11-09 14:03:34 +01004087 td->eo = malloc(td->io_ops->option_struct_size);
4088 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4089 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01004090 }
4091}
4092
Jens Axboed6978a32009-07-18 21:04:09 +02004093unsigned int fio_get_kb_base(void *data)
4094{
Jens Axboe83ea4222012-03-28 14:01:46 +02004095 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02004096 unsigned int kb_base = 0;
4097
Jens Axboecb1402d2014-02-25 11:35:27 -08004098 /*
4099 * This is a hack... For private options, *data is not holding
4100 * a pointer to the thread_options, but to private data. This means
4101 * we can't safely dereference it, but magic is first so mem wise
4102 * it is valid. But this also means that if the job first sets
4103 * kb_base and expects that to be honored by private options,
4104 * it will be disappointed. We will return the global default
4105 * for this.
4106 */
4107 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02004108 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02004109 if (!kb_base)
4110 kb_base = 1024;
4111
4112 return kb_base;
4113}
Jens Axboe9f988e22010-03-04 10:42:38 +01004114
Jens Axboe07b32322010-03-05 09:48:44 +01004115int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01004116{
Jens Axboe07b32322010-03-05 09:48:44 +01004117 struct fio_option *__o;
4118 int opt_index = 0;
4119
Jens Axboe9af4a242012-03-16 10:13:49 +01004120 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004121 while (__o->name) {
4122 opt_index++;
4123 __o++;
4124 }
4125
Jens Axboe7b504ed2014-02-11 14:19:38 -07004126 if (opt_index + 1 == FIO_MAX_OPTS) {
4127 log_err("fio: FIO_MAX_OPTS is too small\n");
4128 return 1;
4129 }
4130
Jens Axboe9af4a242012-03-16 10:13:49 +01004131 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004132 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004133 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004134}
Jens Axboee2de69d2010-03-04 14:05:48 +01004135
Jens Axboe07b32322010-03-05 09:48:44 +01004136void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004137{
Jens Axboe07b32322010-03-05 09:48:44 +01004138 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004139
Jens Axboe9af4a242012-03-16 10:13:49 +01004140 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004141 while (o->name) {
4142 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4143 o->type = FIO_OPT_INVALID;
4144 o->prof_name = NULL;
4145 }
4146 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004147 }
4148}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004149
4150void add_opt_posval(const char *optname, const char *ival, const char *help)
4151{
4152 struct fio_option *o;
4153 unsigned int i;
4154
Jens Axboe9af4a242012-03-16 10:13:49 +01004155 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004156 if (!o)
4157 return;
4158
4159 for (i = 0; i < PARSE_MAX_VP; i++) {
4160 if (o->posval[i].ival)
4161 continue;
4162
4163 o->posval[i].ival = ival;
4164 o->posval[i].help = help;
4165 break;
4166 }
4167}
4168
4169void del_opt_posval(const char *optname, const char *ival)
4170{
4171 struct fio_option *o;
4172 unsigned int i;
4173
Jens Axboe9af4a242012-03-16 10:13:49 +01004174 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004175 if (!o)
4176 return;
4177
4178 for (i = 0; i < PARSE_MAX_VP; i++) {
4179 if (!o->posval[i].ival)
4180 continue;
4181 if (strcmp(o->posval[i].ival, ival))
4182 continue;
4183
4184 o->posval[i].ival = NULL;
4185 o->posval[i].help = NULL;
4186 }
4187}
Jens Axboe7e356b22011-10-14 10:55:16 +02004188
4189void fio_options_free(struct thread_data *td)
4190{
Jens Axboe9af4a242012-03-16 10:13:49 +01004191 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004192 if (td->eo && td->io_ops && td->io_ops->options) {
4193 options_free(td->io_ops->options, td->eo);
4194 free(td->eo);
4195 td->eo = NULL;
4196 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004197}
Jens Axboec504ee52012-03-20 11:29:09 +01004198
4199struct fio_option *fio_option_find(const char *name)
4200{
4201 return find_option(fio_options, name);
4202}
4203
Jens Axboe9c62acd2014-12-09 12:58:15 -07004204int __fio_option_is_set(struct thread_options *o, unsigned int off1)
4205{
4206 unsigned int opt_off, index, offset;
4207 struct fio_option *opt = NULL;
4208 int i;
4209
4210 for (i = 0; fio_options[i].name; i++) {
4211 if (off1 == fio_options[i].off1) {
4212 opt = &fio_options[i];
4213 break;
4214 }
4215 }
4216
4217 if (!opt) {
4218 log_err("fio: no option found at offset %u\n", off1);
4219 return 0;
4220 }
4221
4222 opt_off = opt - &fio_options[0];
4223 index = opt_off / (8 * sizeof(uint64_t));
4224 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4225 return (o->set_options[index] & (1UL << offset)) != 0;
4226}
4227
4228void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4229{
4230 unsigned int opt_off, index, offset;
4231
4232 opt_off = opt - &fio_options[0];
4233 index = opt_off / (8 * sizeof(uint64_t));
4234 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
4235 o->set_options[index] |= 1UL << offset;
4236}