blob: ae04b3bb914043d4cc44e992f832c06cbba8e8ca [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)
101 perc = -1;
102 } else
103 perc = -1;
104
Jens Axboe0de5b262014-02-21 15:26:01 -0800105 if (str_to_decimal(fname, &val, 1, o, 0)) {
Jens Axboe564ca972007-12-14 12:21:19 +0100106 log_err("fio: bssplit conversion failed\n");
Hong Zhiguod8b97c82013-10-08 08:48:47 -0600107 free(bssplit);
Jens Axboe564ca972007-12-14 12:21:19 +0100108 return 1;
109 }
110
111 if (val > max_bs)
112 max_bs = val;
113 if (val < min_bs)
114 min_bs = val;
115
Jens Axboe720e84a2009-04-21 08:29:55 +0200116 bssplit[i].bs = val;
117 bssplit[i].perc = perc;
Jens Axboe564ca972007-12-14 12:21:19 +0100118 i++;
119 }
120
Jens Axboe83ea4222012-03-28 14:01:46 +0200121 o->bssplit_nr[ddir] = i;
Jens Axboe564ca972007-12-14 12:21:19 +0100122
123 /*
124 * Now check if the percentages add up, and how much is missing
125 */
126 perc = perc_missing = 0;
Jens Axboe83ea4222012-03-28 14:01:46 +0200127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200128 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100129
130 if (bsp->perc == (unsigned char) -1)
131 perc_missing++;
132 else
133 perc += bsp->perc;
134 }
135
136 if (perc > 100) {
137 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 }
141 /*
142 * If values didn't have a percentage set, divide the remains between
143 * them.
144 */
145 if (perc_missing) {
Jens Axboe83ea4222012-03-28 14:01:46 +0200146 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
Jens Axboe720e84a2009-04-21 08:29:55 +0200147 struct bssplit *bsp = &bssplit[i];
Jens Axboe564ca972007-12-14 12:21:19 +0100148
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
151 }
152 }
153
Jens Axboe83ea4222012-03-28 14:01:46 +0200154 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
Jens Axboe564ca972007-12-14 12:21:19 +0100156
157 /*
158 * now sort based on percentages, for ease of lookup
159 */
Jens Axboe83ea4222012-03-28 14:01:46 +0200160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
Jens Axboe720e84a2009-04-21 08:29:55 +0200162 return 0;
Jens Axboe720e84a2009-04-21 08:29:55 +0200163}
164
165static int str_bssplit_cb(void *data, const char *input)
166{
167 struct thread_data *td = data;
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200168 char *str, *p, *odir, *ddir;
Jens Axboe720e84a2009-04-21 08:29:55 +0200169 int ret = 0;
170
Jens Axboe52c0cea2013-09-06 10:07:37 -0600171 if (parse_dryrun())
172 return 0;
173
Jens Axboe720e84a2009-04-21 08:29:55 +0200174 p = str = strdup(input);
175
176 strip_blank_front(&str);
177 strip_blank_end(str);
178
179 odir = strchr(str, ',');
180 if (odir) {
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200181 ddir = strchr(odir + 1, ',');
182 if (ddir) {
Jens Axboed79db122012-09-24 08:51:24 +0200183 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200184 if (!ret)
185 *ddir = '\0';
186 } else {
187 char *op;
188
189 op = strdup(odir + 1);
Jens Axboed79db122012-09-24 08:51:24 +0200190 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200191
192 free(op);
193 }
Jens Axboed79db122012-09-24 08:51:24 +0200194 if (!ret)
195 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
Jens Axboe720e84a2009-04-21 08:29:55 +0200196 if (!ret) {
197 *odir = '\0';
Jens Axboe83ea4222012-03-28 14:01:46 +0200198 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200199 }
200 } else {
201 char *op;
202
203 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200204 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
Jens Axboe720e84a2009-04-21 08:29:55 +0200205 free(op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200206
207 if (!ret) {
208 op = strdup(str);
Jens Axboed79db122012-09-24 08:51:24 +0200209 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
Shaohua Li6eaf09d2012-09-14 08:49:43 +0200210 free(op);
211 }
Jens Axboed79db122012-09-24 08:51:24 +0200212 ret = bssplit_ddir(&td->o, DDIR_READ, str);
Jens Axboe720e84a2009-04-21 08:29:55 +0200213 }
Jens Axboe564ca972007-12-14 12:21:19 +0100214
215 free(p);
Jens Axboe720e84a2009-04-21 08:29:55 +0200216 return ret;
Jens Axboe564ca972007-12-14 12:21:19 +0100217}
218
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400219static int str2error(char *str)
220{
Jens Axboea94eb992012-09-24 18:46:34 +0200221 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400222 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
223 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
224 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
225 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
226 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
227 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
Jens Axboea94eb992012-09-24 18:46:34 +0200228 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400229 int i = 0, num = sizeof(err) / sizeof(void *);
230
Jens Axboea94eb992012-09-24 18:46:34 +0200231 while (i < num) {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400232 if (!strcmp(err[i], str))
233 return i + 1;
234 i++;
235 }
236 return 0;
237}
238
239static int ignore_error_type(struct thread_data *td, int etype, char *str)
240{
241 unsigned int i;
242 int *error;
243 char *fname;
244
245 if (etype >= ERROR_TYPE_CNT) {
246 log_err("Illegal error type\n");
247 return 1;
248 }
249
250 td->o.ignore_error_nr[etype] = 4;
251 error = malloc(4 * sizeof(struct bssplit));
252
253 i = 0;
254 while ((fname = strsep(&str, ":")) != NULL) {
255
256 if (!strlen(fname))
257 break;
258
259 /*
260 * grow struct buffer, if needed
261 */
262 if (i == td->o.ignore_error_nr[etype]) {
263 td->o.ignore_error_nr[etype] <<= 1;
264 error = realloc(error, td->o.ignore_error_nr[etype]
265 * sizeof(int));
266 }
267 if (fname[0] == 'E') {
268 error[i] = str2error(fname);
269 } else {
270 error[i] = atoi(fname);
271 if (error[i] < 0)
272 error[i] = error[i];
273 }
274 if (!error[i]) {
275 log_err("Unknown error %s, please use number value \n",
276 fname);
Erwan Velu0fddbf72013-07-22 23:46:10 +0200277 free(error);
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400278 return 1;
279 }
280 i++;
281 }
282 if (i) {
283 td->o.continue_on_error |= 1 << etype;
284 td->o.ignore_error_nr[etype] = i;
285 td->o.ignore_error[etype] = error;
Jens Axboec7b086b2014-04-11 11:20:29 -0600286 } else
287 free(error);
288
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400289 return 0;
290
291}
292
293static int str_ignore_error_cb(void *data, const char *input)
294{
295 struct thread_data *td = data;
296 char *str, *p, *n;
297 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600298
299 if (parse_dryrun())
300 return 0;
301
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400302 p = str = strdup(input);
303
304 strip_blank_front(&str);
305 strip_blank_end(str);
306
307 while (p) {
308 n = strchr(p, ',');
309 if (n)
310 *n++ = '\0';
311 ret = ignore_error_type(td, type, p);
312 if (ret)
313 break;
314 p = n;
315 type++;
316 }
317 free(str);
318 return ret;
319}
320
Jens Axboe211097b2007-03-22 18:56:45 +0100321static int str_rw_cb(void *data, const char *str)
322{
323 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200324 struct thread_options *o = &td->o;
Jens Axboe211097b2007-03-22 18:56:45 +0100325 char *nr = get_opt_postfix(str);
326
Jens Axboe52c0cea2013-09-06 10:07:37 -0600327 if (parse_dryrun())
328 return 0;
329
Jens Axboe83ea4222012-03-28 14:01:46 +0200330 o->ddir_seq_nr = 1;
331 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200332
333 if (!nr)
334 return 0;
335
336 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200337 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200338 else {
339 long long val;
340
Jens Axboe0de5b262014-02-21 15:26:01 -0800341 if (str_to_decimal(nr, &val, 1, o, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200342 log_err("fio: rw postfix parsing failed\n");
343 free(nr);
344 return 1;
345 }
346
Jens Axboe83ea4222012-03-28 14:01:46 +0200347 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100348 }
Jens Axboe211097b2007-03-22 18:56:45 +0100349
Jens Axboe059b0802011-08-25 09:09:37 +0200350 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100351 return 0;
352}
353
Jens Axboe214e1ec2007-03-15 10:48:13 +0100354static int str_mem_cb(void *data, const char *mem)
355{
356 struct thread_data *td = data;
357
Shaohua Lid9759b12013-01-17 13:28:15 +0100358 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700359 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100360
361 return 0;
362}
363
Jens Axboec223da82010-03-24 13:23:53 +0100364static int fio_clock_source_cb(void *data, const char *str)
365{
366 struct thread_data *td = data;
367
368 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100369 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100370 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100371 return 0;
372}
373
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400374static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200375{
376 struct thread_data *td = data;
377
378 td->o.rwmix[DDIR_READ] = *val;
379 td->o.rwmix[DDIR_WRITE] = 100 - *val;
380 return 0;
381}
382
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400383static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200384{
385 struct thread_data *td = data;
386
387 td->o.rwmix[DDIR_WRITE] = *val;
388 td->o.rwmix[DDIR_READ] = 100 - *val;
389 return 0;
390}
391
Jens Axboe214e1ec2007-03-15 10:48:13 +0100392static int str_exitall_cb(void)
393{
394 exitall_on_terminate = 1;
395 return 0;
396}
397
Jens Axboe214e1ec2007-03-15 10:48:13 +0100398#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800399int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800400{
Jens Axboe50b58602014-02-28 15:08:25 -0800401 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800402 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800403
Jens Axboe50b58602014-02-28 15:08:25 -0800404 cpus_in_mask = fio_cpu_count(mask);
405 cpu_index = cpu_index % cpus_in_mask;
406
407 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800408 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800409 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800410 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800411
412 if (cpu_index != index)
413 fio_cpu_clear(mask, i);
414
415 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800416 }
417
418 return fio_cpu_count(mask);
419}
420
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400421static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100422{
423 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200424 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100425 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100426 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100427
Jens Axboe52c0cea2013-09-06 10:07:37 -0600428 if (parse_dryrun())
429 return 0;
430
Jens Axboed2ce18b2008-12-12 20:51:40 +0100431 ret = fio_cpuset_init(&td->o.cpumask);
432 if (ret < 0) {
433 log_err("fio: cpuset_init failed\n");
434 td_verror(td, ret, "fio_cpuset_init");
435 return 1;
436 }
437
Jens Axboec00a2282011-07-08 20:56:06 +0200438 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200439
Jens Axboe62a72732008-12-08 11:37:01 +0100440 for (i = 0; i < sizeof(int) * 8; i++) {
441 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100442 if (i > max_cpu) {
443 log_err("fio: CPU %d too large (max=%ld)\n", i,
444 max_cpu);
445 return 1;
446 }
Jens Axboe62a72732008-12-08 11:37:01 +0100447 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100448 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100449 }
450 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200451
Jens Axboe375b2692007-05-22 09:13:02 +0200452 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100453 return 0;
454}
455
Jens Axboee8462bd2009-07-06 12:59:04 +0200456static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
457 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200458{
Jens Axboed2e268b2007-06-15 10:33:49 +0200459 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100460 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100461 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200462
Jens Axboee8462bd2009-07-06 12:59:04 +0200463 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100464 if (ret < 0) {
465 log_err("fio: cpuset_init failed\n");
466 td_verror(td, ret, "fio_cpuset_init");
467 return 1;
468 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200469
470 p = str = strdup(input);
471
472 strip_blank_front(&str);
473 strip_blank_end(str);
474
Jens Axboec00a2282011-07-08 20:56:06 +0200475 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100476
Jens Axboed2e268b2007-06-15 10:33:49 +0200477 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100478 char *str2, *cpu2;
479 int icpu, icpu2;
480
Jens Axboed2e268b2007-06-15 10:33:49 +0200481 if (!strlen(cpu))
482 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100483
484 str2 = cpu;
485 icpu2 = -1;
486 while ((cpu2 = strsep(&str2, "-")) != NULL) {
487 if (!strlen(cpu2))
488 break;
489
490 icpu2 = atoi(cpu2);
491 }
492
493 icpu = atoi(cpu);
494 if (icpu2 == -1)
495 icpu2 = icpu;
496 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100497 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100498 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100499 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100500 ret = 1;
501 break;
502 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100503 if (icpu > max_cpu) {
504 log_err("fio: CPU %d too large (max=%ld)\n",
505 icpu, max_cpu);
506 ret = 1;
507 break;
508 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200509
Jens Axboe62a72732008-12-08 11:37:01 +0100510 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200511 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100512 icpu++;
513 }
Jens Axboe19608d62008-12-08 15:03:12 +0100514 if (ret)
515 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200516 }
517
518 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100519 if (!ret)
520 td->o.cpumask_set = 1;
521 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200522}
Jens Axboee8462bd2009-07-06 12:59:04 +0200523
524static int str_cpus_allowed_cb(void *data, const char *input)
525{
526 struct thread_data *td = data;
527 int ret;
528
Jens Axboe52c0cea2013-09-06 10:07:37 -0600529 if (parse_dryrun())
530 return 0;
531
Jens Axboee8462bd2009-07-06 12:59:04 +0200532 ret = set_cpus_allowed(td, &td->o.cpumask, input);
533 if (!ret)
534 td->o.cpumask_set = 1;
535
536 return ret;
537}
538
539static int str_verify_cpus_allowed_cb(void *data, const char *input)
540{
541 struct thread_data *td = data;
542 int ret;
543
544 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
545 if (!ret)
546 td->o.verify_cpumask_set = 1;
547
548 return ret;
549}
Jens Axboed2e268b2007-06-15 10:33:49 +0200550#endif
551
Jens Axboe67bf9822013-01-10 11:23:19 +0100552#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400553static int str_numa_cpunodes_cb(void *data, char *input)
554{
555 struct thread_data *td = data;
556
Jens Axboe52c0cea2013-09-06 10:07:37 -0600557 if (parse_dryrun())
558 return 0;
559
Yufei Rend0b937e2012-10-19 23:11:52 -0400560 /* numa_parse_nodestring() parses a character string list
561 * of nodes into a bit mask. The bit mask is allocated by
562 * numa_allocate_nodemask(), so it should be freed by
563 * numa_free_nodemask().
564 */
565 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
566 if (td->o.numa_cpunodesmask == NULL) {
567 log_err("fio: numa_parse_nodestring failed\n");
568 td_verror(td, 1, "str_numa_cpunodes_cb");
569 return 1;
570 }
571
572 td->o.numa_cpumask_set = 1;
573 return 0;
574}
575
576static int str_numa_mpol_cb(void *data, char *input)
577{
578 struct thread_data *td = data;
579 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600580 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400581 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600582 char *nodelist;
Yufei Rend0b937e2012-10-19 23:11:52 -0400583
Jens Axboe52c0cea2013-09-06 10:07:37 -0600584 if (parse_dryrun())
585 return 0;
586
587 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400588 if (nodelist) {
589 /* NUL-terminate mode */
590 *nodelist++ = '\0';
591 }
592
593 for (i = 0; i <= MPOL_LOCAL; i++) {
594 if (!strcmp(input, policy_types[i])) {
595 td->o.numa_mem_mode = i;
596 break;
597 }
598 }
599 if (i > MPOL_LOCAL) {
600 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
601 goto out;
602 }
603
604 switch (td->o.numa_mem_mode) {
605 case MPOL_PREFERRED:
606 /*
607 * Insist on a nodelist of one node only
608 */
609 if (nodelist) {
610 char *rest = nodelist;
611 while (isdigit(*rest))
612 rest++;
613 if (*rest) {
614 log_err("fio: one node only for \'prefer\'\n");
615 goto out;
616 }
617 } else {
618 log_err("fio: one node is needed for \'prefer\'\n");
619 goto out;
620 }
621 break;
622 case MPOL_INTERLEAVE:
623 /*
624 * Default to online nodes with memory if no nodelist
625 */
626 if (!nodelist)
627 nodelist = strdup("all");
628 break;
629 case MPOL_LOCAL:
630 case MPOL_DEFAULT:
631 /*
632 * Don't allow a nodelist
633 */
634 if (nodelist) {
635 log_err("fio: NO nodelist for \'local\'\n");
636 goto out;
637 }
638 break;
639 case MPOL_BIND:
640 /*
641 * Insist on a nodelist
642 */
643 if (!nodelist) {
644 log_err("fio: a nodelist is needed for \'bind\'\n");
645 goto out;
646 }
647 break;
648 }
649
650
651 /* numa_parse_nodestring() parses a character string list
652 * of nodes into a bit mask. The bit mask is allocated by
653 * numa_allocate_nodemask(), so it should be freed by
654 * numa_free_nodemask().
655 */
656 switch (td->o.numa_mem_mode) {
657 case MPOL_PREFERRED:
658 td->o.numa_mem_prefer_node = atoi(nodelist);
659 break;
660 case MPOL_INTERLEAVE:
661 case MPOL_BIND:
662 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
663 if (td->o.numa_memnodesmask == NULL) {
664 log_err("fio: numa_parse_nodestring failed\n");
665 td_verror(td, 1, "str_numa_memnodes_cb");
666 return 1;
667 }
668 break;
669 case MPOL_LOCAL:
670 case MPOL_DEFAULT:
671 default:
672 break;
673 }
674
675 td->o.numa_memmask_set = 1;
676 return 0;
677
678out:
679 return 1;
680}
681#endif
682
Jens Axboe214e1ec2007-03-15 10:48:13 +0100683static int str_fst_cb(void *data, const char *str)
684{
685 struct thread_data *td = data;
686 char *nr = get_opt_postfix(str);
687
688 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100689 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100690 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100691 free(nr);
692 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100693
694 return 0;
695}
696
Jens Axboe67bf9822013-01-10 11:23:19 +0100697#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100698static int str_sfr_cb(void *data, const char *str)
699{
700 struct thread_data *td = data;
701 char *nr = get_opt_postfix(str);
702
703 td->sync_file_range_nr = 1;
704 if (nr) {
705 td->sync_file_range_nr = atoi(nr);
706 free(nr);
707 }
708
709 return 0;
710}
Jens Axboe3ae06372010-03-19 19:17:15 +0100711#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100712
Jens Axboee25839d2012-11-06 10:49:42 +0100713static int str_random_distribution_cb(void *data, const char *str)
714{
715 struct thread_data *td = data;
716 double val;
717 char *nr;
718
Jens Axboe52c0cea2013-09-06 10:07:37 -0600719 if (parse_dryrun())
720 return 0;
721
Jens Axboe925fee32012-11-06 13:50:32 +0100722 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
723 val = 1.1;
724 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
725 val = 0.2;
726 else
Jens Axboee25839d2012-11-06 10:49:42 +0100727 return 0;
728
729 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100730 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100731 log_err("fio: random postfix parsing failed\n");
732 free(nr);
733 return 1;
734 }
735
Jens Axboe078189c2012-11-07 13:47:22 +0100736 free(nr);
737
Jens Axboe18ded912012-11-08 08:36:00 +0100738 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
739 if (val == 1.00) {
740 log_err("fio: zipf theta must different than 1.0\n");
741 return 1;
742 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700743 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100744 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100745 if (val <= 0.00 || val >= 1.00) {
746 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
747 return 1;
748 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700749 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100750 }
Jens Axboe925fee32012-11-06 13:50:32 +0100751
Jens Axboee25839d2012-11-06 10:49:42 +0100752 return 0;
753}
754
Jens Axboe8e827d32009-08-04 09:51:48 +0200755/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800756 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200757 * is escaped with a '\', then that ':' is part of the filename and does not
758 * indicate a new file.
759 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800760static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200761{
762 char *str = *ptr;
763 char *p, *start;
764
765 if (!str || !strlen(str))
766 return NULL;
767
768 start = str;
769 do {
770 /*
771 * No colon, we are done
772 */
773 p = strchr(str, ':');
774 if (!p) {
775 *ptr = NULL;
776 break;
777 }
778
779 /*
780 * We got a colon, but it's the first character. Skip and
781 * continue
782 */
783 if (p == start) {
784 str = ++start;
785 continue;
786 }
787
788 if (*(p - 1) != '\\') {
789 *p = '\0';
790 *ptr = p + 1;
791 break;
792 }
793
794 memmove(p - 1, p, strlen(p) + 1);
795 str = p;
796 } while (1);
797
798 return start;
799}
800
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800801
802static int get_max_name_idx(char *input)
803{
804 unsigned int cur_idx;
805 char *str, *p;
806
807 p = str = strdup(input);
808 for (cur_idx = 0; ; cur_idx++)
809 if (get_next_name(&str) == NULL)
810 break;
811
812 free(p);
813 return cur_idx;
814}
815
816/*
817 * Returns the directory at the index, indexes > entires will be
818 * assigned via modulo division of the index
819 */
820int set_name_idx(char *target, char *input, int index)
821{
822 unsigned int cur_idx;
823 int len;
824 char *fname, *str, *p;
825
826 p = str = strdup(input);
827
828 index %= get_max_name_idx(input);
829 for (cur_idx = 0; cur_idx <= index; cur_idx++)
830 fname = get_next_name(&str);
831
832 len = sprintf(target, "%s/", fname);
833 free(p);
834
835 return len;
836}
837
Jens Axboe214e1ec2007-03-15 10:48:13 +0100838static int str_filename_cb(void *data, const char *input)
839{
840 struct thread_data *td = data;
841 char *fname, *str, *p;
842
843 p = str = strdup(input);
844
845 strip_blank_front(&str);
846 strip_blank_end(str);
847
848 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100849 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100850
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800851 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100852 if (!strlen(fname))
853 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800854 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100855 }
856
857 free(p);
858 return 0;
859}
860
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800861static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100862{
863 struct thread_data *td = data;
864 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800865 char *dirname, *str, *p;
866 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100867
Jens Axboef9633d72013-09-06 09:59:56 -0600868 if (parse_dryrun())
869 return 0;
870
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800871 p = str = strdup(td->o.directory);
872 while ((dirname = get_next_name(&str)) != NULL) {
873 if (lstat(dirname, &sb) < 0) {
874 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100875
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800876 log_err("fio: %s is not a directory\n", dirname);
877 td_verror(td, ret, "lstat");
878 goto out;
879 }
880 if (!S_ISDIR(sb.st_mode)) {
881 log_err("fio: %s is not a directory\n", dirname);
882 ret = 1;
883 goto out;
884 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100885 }
886
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800887out:
888 free(p);
889 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100890}
891
Jens Axboef2a28032014-02-11 09:12:06 -0700892static int str_lockfile_cb(void *data, const char fio_unused *str)
893{
894 struct thread_data *td = data;
895
896 if (td->files_index) {
897 log_err("fio: lockfile= option must precede filename=\n");
898 return 1;
899 }
900
901 return 0;
902}
903
Jens Axboe214e1ec2007-03-15 10:48:13 +0100904static int str_opendir_cb(void *data, const char fio_unused *str)
905{
906 struct thread_data *td = data;
907
Jens Axboe52c0cea2013-09-06 10:07:37 -0600908 if (parse_dryrun())
909 return 0;
910
Jens Axboe214e1ec2007-03-15 10:48:13 +0100911 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100912 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100913
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100914 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100915}
916
Jens Axboece35b1e2014-01-14 15:35:58 -0700917static int pattern_cb(char *pattern, unsigned int max_size,
918 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200919{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100920 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700921 int i = 0, j = 0, len, k, base = 10;
922 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200923 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200924
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100925 loc1 = strstr(input, "0x");
926 loc2 = strstr(input, "0X");
927 if (loc1 || loc2)
928 base = 16;
929 off = strtol(input, NULL, base);
930 if (off != LONG_MAX || errno != ERANGE) {
931 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700932 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100933 off >>= 8;
934 i++;
935 }
936 } else {
937 len = strlen(input);
938 k = len - 1;
939 if (base == 16) {
940 if (loc1)
941 j = loc1 - input + 2;
942 else
943 j = loc2 - input + 2;
944 } else
945 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700946 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100947 while (k >= j) {
948 off = converthexchartoint(input[k--]);
949 if (k >= j)
950 off += (converthexchartoint(input[k--])
951 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700952 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100953 }
954 }
955 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100956
957 /*
958 * Fill the pattern all the way to the end. This greatly reduces
959 * the number of memcpy's we have to do when verifying the IO.
960 */
Jens Axboee078de42013-04-24 23:07:17 -0600961 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700962 while (i > 1 && i * 2 <= max_size) {
963 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100964 i *= 2;
965 }
Jens Axboee078de42013-04-24 23:07:17 -0600966
967 /*
968 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700969 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600970 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700971 while (i > 1 && i < max_size) {
972 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600973
Jens Axboece35b1e2014-01-14 15:35:58 -0700974 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600975 i += b;
976 }
977
Steven Lang9a2a86d2012-02-07 09:42:59 +0100978 if (i == 1) {
979 /*
980 * The code in verify_io_u_pattern assumes a single byte pattern
981 * fills the whole verify pattern buffer.
982 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700983 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +0100984 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100985
Jens Axboece35b1e2014-01-14 15:35:58 -0700986 *pattern_bytes = i;
987 return 0;
988}
989
990static int str_buffer_pattern_cb(void *data, const char *input)
991{
992 struct thread_data *td = data;
993 int ret;
994
995 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
996 &td->o.buffer_pattern_bytes);
997
998 if (!ret) {
999 td->o.refill_buffers = 0;
1000 td->o.scramble_buffers = 0;
1001 td->o.zero_buffers = 0;
1002 }
1003
1004 return ret;
1005}
1006
Jens Axboebedc9dc2014-03-17 12:51:09 -06001007static int str_buffer_compress_cb(void *data, unsigned long long *il)
1008{
1009 struct thread_data *td = data;
1010
1011 td->flags |= TD_F_COMPRESS;
1012 td->o.compress_percentage = *il;
1013 return 0;
1014}
1015
Jens Axboece35b1e2014-01-14 15:35:58 -07001016static int str_verify_pattern_cb(void *data, const char *input)
1017{
1018 struct thread_data *td = data;
1019 int ret;
1020
1021 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1022 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001023
Jens Axboe92bf48d2011-01-14 21:20:42 +01001024 /*
1025 * VERIFY_META could already be set
1026 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001027 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001028 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001029
Jens Axboece35b1e2014-01-14 15:35:58 -07001030 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001031}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001032
Jens Axboe993bf482008-11-14 13:04:53 +01001033static int str_gtod_reduce_cb(void *data, int *il)
1034{
1035 struct thread_data *td = data;
1036 int val = *il;
1037
Jens Axboe02af0982010-06-24 09:59:34 +02001038 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001039 td->o.disable_clat = !!val;
1040 td->o.disable_slat = !!val;
1041 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001042 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001043 if (val)
1044 td->tv_cache_mask = 63;
1045
1046 return 0;
1047}
1048
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001049static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001050{
1051 struct thread_data *td = data;
1052 int val = *il;
1053
1054 td->o.gtod_cpu = val;
1055 td->o.gtod_offload = 1;
1056 return 0;
1057}
1058
Jens Axboe7bb59102011-07-12 19:47:03 +02001059static int str_size_cb(void *data, unsigned long long *__val)
1060{
1061 struct thread_data *td = data;
1062 unsigned long long v = *__val;
1063
1064 if (parse_is_percent(v)) {
1065 td->o.size = 0;
1066 td->o.size_percent = -1ULL - v;
1067 } else
1068 td->o.size = v;
1069
1070 return 0;
1071}
1072
Jens Axboe896cac22009-07-01 10:38:35 +02001073static int rw_verify(struct fio_option *o, void *data)
1074{
1075 struct thread_data *td = data;
1076
1077 if (read_only && td_write(td)) {
1078 log_err("fio: job <%s> has write bit set, but fio is in"
1079 " read-only mode\n", td->o.name);
1080 return 1;
1081 }
1082
1083 return 0;
1084}
1085
Jens Axboe276ca4f2009-07-01 10:43:05 +02001086static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001087{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001088#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001089 struct thread_data *td = data;
1090
Jens Axboe29d43ff2009-07-01 10:42:18 +02001091 if (td->o.gtod_cpu) {
1092 log_err("fio: platform must support CPU affinity for"
1093 "gettimeofday() offloading\n");
1094 return 1;
1095 }
1096#endif
1097
1098 return 0;
1099}
1100
Jens Axboe214e1ec2007-03-15 10:48:13 +01001101/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001102 * Option grouping
1103 */
1104static struct opt_group fio_opt_groups[] = {
1105 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001106 .name = "General",
1107 .mask = FIO_OPT_C_GENERAL,
1108 },
1109 {
1110 .name = "I/O",
1111 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001112 },
1113 {
1114 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001115 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001116 },
1117 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001118 .name = "Statistics",
1119 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001120 },
1121 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001122 .name = "Logging",
1123 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001124 },
1125 {
Jens Axboe13fca822012-03-31 13:55:54 +02001126 .name = "Profiles",
1127 .mask = FIO_OPT_C_PROFILE,
1128 },
1129 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001130 .name = NULL,
1131 },
1132};
1133
Jens Axboee8b0e952012-03-19 14:37:08 +01001134static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1135 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001136{
1137 struct opt_group *og;
1138 int i;
1139
Jens Axboee8b0e952012-03-19 14:37:08 +01001140 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001141 return NULL;
1142
Jens Axboee8b0e952012-03-19 14:37:08 +01001143 for (i = 0; ogs[i].name; i++) {
1144 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001145
1146 if (*mask & og->mask) {
1147 *mask &= ~(og->mask);
1148 return og;
1149 }
1150 }
1151
1152 return NULL;
1153}
1154
Jens Axboee8b0e952012-03-19 14:37:08 +01001155struct opt_group *opt_group_from_mask(unsigned int *mask)
1156{
1157 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1158}
1159
1160static struct opt_group fio_opt_cat_groups[] = {
1161 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001162 .name = "Latency profiling",
1163 .mask = FIO_OPT_G_LATPROF,
1164 },
1165 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001166 .name = "Rate",
1167 .mask = FIO_OPT_G_RATE,
1168 },
1169 {
1170 .name = "Zone",
1171 .mask = FIO_OPT_G_ZONE,
1172 },
1173 {
1174 .name = "Read/write mix",
1175 .mask = FIO_OPT_G_RWMIX,
1176 },
1177 {
1178 .name = "Verify",
1179 .mask = FIO_OPT_G_VERIFY,
1180 },
1181 {
1182 .name = "Trim",
1183 .mask = FIO_OPT_G_TRIM,
1184 },
1185 {
1186 .name = "I/O Logging",
1187 .mask = FIO_OPT_G_IOLOG,
1188 },
1189 {
1190 .name = "I/O Depth",
1191 .mask = FIO_OPT_G_IO_DEPTH,
1192 },
1193 {
1194 .name = "I/O Flow",
1195 .mask = FIO_OPT_G_IO_FLOW,
1196 },
1197 {
Jens Axboe06260372012-03-19 15:16:08 +01001198 .name = "Description",
1199 .mask = FIO_OPT_G_DESC,
1200 },
1201 {
1202 .name = "Filename",
1203 .mask = FIO_OPT_G_FILENAME,
1204 },
1205 {
1206 .name = "General I/O",
1207 .mask = FIO_OPT_G_IO_BASIC,
1208 },
1209 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001210 .name = "Cgroups",
1211 .mask = FIO_OPT_G_CGROUP,
1212 },
1213 {
1214 .name = "Runtime",
1215 .mask = FIO_OPT_G_RUNTIME,
1216 },
1217 {
Jens Axboe10860052012-03-19 20:56:53 +01001218 .name = "Process",
1219 .mask = FIO_OPT_G_PROCESS,
1220 },
1221 {
1222 .name = "Job credentials / priority",
1223 .mask = FIO_OPT_G_CRED,
1224 },
1225 {
1226 .name = "Clock settings",
1227 .mask = FIO_OPT_G_CLOCK,
1228 },
1229 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001230 .name = "I/O Type",
1231 .mask = FIO_OPT_G_IO_TYPE,
1232 },
1233 {
1234 .name = "I/O Thinktime",
1235 .mask = FIO_OPT_G_THINKTIME,
1236 },
1237 {
1238 .name = "Randomizations",
1239 .mask = FIO_OPT_G_RANDOM,
1240 },
1241 {
1242 .name = "I/O buffers",
1243 .mask = FIO_OPT_G_IO_BUF,
1244 },
1245 {
Jens Axboe13fca822012-03-31 13:55:54 +02001246 .name = "Tiobench profile",
1247 .mask = FIO_OPT_G_TIOBENCH,
1248 },
1249
1250 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001251 .name = NULL,
1252 }
1253};
1254
1255struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1256{
1257 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1258}
1259
Jens Axboe9af4a242012-03-16 10:13:49 +01001260/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001261 * Map of job/command line options
1262 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001263struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001264 {
1265 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001266 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001267 .type = FIO_OPT_STR_STORE,
1268 .off1 = td_var_offset(description),
1269 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001270 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001271 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001272 },
1273 {
1274 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001275 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001276 .type = FIO_OPT_STR_STORE,
1277 .off1 = td_var_offset(name),
1278 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001279 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001280 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001281 },
1282 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001283 .name = "filename",
1284 .lname = "Filename(s)",
1285 .type = FIO_OPT_STR_STORE,
1286 .off1 = td_var_offset(filename),
1287 .cb = str_filename_cb,
1288 .prio = -1, /* must come after "directory" */
1289 .help = "File(s) to use for the workload",
1290 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001291 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001292 },
1293 {
1294 .name = "directory",
1295 .lname = "Directory",
1296 .type = FIO_OPT_STR_STORE,
1297 .off1 = td_var_offset(directory),
1298 .cb = str_directory_cb,
1299 .help = "Directory to store files in",
1300 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001301 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001302 },
1303 {
Jens Axboede98bd32013-04-05 11:09:20 +02001304 .name = "filename_format",
1305 .type = FIO_OPT_STR_STORE,
1306 .off1 = td_var_offset(filename_format),
1307 .prio = -1, /* must come after "directory" */
1308 .help = "Override default $jobname.$jobnum.$filenum naming",
1309 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001310 .category = FIO_OPT_C_FILE,
1311 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001312 },
1313 {
Jens Axboe29c13492008-03-01 19:25:20 +01001314 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001315 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001316 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001317 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001318 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001319 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001320 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001321 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001322 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001323 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001324 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001325 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001326 .posval = {
1327 { .ival = "none",
1328 .oval = FILE_LOCK_NONE,
1329 .help = "No file locking",
1330 },
1331 { .ival = "exclusive",
1332 .oval = FILE_LOCK_EXCLUSIVE,
1333 .help = "Exclusive file lock",
1334 },
1335 {
1336 .ival = "readwrite",
1337 .oval = FILE_LOCK_READWRITE,
1338 .help = "Read vs write lock",
1339 },
1340 },
Jens Axboe29c13492008-03-01 19:25:20 +01001341 },
1342 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001343 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001344 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001345 .type = FIO_OPT_STR_STORE,
1346 .off1 = td_var_offset(opendir),
1347 .cb = str_opendir_cb,
1348 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001349 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001350 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001351 },
1352 {
1353 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001354 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001355 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001356 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001357 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001358 .off1 = td_var_offset(td_ddir),
1359 .help = "IO direction",
1360 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001361 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001362 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001363 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001364 .posval = {
1365 { .ival = "read",
1366 .oval = TD_DDIR_READ,
1367 .help = "Sequential read",
1368 },
1369 { .ival = "write",
1370 .oval = TD_DDIR_WRITE,
1371 .help = "Sequential write",
1372 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001373 { .ival = "trim",
1374 .oval = TD_DDIR_TRIM,
1375 .help = "Sequential trim",
1376 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001377 { .ival = "randread",
1378 .oval = TD_DDIR_RANDREAD,
1379 .help = "Random read",
1380 },
1381 { .ival = "randwrite",
1382 .oval = TD_DDIR_RANDWRITE,
1383 .help = "Random write",
1384 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001385 { .ival = "randtrim",
1386 .oval = TD_DDIR_RANDTRIM,
1387 .help = "Random trim",
1388 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001389 { .ival = "rw",
1390 .oval = TD_DDIR_RW,
1391 .help = "Sequential read and write mix",
1392 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001393 { .ival = "readwrite",
1394 .oval = TD_DDIR_RW,
1395 .help = "Sequential read and write mix",
1396 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001397 { .ival = "randrw",
1398 .oval = TD_DDIR_RANDRW,
1399 .help = "Random read and write mix"
1400 },
1401 },
1402 },
1403 {
Jens Axboe38dad622010-07-20 14:46:00 -06001404 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001405 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001406 .type = FIO_OPT_STR,
1407 .off1 = td_var_offset(rw_seq),
1408 .help = "IO offset generator modifier",
1409 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001410 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001411 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001412 .posval = {
1413 { .ival = "sequential",
1414 .oval = RW_SEQ_SEQ,
1415 .help = "Generate sequential offsets",
1416 },
1417 { .ival = "identical",
1418 .oval = RW_SEQ_IDENT,
1419 .help = "Generate identical offsets",
1420 },
1421 },
1422 },
1423
1424 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001425 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001426 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001427 .type = FIO_OPT_STR_STORE,
1428 .off1 = td_var_offset(ioengine),
1429 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001430 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001431 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001432 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001433 .posval = {
1434 { .ival = "sync",
1435 .help = "Use read/write",
1436 },
gurudas paia31041e2007-10-23 15:12:30 +02001437 { .ival = "psync",
1438 .help = "Use pread/pwrite",
1439 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001440 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001441 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001442 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001443#ifdef CONFIG_PWRITEV
1444 { .ival = "pvsync",
1445 .help = "Use preadv/pwritev",
1446 },
1447#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001448#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001449 { .ival = "libaio",
1450 .help = "Linux native asynchronous IO",
1451 },
1452#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001453#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001454 { .ival = "posixaio",
1455 .help = "POSIX asynchronous IO",
1456 },
1457#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001458#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001459 { .ival = "solarisaio",
1460 .help = "Solaris native asynchronous IO",
1461 },
1462#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001463#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001464 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001465 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001466 },
Jens Axboe3be80072011-01-19 11:07:28 -07001467#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001468#ifdef CONFIG_RBD
1469 { .ival = "rbd",
1470 .help = "Rados Block Device asynchronous IO"
1471 },
1472#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001473 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001474 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001475 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001476#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001477 { .ival = "splice",
1478 .help = "splice/vmsplice based IO",
1479 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001480 { .ival = "netsplice",
1481 .help = "splice/vmsplice to/from the network",
1482 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001483#endif
1484#ifdef FIO_HAVE_SGIO
1485 { .ival = "sg",
1486 .help = "SCSI generic v3 IO",
1487 },
1488#endif
1489 { .ival = "null",
1490 .help = "Testing engine (no data transfer)",
1491 },
1492 { .ival = "net",
1493 .help = "Network IO",
1494 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001495 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001496 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001497 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001498#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001499 { .ival = "guasi",
1500 .help = "GUASI IO engine",
1501 },
1502#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001503#ifdef FIO_HAVE_BINJECT
1504 { .ival = "binject",
1505 .help = "binject direct inject block engine",
1506 },
1507#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001508#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001509 { .ival = "rdma",
1510 .help = "RDMA IO engine",
1511 },
1512#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001513#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001514 { .ival = "fusion-aw-sync",
1515 .help = "Fusion-io atomic write engine",
1516 },
1517#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001518#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001519 { .ival = "e4defrag",
1520 .help = "ext4 defrag engine",
1521 },
1522#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001523#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001524 { .ival = "falloc",
1525 .help = "fallocate() file based engine",
1526 },
1527#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001528 { .ival = "external",
1529 .help = "Load external engine (append name)",
1530 },
1531 },
1532 },
1533 {
1534 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001535 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001536 .type = FIO_OPT_INT,
1537 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001538 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001539 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001540 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001541 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001542 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001543 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001544 },
1545 {
1546 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001547 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001548 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001549 .type = FIO_OPT_INT,
1550 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001551 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001552 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001553 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001554 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001555 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001556 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001557 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001558 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001559 },
1560 {
Jens Axboe49504212008-06-05 09:03:30 +02001561 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001562 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001563 .type = FIO_OPT_INT,
1564 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001565 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001566 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001567 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001568 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001569 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001570 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001571 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001572 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001573 },
1574 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001575 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001576 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001577 .type = FIO_OPT_INT,
1578 .off1 = td_var_offset(iodepth_low),
1579 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001580 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001581 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001582 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001583 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001584 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001585 },
1586 {
1587 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001588 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001589 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001590 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001591 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001592 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001593 .category = FIO_OPT_C_IO,
1594 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001595 },
1596 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001597 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001598 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001599 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001600 .type = FIO_OPT_BOOL,
1601 .off1 = td_var_offset(fill_device),
1602 .help = "Write until an ENOSPC error occurs",
1603 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001604 .category = FIO_OPT_C_FILE,
1605 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001606 },
1607 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001608 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001609 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001610 .type = FIO_OPT_STR_VAL,
1611 .off1 = td_var_offset(file_size_low),
1612 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001613 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001614 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001615 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001616 .category = FIO_OPT_C_FILE,
1617 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001618 },
1619 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001620 .name = "file_append",
1621 .lname = "File append",
1622 .type = FIO_OPT_BOOL,
1623 .off1 = td_var_offset(file_append),
1624 .help = "IO will start at the end of the file(s)",
1625 .def = "0",
1626 .category = FIO_OPT_C_FILE,
1627 .group = FIO_OPT_G_INVALID,
1628 },
1629 {
Jens Axboe67a10002007-07-31 23:12:16 +02001630 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001631 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001632 .alias = "fileoffset",
1633 .type = FIO_OPT_STR_VAL,
1634 .off1 = td_var_offset(start_offset),
1635 .help = "Start IO from this offset",
1636 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001637 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001638 .category = FIO_OPT_C_IO,
1639 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001640 },
1641 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001642 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001643 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001644 .type = FIO_OPT_STR_VAL,
1645 .off1 = td_var_offset(offset_increment),
1646 .help = "What is the increment from one offset to the next",
1647 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001648 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001649 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001650 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001651 .category = FIO_OPT_C_IO,
1652 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001653 },
1654 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001655 .name = "number_ios",
1656 .lname = "Number of IOs to perform",
1657 .type = FIO_OPT_STR_VAL,
1658 .off1 = td_var_offset(number_ios),
1659 .help = "Force job completion of this number of IOs",
1660 .def = "0",
1661 .category = FIO_OPT_C_IO,
1662 .group = FIO_OPT_G_INVALID,
1663 },
1664 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001665 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001666 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001667 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001668 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001669 .off1 = td_var_offset(bs[DDIR_READ]),
1670 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001671 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001672 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001673 .help = "Block size unit",
1674 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001675 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001676 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001677 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001678 .category = FIO_OPT_C_IO,
1679 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001680 },
1681 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001682 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001683 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001684 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001685 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001686 .off1 = td_var_offset(ba[DDIR_READ]),
1687 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001688 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001689 .minval = 1,
1690 .help = "IO block offset alignment",
1691 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001692 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001693 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001694 .category = FIO_OPT_C_IO,
1695 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001696 },
1697 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001698 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001699 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001700 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001701 .type = FIO_OPT_RANGE,
1702 .off1 = td_var_offset(min_bs[DDIR_READ]),
1703 .off2 = td_var_offset(max_bs[DDIR_READ]),
1704 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1705 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001706 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1707 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001708 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001709 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001710 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001711 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001712 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001713 .category = FIO_OPT_C_IO,
1714 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001715 },
1716 {
Jens Axboe564ca972007-12-14 12:21:19 +01001717 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001718 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001719 .type = FIO_OPT_STR,
1720 .cb = str_bssplit_cb,
1721 .help = "Set a specific mix of block sizes",
1722 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001723 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001724 .category = FIO_OPT_C_IO,
1725 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001726 },
1727 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001728 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001729 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001730 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001731 .type = FIO_OPT_STR_SET,
1732 .off1 = td_var_offset(bs_unaligned),
1733 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001734 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001735 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001736 .category = FIO_OPT_C_IO,
1737 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001738 },
1739 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001740 .name = "bs_is_seq_rand",
1741 .lname = "Block size division is seq/random (not read/write)",
1742 .type = FIO_OPT_BOOL,
1743 .off1 = td_var_offset(bs_is_seq_rand),
1744 .help = "Consider any blocksize setting to be sequential,ramdom",
1745 .def = "0",
1746 .parent = "blocksize",
1747 .category = FIO_OPT_C_IO,
1748 .group = FIO_OPT_G_INVALID,
1749 },
1750 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001751 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001752 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001753 .type = FIO_OPT_BOOL,
1754 .off1 = td_var_offset(rand_repeatable),
1755 .help = "Use repeatable random IO pattern",
1756 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001757 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001758 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001759 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001760 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001761 },
1762 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001763 .name = "randseed",
1764 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001765 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001766 .off1 = td_var_offset(rand_seed),
1767 .help = "Set the random generator seed value",
1768 .parent = "rw",
1769 .category = FIO_OPT_C_IO,
1770 .group = FIO_OPT_G_RANDOM,
1771 },
1772 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001773 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001774 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001775 .type = FIO_OPT_BOOL,
1776 .off1 = td_var_offset(use_os_rand),
1777 .help = "Set to use OS random generator",
1778 .def = "0",
1779 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001780 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001781 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001782 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001783 },
1784 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001785 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001786 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001787 .type = FIO_OPT_STR_SET,
1788 .off1 = td_var_offset(norandommap),
1789 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001790 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001791 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001792 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001793 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001794 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001795 },
1796 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001797 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001798 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001799 .type = FIO_OPT_BOOL,
1800 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001801 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001802 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001803 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001804 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001805 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001806 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001807 },
1808 {
Jens Axboe8055e412012-11-26 08:43:47 +01001809 .name = "random_generator",
1810 .type = FIO_OPT_STR,
1811 .off1 = td_var_offset(random_generator),
1812 .help = "Type of random number generator to use",
1813 .def = "tausworthe",
1814 .posval = {
1815 { .ival = "tausworthe",
1816 .oval = FIO_RAND_GEN_TAUSWORTHE,
1817 .help = "Strong Tausworthe generator",
1818 },
1819 { .ival = "lfsr",
1820 .oval = FIO_RAND_GEN_LFSR,
1821 .help = "Variable length LFSR",
1822 },
1823 },
Jens Axboe48107592012-12-04 09:43:11 +01001824 .category = FIO_OPT_C_IO,
1825 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001826 },
1827 {
Jens Axboee25839d2012-11-06 10:49:42 +01001828 .name = "random_distribution",
1829 .type = FIO_OPT_STR,
1830 .off1 = td_var_offset(random_distribution),
1831 .cb = str_random_distribution_cb,
1832 .help = "Random offset distribution generator",
1833 .def = "random",
1834 .posval = {
1835 { .ival = "random",
1836 .oval = FIO_RAND_DIST_RANDOM,
1837 .help = "Completely random",
1838 },
1839 { .ival = "zipf",
1840 .oval = FIO_RAND_DIST_ZIPF,
1841 .help = "Zipf distribution",
1842 },
Jens Axboe925fee32012-11-06 13:50:32 +01001843 { .ival = "pareto",
1844 .oval = FIO_RAND_DIST_PARETO,
1845 .help = "Pareto distribution",
1846 },
Jens Axboee25839d2012-11-06 10:49:42 +01001847 },
Jens Axboe48107592012-12-04 09:43:11 +01001848 .category = FIO_OPT_C_IO,
1849 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001850 },
1851 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001852 .name = "percentage_random",
1853 .lname = "Percentage Random",
1854 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001855 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1856 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1857 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001858 .maxval = 100,
1859 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001860 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001861 .interval = 5,
1862 .inverse = "percentage_sequential",
1863 .category = FIO_OPT_C_IO,
1864 .group = FIO_OPT_G_RANDOM,
1865 },
1866 {
1867 .name = "percentage_sequential",
1868 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001869 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001870 .category = FIO_OPT_C_IO,
1871 .group = FIO_OPT_G_RANDOM,
1872 },
1873 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001874 .name = "allrandrepeat",
1875 .type = FIO_OPT_BOOL,
1876 .off1 = td_var_offset(allrand_repeatable),
1877 .help = "Use repeatable random numbers for everything",
1878 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001879 .category = FIO_OPT_C_IO,
1880 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001881 },
1882 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001883 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001884 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001885 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001886 .type = FIO_OPT_INT,
1887 .off1 = td_var_offset(nr_files),
1888 .help = "Split job workload between this number of files",
1889 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001890 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001891 .category = FIO_OPT_C_FILE,
1892 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001893 },
1894 {
1895 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001896 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001897 .type = FIO_OPT_INT,
1898 .off1 = td_var_offset(open_files),
1899 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001900 .category = FIO_OPT_C_FILE,
1901 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001902 },
1903 {
1904 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001905 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001906 .type = FIO_OPT_STR,
1907 .cb = str_fst_cb,
1908 .off1 = td_var_offset(file_service_type),
1909 .help = "How to select which file to service next",
1910 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001911 .category = FIO_OPT_C_FILE,
1912 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001913 .posval = {
1914 { .ival = "random",
1915 .oval = FIO_FSERVICE_RANDOM,
1916 .help = "Choose a file at random",
1917 },
1918 { .ival = "roundrobin",
1919 .oval = FIO_FSERVICE_RR,
1920 .help = "Round robin select files",
1921 },
Jens Axboea086c252009-03-04 08:27:37 +01001922 { .ival = "sequential",
1923 .oval = FIO_FSERVICE_SEQ,
1924 .help = "Finish one file before moving to the next",
1925 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001926 },
Jens Axboe67a10002007-07-31 23:12:16 +02001927 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001928 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001929 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001930#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001931 {
1932 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001933 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001934 .type = FIO_OPT_STR,
1935 .off1 = td_var_offset(fallocate_mode),
1936 .help = "Whether pre-allocation is performed when laying out files",
1937 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001938 .category = FIO_OPT_C_FILE,
1939 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001940 .posval = {
1941 { .ival = "none",
1942 .oval = FIO_FALLOCATE_NONE,
1943 .help = "Do not pre-allocate space",
1944 },
1945 { .ival = "posix",
1946 .oval = FIO_FALLOCATE_POSIX,
1947 .help = "Use posix_fallocate()",
1948 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001949#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001950 { .ival = "keep",
1951 .oval = FIO_FALLOCATE_KEEP_SIZE,
1952 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1953 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001954#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001955 /* Compatibility with former boolean values */
1956 { .ival = "0",
1957 .oval = FIO_FALLOCATE_NONE,
1958 .help = "Alias for 'none'",
1959 },
1960 { .ival = "1",
1961 .oval = FIO_FALLOCATE_POSIX,
1962 .help = "Alias for 'posix'",
1963 },
1964 },
1965 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001966#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001967 {
1968 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01001969 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001970 .type = FIO_OPT_BOOL,
1971 .off1 = td_var_offset(fadvise_hint),
1972 .help = "Use fadvise() to advise the kernel on IO pattern",
1973 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001974 .category = FIO_OPT_C_FILE,
1975 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001976 },
1977 {
1978 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001979 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001980 .type = FIO_OPT_INT,
1981 .off1 = td_var_offset(fsync_blocks),
1982 .help = "Issue fsync for writes every given number of blocks",
1983 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001984 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001985 .category = FIO_OPT_C_FILE,
1986 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001987 },
1988 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001989 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001990 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001991 .type = FIO_OPT_INT,
1992 .off1 = td_var_offset(fdatasync_blocks),
1993 .help = "Issue fdatasync for writes every given number of blocks",
1994 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001995 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001996 .category = FIO_OPT_C_FILE,
1997 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001998 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001999 {
2000 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002001 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002002 .type = FIO_OPT_INT,
2003 .off1 = td_var_offset(barrier_blocks),
2004 .help = "Make every Nth write a barrier write",
2005 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002006 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002007 .category = FIO_OPT_C_IO,
2008 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002009 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002010#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002011 {
2012 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002013 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002014 .posval = {
2015 { .ival = "wait_before",
2016 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2017 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002018 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002019 },
2020 { .ival = "write",
2021 .oval = SYNC_FILE_RANGE_WRITE,
2022 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002023 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002024 },
2025 {
2026 .ival = "wait_after",
2027 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2028 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002029 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002030 },
2031 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002032 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002033 .cb = str_sfr_cb,
2034 .off1 = td_var_offset(sync_file_range),
2035 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002036 .category = FIO_OPT_C_FILE,
2037 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002038 },
2039#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002040 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002041 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002042 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002043 .type = FIO_OPT_BOOL,
2044 .off1 = td_var_offset(odirect),
2045 .help = "Use O_DIRECT IO (negates buffered)",
2046 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002047 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002048 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002049 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002050 },
2051 {
Chris Masond01612f2013-11-15 15:52:58 -07002052 .name = "atomic",
2053 .lname = "Atomic I/O",
2054 .type = FIO_OPT_BOOL,
2055 .off1 = td_var_offset(oatomic),
2056 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2057 .def = "0",
2058 .category = FIO_OPT_C_IO,
2059 .group = FIO_OPT_G_IO_TYPE,
2060 },
2061 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002062 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002063 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002064 .type = FIO_OPT_BOOL,
2065 .off1 = td_var_offset(odirect),
2066 .neg = 1,
2067 .help = "Use buffered IO (negates direct)",
2068 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002069 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002070 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002071 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002072 },
2073 {
2074 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002075 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002076 .type = FIO_OPT_BOOL,
2077 .off1 = td_var_offset(overwrite),
2078 .help = "When writing, set whether to overwrite current data",
2079 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002080 .category = FIO_OPT_C_FILE,
2081 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002082 },
2083 {
2084 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002085 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002086 .type = FIO_OPT_INT,
2087 .off1 = td_var_offset(loops),
2088 .help = "Number of times to run the job",
2089 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002090 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002091 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002092 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002093 },
2094 {
2095 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002096 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002097 .type = FIO_OPT_INT,
2098 .off1 = td_var_offset(numjobs),
2099 .help = "Duplicate this job this many times",
2100 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002101 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002102 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002103 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002104 },
2105 {
2106 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002107 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002108 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002109 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002110 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002111 .help = "Only start job when this period has passed",
2112 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002113 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002114 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002115 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002116 },
2117 {
2118 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002119 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002120 .alias = "timeout",
2121 .type = FIO_OPT_STR_VAL_TIME,
2122 .off1 = td_var_offset(timeout),
2123 .help = "Stop workload when this amount of time has passed",
2124 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002125 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002126 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002127 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002128 },
2129 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002130 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002131 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002132 .type = FIO_OPT_STR_SET,
2133 .off1 = td_var_offset(time_based),
2134 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002135 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002136 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002137 },
2138 {
Juan Casse62167762013-09-17 14:06:13 -07002139 .name = "verify_only",
2140 .lname = "Verify only",
2141 .type = FIO_OPT_STR_SET,
2142 .off1 = td_var_offset(verify_only),
2143 .help = "Verifies previously written data is still valid",
2144 .category = FIO_OPT_C_GENERAL,
2145 .group = FIO_OPT_G_RUNTIME,
2146 },
2147 {
Jens Axboe721938a2008-09-10 09:46:16 +02002148 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002149 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002150 .type = FIO_OPT_STR_VAL_TIME,
2151 .off1 = td_var_offset(ramp_time),
2152 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002153 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002154 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002155 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002156 },
2157 {
Jens Axboec223da82010-03-24 13:23:53 +01002158 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002159 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002160 .type = FIO_OPT_STR,
2161 .cb = fio_clock_source_cb,
2162 .off1 = td_var_offset(clocksource),
2163 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002164 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002165 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002166 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002167#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002168 { .ival = "gettimeofday",
2169 .oval = CS_GTOD,
2170 .help = "Use gettimeofday(2) for timing",
2171 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002172#endif
2173#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002174 { .ival = "clock_gettime",
2175 .oval = CS_CGETTIME,
2176 .help = "Use clock_gettime(2) for timing",
2177 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002178#endif
Jens Axboec223da82010-03-24 13:23:53 +01002179#ifdef ARCH_HAVE_CPU_CLOCK
2180 { .ival = "cpu",
2181 .oval = CS_CPUCLOCK,
2182 .help = "Use CPU private clock",
2183 },
2184#endif
2185 },
2186 },
2187 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002188 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002189 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002190 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002191 .type = FIO_OPT_STR,
2192 .cb = str_mem_cb,
2193 .off1 = td_var_offset(mem_type),
2194 .help = "Backing type for IO buffers",
2195 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002196 .category = FIO_OPT_C_IO,
2197 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002198 .posval = {
2199 { .ival = "malloc",
2200 .oval = MEM_MALLOC,
2201 .help = "Use malloc(3) for IO buffers",
2202 },
Jens Axboeb370e462007-03-19 10:51:49 +01002203 { .ival = "shm",
2204 .oval = MEM_SHM,
2205 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002206 },
2207#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002208 { .ival = "shmhuge",
2209 .oval = MEM_SHMHUGE,
2210 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002211 },
2212#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002213 { .ival = "mmap",
2214 .oval = MEM_MMAP,
2215 .help = "Use mmap(2) (file or anon) for IO buffers",
2216 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002217#ifdef FIO_HAVE_HUGETLB
2218 { .ival = "mmaphuge",
2219 .oval = MEM_MMAPHUGE,
2220 .help = "Like mmap, but use huge pages",
2221 },
2222#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002223 },
2224 },
2225 {
Jens Axboed529ee12009-07-01 10:33:03 +02002226 .name = "iomem_align",
2227 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002228 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002229 .type = FIO_OPT_INT,
2230 .off1 = td_var_offset(mem_align),
2231 .minval = 0,
2232 .help = "IO memory buffer offset alignment",
2233 .def = "0",
2234 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002235 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002236 .category = FIO_OPT_C_IO,
2237 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002238 },
2239 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002240 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002241 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002242 .type = FIO_OPT_STR,
2243 .off1 = td_var_offset(verify),
2244 .help = "Verify data written",
2245 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002246 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002247 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002248 .posval = {
2249 { .ival = "0",
2250 .oval = VERIFY_NONE,
2251 .help = "Don't do IO verification",
2252 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002253 { .ival = "md5",
2254 .oval = VERIFY_MD5,
2255 .help = "Use md5 checksums for verification",
2256 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002257 { .ival = "crc64",
2258 .oval = VERIFY_CRC64,
2259 .help = "Use crc64 checksums for verification",
2260 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002261 { .ival = "crc32",
2262 .oval = VERIFY_CRC32,
2263 .help = "Use crc32 checksums for verification",
2264 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002265 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002266 .oval = VERIFY_CRC32C,
2267 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002268 },
Jens Axboebac39e02008-06-11 20:46:19 +02002269 { .ival = "crc32c",
2270 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002271 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002272 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002273 { .ival = "crc16",
2274 .oval = VERIFY_CRC16,
2275 .help = "Use crc16 checksums for verification",
2276 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002277 { .ival = "crc7",
2278 .oval = VERIFY_CRC7,
2279 .help = "Use crc7 checksums for verification",
2280 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002281 { .ival = "sha1",
2282 .oval = VERIFY_SHA1,
2283 .help = "Use sha1 checksums for verification",
2284 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002285 { .ival = "sha256",
2286 .oval = VERIFY_SHA256,
2287 .help = "Use sha256 checksums for verification",
2288 },
2289 { .ival = "sha512",
2290 .oval = VERIFY_SHA512,
2291 .help = "Use sha512 checksums for verification",
2292 },
Jens Axboe844ea602014-02-20 13:21:45 -08002293 { .ival = "xxhash",
2294 .oval = VERIFY_XXHASH,
2295 .help = "Use xxhash checksums for verification",
2296 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002297 { .ival = "meta",
2298 .oval = VERIFY_META,
2299 .help = "Use io information",
2300 },
Jens Axboe36690c92007-03-26 10:23:34 +02002301 {
2302 .ival = "null",
2303 .oval = VERIFY_NULL,
2304 .help = "Pretend to verify",
2305 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002306 },
2307 },
2308 {
Jens Axboe005c5652007-08-02 22:21:36 +02002309 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002310 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002311 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002312 .off1 = td_var_offset(do_verify),
2313 .help = "Run verification stage after write",
2314 .def = "1",
2315 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002316 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002317 .category = FIO_OPT_C_IO,
2318 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002319 },
2320 {
Jens Axboe160b9662007-03-27 10:59:49 +02002321 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002322 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002323 .type = FIO_OPT_BOOL,
2324 .off1 = td_var_offset(verifysort),
2325 .help = "Sort written verify blocks for read back",
2326 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002327 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002328 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002329 .category = FIO_OPT_C_IO,
2330 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002331 },
2332 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002333 .name = "verifysort_nr",
2334 .type = FIO_OPT_INT,
2335 .off1 = td_var_offset(verifysort_nr),
2336 .help = "Pre-load and sort verify blocks for a read workload",
2337 .minval = 0,
2338 .maxval = 131072,
2339 .def = "1024",
2340 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002341 .category = FIO_OPT_C_IO,
2342 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002343 },
2344 {
Jens Axboea59e1702007-07-30 08:53:27 +02002345 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002346 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002347 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002348 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002349 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002350 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002351 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002352 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002353 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002354 .category = FIO_OPT_C_IO,
2355 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002356 },
2357 {
Jens Axboea59e1702007-07-30 08:53:27 +02002358 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002359 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002360 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002361 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002362 .off1 = td_var_offset(verify_offset),
2363 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002364 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002365 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002366 .category = FIO_OPT_C_IO,
2367 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002368 },
2369 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002370 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002371 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002372 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002373 .cb = str_verify_pattern_cb,
2374 .help = "Fill pattern for IO buffers",
2375 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002376 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002377 .category = FIO_OPT_C_IO,
2378 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002379 },
2380 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002381 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002382 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002383 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002384 .off1 = td_var_offset(verify_fatal),
2385 .def = "0",
2386 .help = "Exit on a single verify failure, don't continue",
2387 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002388 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002389 .category = FIO_OPT_C_IO,
2390 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002391 },
2392 {
Jens Axboeb463e932011-01-12 09:03:23 +01002393 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002394 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002395 .type = FIO_OPT_BOOL,
2396 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002397 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002398 .help = "Dump contents of good and bad blocks on failure",
2399 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002400 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002401 .category = FIO_OPT_C_IO,
2402 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002403 },
2404 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002405 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002406 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002407 .type = FIO_OPT_INT,
2408 .off1 = td_var_offset(verify_async),
2409 .def = "0",
2410 .help = "Number of async verifier threads to use",
2411 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002412 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002415 },
Jens Axboe9e144182010-06-15 14:25:36 +02002416 {
2417 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002418 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002419 .type = FIO_OPT_STR_VAL,
2420 .off1 = td_var_offset(verify_backlog),
2421 .help = "Verify after this number of blocks are written",
2422 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002423 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002424 .category = FIO_OPT_C_IO,
2425 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002426 },
2427 {
2428 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002429 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002430 .type = FIO_OPT_INT,
2431 .off1 = td_var_offset(verify_batch),
2432 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002433 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002434 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002435 .category = FIO_OPT_C_IO,
2436 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002437 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002438#ifdef FIO_HAVE_CPU_AFFINITY
2439 {
2440 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002441 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002442 .type = FIO_OPT_STR,
2443 .cb = str_verify_cpus_allowed_cb,
2444 .help = "Set CPUs allowed for async verify threads",
2445 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002446 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002447 .category = FIO_OPT_C_IO,
2448 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002449 },
2450#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002451 {
2452 .name = "experimental_verify",
2453 .off1 = td_var_offset(experimental_verify),
2454 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002455 .help = "Enable experimental verification",
Jens Axboe836fcc02013-01-24 09:08:45 -07002456 .category = FIO_OPT_C_IO,
2457 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002458 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002459#ifdef FIO_HAVE_TRIM
2460 {
2461 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002462 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002463 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002464 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002465 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002466 .maxval = 100,
2467 .help = "Number of verify blocks to discard/trim",
2468 .parent = "verify",
2469 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002470 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002471 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002474 },
2475 {
2476 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002477 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002478 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002479 .help = "Verify that trim/discarded blocks are returned as zeroes",
2480 .off1 = td_var_offset(trim_zero),
2481 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002482 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002483 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002486 },
2487 {
2488 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002489 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002490 .type = FIO_OPT_STR_VAL,
2491 .off1 = td_var_offset(trim_backlog),
2492 .help = "Trim after this number of blocks are written",
2493 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002494 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002495 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002498 },
2499 {
2500 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002501 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002502 .type = FIO_OPT_INT,
2503 .off1 = td_var_offset(trim_batch),
2504 .help = "Trim this number of IO blocks",
2505 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002506 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002507 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002510 },
2511#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002512 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002513 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002514 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002515 .type = FIO_OPT_STR_STORE,
2516 .off1 = td_var_offset(write_iolog_file),
2517 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002520 },
2521 {
2522 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002523 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002524 .type = FIO_OPT_STR_STORE,
2525 .off1 = td_var_offset(read_iolog_file),
2526 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002527 .category = FIO_OPT_C_IO,
2528 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002529 },
2530 {
David Nellans64bbb862010-08-24 22:13:30 +02002531 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002532 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002533 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002534 .off1 = td_var_offset(no_stall),
2535 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002536 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002537 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002538 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002539 .category = FIO_OPT_C_IO,
2540 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002541 },
2542 {
David Nellansd1c46c02010-08-31 21:20:47 +02002543 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002544 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002545 .type = FIO_OPT_STR_STORE,
2546 .off1 = td_var_offset(replay_redirect),
2547 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002548 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002549 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002550 .category = FIO_OPT_C_IO,
2551 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002552 },
2553 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002554 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002555 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002556 .type = FIO_OPT_STR_STORE,
2557 .off1 = td_var_offset(exec_prerun),
2558 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002559 .category = FIO_OPT_C_GENERAL,
2560 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002561 },
2562 {
2563 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002564 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002565 .type = FIO_OPT_STR_STORE,
2566 .off1 = td_var_offset(exec_postrun),
2567 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002568 .category = FIO_OPT_C_GENERAL,
2569 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002570 },
2571#ifdef FIO_HAVE_IOSCHED_SWITCH
2572 {
2573 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002574 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002575 .type = FIO_OPT_STR_STORE,
2576 .off1 = td_var_offset(ioscheduler),
2577 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002578 .category = FIO_OPT_C_FILE,
2579 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002580 },
2581#endif
2582 {
2583 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002584 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002585 .type = FIO_OPT_STR_VAL,
2586 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002587 .help = "Amount of data to read per zone",
2588 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002589 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002590 .category = FIO_OPT_C_IO,
2591 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002592 },
2593 {
2594 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002595 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002596 .type = FIO_OPT_STR_VAL,
2597 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002598 .help = "Give size of an IO zone",
2599 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002600 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002601 .category = FIO_OPT_C_IO,
2602 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002603 },
2604 {
2605 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002606 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002607 .type = FIO_OPT_STR_VAL,
2608 .off1 = td_var_offset(zone_skip),
2609 .help = "Space between IO zones",
2610 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002611 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002612 .category = FIO_OPT_C_IO,
2613 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002614 },
2615 {
2616 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002617 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002618 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002619 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002620 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002621 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002622 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002623 .category = FIO_OPT_C_GENERAL,
2624 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002625 },
2626 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002627 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002628 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002629 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002630 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002631 .maxval = 100,
2632 .help = "Percentage of mixed workload that is reads",
2633 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002634 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002635 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002636 .category = FIO_OPT_C_IO,
2637 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002638 },
2639 {
2640 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002641 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002642 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002643 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002644 .maxval = 100,
2645 .help = "Percentage of mixed workload that is writes",
2646 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002647 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002648 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002649 .category = FIO_OPT_C_IO,
2650 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002651 },
2652 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002653 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002654 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002655 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002656 .category = FIO_OPT_C_IO,
2657 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002658 },
2659 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002660 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002661 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002662 .type = FIO_OPT_INT,
2663 .off1 = td_var_offset(nice),
2664 .help = "Set job CPU nice value",
2665 .minval = -19,
2666 .maxval = 20,
2667 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002668 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002669 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002670 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002671 },
2672#ifdef FIO_HAVE_IOPRIO
2673 {
2674 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002675 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002676 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002677 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002678 .help = "Set job IO priority value",
2679 .minval = 0,
2680 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002681 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002682 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002683 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002684 },
2685 {
2686 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002687 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002689 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002690 .help = "Set job IO priority class",
2691 .minval = 0,
2692 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002693 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002694 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002695 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002696 },
2697#endif
2698 {
2699 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002700 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002701 .type = FIO_OPT_INT,
2702 .off1 = td_var_offset(thinktime),
2703 .help = "Idle time between IO buffers (usec)",
2704 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002705 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002706 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002707 },
2708 {
2709 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002710 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002711 .type = FIO_OPT_INT,
2712 .off1 = td_var_offset(thinktime_spin),
2713 .help = "Start think time by spinning this amount (usec)",
2714 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002715 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002716 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002717 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002718 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002719 },
2720 {
2721 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002722 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002723 .type = FIO_OPT_INT,
2724 .off1 = td_var_offset(thinktime_blocks),
2725 .help = "IO buffer period between 'thinktime'",
2726 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002727 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002728 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002729 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002730 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002731 },
2732 {
2733 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002734 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002735 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002736 .off1 = td_var_offset(rate[DDIR_READ]),
2737 .off2 = td_var_offset(rate[DDIR_WRITE]),
2738 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002739 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002740 .category = FIO_OPT_C_IO,
2741 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002742 },
2743 {
2744 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002745 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002746 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002747 .off1 = td_var_offset(ratemin[DDIR_READ]),
2748 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2749 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002750 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002751 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002752 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002753 .category = FIO_OPT_C_IO,
2754 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002755 },
2756 {
2757 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002758 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002759 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002760 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2761 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2762 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002763 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002764 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002765 .category = FIO_OPT_C_IO,
2766 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002767 },
2768 {
2769 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002770 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002771 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002772 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2773 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2774 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002775 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002776 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002777 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002778 .category = FIO_OPT_C_IO,
2779 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002780 },
2781 {
2782 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002783 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002784 .type = FIO_OPT_INT,
2785 .off1 = td_var_offset(ratecycle),
2786 .help = "Window average for rate limits (msec)",
2787 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002788 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002789 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002790 .category = FIO_OPT_C_IO,
2791 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002792 },
2793 {
Jens Axboe15501532012-10-24 16:37:45 +02002794 .name = "max_latency",
2795 .type = FIO_OPT_INT,
2796 .off1 = td_var_offset(max_latency),
2797 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe1e5324e2012-11-14 14:25:31 -07002798 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002799 .group = FIO_OPT_G_LATPROF,
2800 },
2801 {
2802 .name = "latency_target",
2803 .lname = "Latency Target (usec)",
2804 .type = FIO_OPT_STR_VAL_TIME,
2805 .off1 = td_var_offset(latency_target),
2806 .help = "Ramp to max queue depth supporting this latency",
2807 .category = FIO_OPT_C_IO,
2808 .group = FIO_OPT_G_LATPROF,
2809 },
2810 {
2811 .name = "latency_window",
2812 .lname = "Latency Window (usec)",
2813 .type = FIO_OPT_STR_VAL_TIME,
2814 .off1 = td_var_offset(latency_window),
2815 .help = "Time to sustain latency_target",
2816 .category = FIO_OPT_C_IO,
2817 .group = FIO_OPT_G_LATPROF,
2818 },
2819 {
2820 .name = "latency_percentile",
2821 .lname = "Latency Percentile",
2822 .type = FIO_OPT_FLOAT_LIST,
2823 .off1 = td_var_offset(latency_percentile),
2824 .help = "Percentile of IOs must be below latency_target",
2825 .def = "100",
2826 .maxlen = 1,
2827 .minfp = 0.0,
2828 .maxfp = 100.0,
2829 .category = FIO_OPT_C_IO,
2830 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002831 },
2832 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002833 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002834 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002835 .type = FIO_OPT_BOOL,
2836 .off1 = td_var_offset(invalidate_cache),
2837 .help = "Invalidate buffer/page cache prior to running job",
2838 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002839 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002840 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002841 },
2842 {
2843 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002844 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002845 .type = FIO_OPT_BOOL,
2846 .off1 = td_var_offset(sync_io),
2847 .help = "Use O_SYNC for buffered writes",
2848 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002849 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002850 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002851 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002852 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002853 },
2854 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002855 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002856 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002857 .type = FIO_OPT_BOOL,
2858 .off1 = td_var_offset(create_serialize),
2859 .help = "Serialize creating of job files",
2860 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002861 .category = FIO_OPT_C_FILE,
2862 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002863 },
2864 {
2865 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002866 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002867 .type = FIO_OPT_BOOL,
2868 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002869 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002870 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002871 .category = FIO_OPT_C_FILE,
2872 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002873 },
2874 {
Jens Axboe814452b2009-03-04 12:53:13 +01002875 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002876 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002877 .type = FIO_OPT_BOOL,
2878 .off1 = td_var_offset(create_on_open),
2879 .help = "Create files when they are opened for IO",
2880 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002881 .category = FIO_OPT_C_FILE,
2882 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002883 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002884 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002885 .name = "create_only",
2886 .type = FIO_OPT_BOOL,
2887 .off1 = td_var_offset(create_only),
2888 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002889 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002890 .def = "0",
2891 },
2892 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002893 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002894 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002895 .type = FIO_OPT_BOOL,
2896 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002897 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002898 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002899 .category = FIO_OPT_C_FILE,
2900 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002901 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002902#ifdef FIO_HAVE_CPU_AFFINITY
2903 {
2904 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002905 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002906 .type = FIO_OPT_INT,
2907 .cb = str_cpumask_cb,
2908 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002909 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002910 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002911 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002912 {
2913 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002914 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002915 .type = FIO_OPT_STR,
2916 .cb = str_cpus_allowed_cb,
2917 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002918 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002919 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002920 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002921 {
2922 .name = "cpus_allowed_policy",
2923 .lname = "CPUs allowed distribution policy",
2924 .type = FIO_OPT_STR,
2925 .off1 = td_var_offset(cpus_allowed_policy),
2926 .help = "Distribution policy for cpus_allowed",
2927 .parent = "cpus_allowed",
2928 .prio = 1,
2929 .posval = {
2930 { .ival = "shared",
2931 .oval = FIO_CPUS_SHARED,
2932 .help = "Mask shared between threads",
2933 },
2934 { .ival = "split",
2935 .oval = FIO_CPUS_SPLIT,
2936 .help = "Mask split between threads",
2937 },
2938 },
2939 .category = FIO_OPT_C_GENERAL,
2940 .group = FIO_OPT_G_CRED,
2941 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002942#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002943#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002944 {
2945 .name = "numa_cpu_nodes",
2946 .type = FIO_OPT_STR,
2947 .cb = str_numa_cpunodes_cb,
2948 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02002949 .category = FIO_OPT_C_GENERAL,
2950 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002951 },
2952 {
2953 .name = "numa_mem_policy",
2954 .type = FIO_OPT_STR,
2955 .cb = str_numa_mpol_cb,
2956 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02002957 .category = FIO_OPT_C_GENERAL,
2958 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002959 },
2960#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002961 {
2962 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002963 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002964 .type = FIO_OPT_BOOL,
2965 .off1 = td_var_offset(end_fsync),
2966 .help = "Include fsync at the end of job",
2967 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002968 .category = FIO_OPT_C_FILE,
2969 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002970 },
2971 {
2972 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01002973 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002974 .type = FIO_OPT_BOOL,
2975 .off1 = td_var_offset(fsync_on_close),
2976 .help = "fsync files on close",
2977 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002978 .category = FIO_OPT_C_FILE,
2979 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002980 },
2981 {
2982 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01002983 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002984 .type = FIO_OPT_BOOL,
2985 .off1 = td_var_offset(unlink),
2986 .help = "Unlink created files after job has completed",
2987 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002988 .category = FIO_OPT_C_FILE,
2989 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002990 },
2991 {
2992 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002993 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002994 .type = FIO_OPT_STR_SET,
2995 .cb = str_exitall_cb,
2996 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01002997 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002998 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002999 },
3000 {
3001 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003002 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003003 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003004 .type = FIO_OPT_STR_SET,
3005 .off1 = td_var_offset(stonewall),
3006 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003007 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003008 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003009 },
3010 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003011 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003012 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003013 .type = FIO_OPT_STR_SET,
3014 .off1 = td_var_offset(new_group),
3015 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003016 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003017 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003018 },
3019 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003020 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003021 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003022 .type = FIO_OPT_STR_SET,
3023 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003024 .help = "Use threads instead of processes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003025 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003026 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003027 },
3028 {
3029 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003030 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003031 .type = FIO_OPT_STR_STORE,
3032 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003033 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003034 .category = FIO_OPT_C_LOG,
3035 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003036 },
3037 {
3038 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003039 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003040 .type = FIO_OPT_STR_STORE,
3041 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003042 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003043 .category = FIO_OPT_C_LOG,
3044 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003045 },
3046 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003047 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003048 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003049 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003050 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003051 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003052 .category = FIO_OPT_C_LOG,
3053 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003054 },
3055 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003056 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003057 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003058 .type = FIO_OPT_INT,
3059 .off1 = td_var_offset(log_avg_msec),
3060 .help = "Average bw/iops/lat logs over this period of time",
3061 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003062 .category = FIO_OPT_C_LOG,
3063 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003064 },
3065 {
Jens Axboec504ee52012-03-20 11:29:09 +01003066 .name = "bwavgtime",
3067 .lname = "Bandwidth average time",
3068 .type = FIO_OPT_INT,
3069 .off1 = td_var_offset(bw_avg_time),
3070 .help = "Time window over which to calculate bandwidth"
3071 " (msec)",
3072 .def = "500",
3073 .parent = "write_bw_log",
3074 .hide = 1,
3075 .interval = 100,
3076 .category = FIO_OPT_C_LOG,
3077 .group = FIO_OPT_G_INVALID,
3078 },
3079 {
3080 .name = "iopsavgtime",
3081 .lname = "IOPS average time",
3082 .type = FIO_OPT_INT,
3083 .off1 = td_var_offset(iops_avg_time),
3084 .help = "Time window over which to calculate IOPS (msec)",
3085 .def = "500",
3086 .parent = "write_iops_log",
3087 .hide = 1,
3088 .interval = 100,
3089 .category = FIO_OPT_C_LOG,
3090 .group = FIO_OPT_G_INVALID,
3091 },
3092 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003093 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003094 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003095 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003096 .off1 = td_var_offset(group_reporting),
3097 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003098 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003099 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003100 },
3101 {
Jens Axboee9459e52007-04-17 15:46:32 +02003102 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003103 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003104 .type = FIO_OPT_STR_SET,
3105 .off1 = td_var_offset(zero_buffers),
3106 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003107 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003108 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003109 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003110 {
3111 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003112 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003113 .type = FIO_OPT_STR_SET,
3114 .off1 = td_var_offset(refill_buffers),
3115 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003116 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003117 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003118 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003119 {
Jens Axboefd684182011-09-19 09:24:44 +02003120 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003121 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003122 .type = FIO_OPT_BOOL,
3123 .off1 = td_var_offset(scramble_buffers),
3124 .help = "Slightly scramble buffers on every IO submit",
3125 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003126 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003127 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003128 },
3129 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003130 .name = "buffer_pattern",
3131 .lname = "Buffer pattern",
3132 .type = FIO_OPT_STR,
3133 .cb = str_buffer_pattern_cb,
3134 .help = "Fill pattern for IO buffers",
3135 .category = FIO_OPT_C_IO,
3136 .group = FIO_OPT_G_IO_BUF,
3137 },
3138 {
Jens Axboe9c426842012-03-02 21:02:12 +01003139 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003140 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003141 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003142 .cb = str_buffer_compress_cb,
Jens Axboe9c426842012-03-02 21:02:12 +01003143 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003144 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003145 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003146 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003147 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003148 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003149 },
3150 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003151 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003152 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003153 .type = FIO_OPT_INT,
3154 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003155 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003156 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003157 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003158 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003159 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003160 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003161 },
3162 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003163 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003164 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(clat_percentiles),
3167 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003168 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003169 .category = FIO_OPT_C_STAT,
3170 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003171 },
3172 {
3173 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003174 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003175 .type = FIO_OPT_FLOAT_LIST,
3176 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003177 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003178 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003179 .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 +02003180 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3181 .minfp = 0.0,
3182 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003183 .category = FIO_OPT_C_STAT,
3184 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003185 },
3186
Jens Axboe0a839f32007-04-26 09:02:34 +02003187#ifdef FIO_HAVE_DISK_UTIL
3188 {
3189 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003190 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003191 .type = FIO_OPT_BOOL,
3192 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003193 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003194 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003195 .category = FIO_OPT_C_STAT,
3196 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003197 },
3198#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003199 {
Jens Axboe993bf482008-11-14 13:04:53 +01003200 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003201 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003202 .type = FIO_OPT_BOOL,
3203 .help = "Greatly reduce number of gettimeofday() calls",
3204 .cb = str_gtod_reduce_cb,
3205 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003206 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003207 .category = FIO_OPT_C_STAT,
3208 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003209 },
3210 {
Jens Axboe02af0982010-06-24 09:59:34 +02003211 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003212 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003213 .type = FIO_OPT_BOOL,
3214 .off1 = td_var_offset(disable_lat),
3215 .help = "Disable latency numbers",
3216 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003217 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003218 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003219 .category = FIO_OPT_C_STAT,
3220 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003221 },
3222 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003223 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003224 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003225 .type = FIO_OPT_BOOL,
3226 .off1 = td_var_offset(disable_clat),
3227 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003228 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003229 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003230 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003231 .category = FIO_OPT_C_STAT,
3232 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003233 },
3234 {
3235 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003236 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003237 .type = FIO_OPT_BOOL,
3238 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003239 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003240 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003241 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003242 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003243 .category = FIO_OPT_C_STAT,
3244 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003245 },
3246 {
3247 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003248 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003249 .type = FIO_OPT_BOOL,
3250 .off1 = td_var_offset(disable_bw),
3251 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003252 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003253 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003254 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003255 .category = FIO_OPT_C_STAT,
3256 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003257 },
3258 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003259 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003260 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003261 .type = FIO_OPT_INT,
3262 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003263 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003264 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003265 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003266 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003267 },
3268 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003269 .name = "unified_rw_reporting",
3270 .type = FIO_OPT_BOOL,
3271 .off1 = td_var_offset(unified_rw_rep),
3272 .help = "Unify reporting across data direction",
3273 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003274 .category = FIO_OPT_C_GENERAL,
3275 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003276 },
3277 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003278 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003279 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003280 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003281 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003282 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003283 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003284 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003285 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003286 .posval = {
3287 { .ival = "none",
3288 .oval = ERROR_TYPE_NONE,
3289 .help = "Exit when an error is encountered",
3290 },
3291 { .ival = "read",
3292 .oval = ERROR_TYPE_READ,
3293 .help = "Continue on read errors only",
3294 },
3295 { .ival = "write",
3296 .oval = ERROR_TYPE_WRITE,
3297 .help = "Continue on write errors only",
3298 },
3299 { .ival = "io",
3300 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3301 .help = "Continue on any IO errors",
3302 },
3303 { .ival = "verify",
3304 .oval = ERROR_TYPE_VERIFY,
3305 .help = "Continue on verify errors only",
3306 },
3307 { .ival = "all",
3308 .oval = ERROR_TYPE_ANY,
3309 .help = "Continue on all io and verify errors",
3310 },
3311 { .ival = "0",
3312 .oval = ERROR_TYPE_NONE,
3313 .help = "Alias for 'none'",
3314 },
3315 { .ival = "1",
3316 .oval = ERROR_TYPE_ANY,
3317 .help = "Alias for 'all'",
3318 },
3319 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003320 },
3321 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003322 .name = "ignore_error",
3323 .type = FIO_OPT_STR,
3324 .cb = str_ignore_error_cb,
3325 .help = "Set a specific list of errors to ignore",
3326 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003327 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003328 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003329 },
3330 {
3331 .name = "error_dump",
3332 .type = FIO_OPT_BOOL,
3333 .off1 = td_var_offset(error_dump),
3334 .def = "0",
3335 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003336 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003337 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003338 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003339 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003340 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003341 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003342 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003343 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003344 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003345 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003346 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003347 },
3348 {
Jens Axboea696fa22009-12-04 10:05:02 +01003349 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003350 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003351 .type = FIO_OPT_STR_STORE,
3352 .off1 = td_var_offset(cgroup),
3353 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003354 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003355 .group = FIO_OPT_G_CGROUP,
3356 },
3357 {
3358 .name = "cgroup_nodelete",
3359 .lname = "Cgroup no-delete",
3360 .type = FIO_OPT_BOOL,
3361 .off1 = td_var_offset(cgroup_nodelete),
3362 .help = "Do not delete cgroups after job completion",
3363 .def = "0",
3364 .parent = "cgroup",
3365 .category = FIO_OPT_C_GENERAL,
3366 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003367 },
3368 {
3369 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003370 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003371 .type = FIO_OPT_INT,
3372 .off1 = td_var_offset(cgroup_weight),
3373 .help = "Use given weight for cgroup",
3374 .minval = 100,
3375 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003376 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003377 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003378 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003379 },
3380 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003381 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003382 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003383 .type = FIO_OPT_INT,
3384 .off1 = td_var_offset(uid),
3385 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003386 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003387 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003388 },
3389 {
3390 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003391 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003392 .type = FIO_OPT_INT,
3393 .off1 = td_var_offset(gid),
3394 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003395 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003396 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003397 },
3398 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003399 .name = "kb_base",
3400 .lname = "KB Base",
3401 .type = FIO_OPT_INT,
3402 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003403 .prio = 1,
3404 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003405 .posval = {
3406 { .ival = "1024",
3407 .oval = 1024,
3408 .help = "Use 1024 as the K base",
3409 },
3410 { .ival = "1000",
3411 .oval = 1000,
3412 .help = "Use 1000 as the K base",
3413 },
3414 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003415 .help = "How many bytes per KB for reporting (1000 or 1024)",
3416 .category = FIO_OPT_C_GENERAL,
3417 .group = FIO_OPT_G_INVALID,
3418 },
3419 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003420 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003421 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003422 .type = FIO_OPT_INT,
3423 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003424 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003425 .posval = {
3426 { .ival = "0",
3427 .oval = 0,
3428 .help = "Auto-detect",
3429 },
3430 { .ival = "8",
3431 .oval = 8,
3432 .help = "Normal (byte based)",
3433 },
3434 { .ival = "1",
3435 .oval = 1,
3436 .help = "Bit based",
3437 },
3438 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003439 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3440 .category = FIO_OPT_C_GENERAL,
3441 .group = FIO_OPT_G_INVALID,
3442 },
3443 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003444 .name = "hugepage-size",
3445 .lname = "Hugepage size",
3446 .type = FIO_OPT_INT,
3447 .off1 = td_var_offset(hugepage_size),
3448 .help = "When using hugepages, specify size of each page",
3449 .def = __fio_stringify(FIO_HUGE_PAGE),
3450 .interval = 1024 * 1024,
3451 .category = FIO_OPT_C_GENERAL,
3452 .group = FIO_OPT_G_INVALID,
3453 },
3454 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003455 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003456 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003457 .type = FIO_OPT_INT,
3458 .off1 = td_var_offset(flow_id),
3459 .help = "The flow index ID to use",
3460 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003461 .category = FIO_OPT_C_IO,
3462 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003463 },
3464 {
3465 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003466 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003467 .type = FIO_OPT_INT,
3468 .off1 = td_var_offset(flow),
3469 .help = "Weight for flow control of this job",
3470 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003471 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003472 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003473 .category = FIO_OPT_C_IO,
3474 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003475 },
3476 {
3477 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003478 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003479 .type = FIO_OPT_INT,
3480 .off1 = td_var_offset(flow_watermark),
3481 .help = "High watermark for flow control. This option"
3482 " should be set to the same value for all threads"
3483 " with non-zero flow.",
3484 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003485 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003486 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003487 .category = FIO_OPT_C_IO,
3488 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003489 },
3490 {
3491 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003492 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003493 .type = FIO_OPT_INT,
3494 .off1 = td_var_offset(flow_sleep),
3495 .help = "How many microseconds to sleep after being held"
3496 " back by the flow control mechanism",
3497 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003498 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003499 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003500 .category = FIO_OPT_C_IO,
3501 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003502 },
3503 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003504 .name = NULL,
3505 },
3506};
3507
Jens Axboe17af15d2010-04-13 10:38:16 +02003508static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003509 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003510{
Jens Axboe17af15d2010-04-13 10:38:16 +02003511 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003512 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003513 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003514 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003515 else
3516 lopt->has_arg = required_argument;
3517}
3518
Steven Langde890a12011-11-09 14:03:34 +01003519static void options_to_lopts(struct fio_option *opts,
3520 struct option *long_options,
3521 int i, int option_type)
3522{
3523 struct fio_option *o = &opts[0];
3524 while (o->name) {
3525 add_to_lopt(&long_options[i], o, o->name, option_type);
3526 if (o->alias) {
3527 i++;
3528 add_to_lopt(&long_options[i], o, o->alias, option_type);
3529 }
3530
3531 i++;
3532 o++;
3533 assert(i < FIO_NR_OPTIONS);
3534 }
3535}
3536
3537void fio_options_set_ioengine_opts(struct option *long_options,
3538 struct thread_data *td)
3539{
3540 unsigned int i;
3541
3542 i = 0;
3543 while (long_options[i].name) {
3544 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3545 memset(&long_options[i], 0, sizeof(*long_options));
3546 break;
3547 }
3548 i++;
3549 }
3550
3551 /*
3552 * Just clear out the prior ioengine options.
3553 */
3554 if (!td || !td->eo)
3555 return;
3556
3557 options_to_lopts(td->io_ops->options, long_options, i,
3558 FIO_GETOPT_IOENGINE);
3559}
3560
Jens Axboe214e1ec2007-03-15 10:48:13 +01003561void fio_options_dup_and_init(struct option *long_options)
3562{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003563 unsigned int i;
3564
Jens Axboe9af4a242012-03-16 10:13:49 +01003565 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003566
3567 i = 0;
3568 while (long_options[i].name)
3569 i++;
3570
Jens Axboe9af4a242012-03-16 10:13:49 +01003571 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003572}
3573
Jens Axboe74929ac2009-08-05 11:42:37 +02003574struct fio_keyword {
3575 const char *word;
3576 const char *desc;
3577 char *replace;
3578};
3579
3580static struct fio_keyword fio_keywords[] = {
3581 {
3582 .word = "$pagesize",
3583 .desc = "Page size in the system",
3584 },
3585 {
3586 .word = "$mb_memory",
3587 .desc = "Megabytes of memory online",
3588 },
3589 {
3590 .word = "$ncpus",
3591 .desc = "Number of CPUs online in the system",
3592 },
3593 {
3594 .word = NULL,
3595 },
3596};
3597
3598void fio_keywords_init(void)
3599{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003600 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003601 char buf[128];
3602 long l;
3603
Jens Axboea4cfc472012-10-09 10:30:48 -06003604 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003605 fio_keywords[0].replace = strdup(buf);
3606
Jens Axboe8eb016d2011-07-11 10:24:20 +02003607 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003608 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003609 fio_keywords[1].replace = strdup(buf);
3610
Jens Axboec00a2282011-07-08 20:56:06 +02003611 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003612 sprintf(buf, "%lu", l);
3613 fio_keywords[2].replace = strdup(buf);
3614}
3615
Jens Axboe892a6ff2009-11-13 12:19:49 +01003616#define BC_APP "bc"
3617
3618static char *bc_calc(char *str)
3619{
Steven Langd0c814e2011-10-28 08:37:13 +02003620 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003621 FILE *f;
3622 int ret;
3623
3624 /*
3625 * No math, just return string
3626 */
Steven Langd0c814e2011-10-28 08:37:13 +02003627 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3628 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003629 return str;
3630
3631 /*
3632 * Split option from value, we only need to calculate the value
3633 */
3634 tmp = strchr(str, '=');
3635 if (!tmp)
3636 return str;
3637
3638 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003639
Steven Langd0c814e2011-10-28 08:37:13 +02003640 /*
3641 * Prevent buffer overflows; such a case isn't reasonable anyway
3642 */
3643 if (strlen(str) >= 128 || strlen(tmp) > 100)
3644 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003645
3646 sprintf(buf, "which %s > /dev/null", BC_APP);
3647 if (system(buf)) {
3648 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003649 return NULL;
3650 }
3651
Steven Langd0c814e2011-10-28 08:37:13 +02003652 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003653 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003654 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003655 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003656
Steven Langd0c814e2011-10-28 08:37:13 +02003657 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe3c3ed072012-03-27 09:12:39 +02003658 if (ret <= 0)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003659 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003660
Jens Axboe892a6ff2009-11-13 12:19:49 +01003661 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003662 buf[(tmp - str) + ret - 1] = '\0';
3663 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003664 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003665 return strdup(buf);
3666}
3667
3668/*
3669 * Return a copy of the input string with substrings of the form ${VARNAME}
3670 * substituted with the value of the environment variable VARNAME. The
3671 * substitution always occurs, even if VARNAME is empty or the corresponding
3672 * environment variable undefined.
3673 */
3674static char *option_dup_subs(const char *opt)
3675{
3676 char out[OPT_LEN_MAX+1];
3677 char in[OPT_LEN_MAX+1];
3678 char *outptr = out;
3679 char *inptr = in;
3680 char *ch1, *ch2, *env;
3681 ssize_t nchr = OPT_LEN_MAX;
3682 size_t envlen;
3683
3684 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3685 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3686 return NULL;
3687 }
3688
3689 in[OPT_LEN_MAX] = '\0';
3690 strncpy(in, opt, OPT_LEN_MAX);
3691
3692 while (*inptr && nchr > 0) {
3693 if (inptr[0] == '$' && inptr[1] == '{') {
3694 ch2 = strchr(inptr, '}');
3695 if (ch2 && inptr+1 < ch2) {
3696 ch1 = inptr+2;
3697 inptr = ch2+1;
3698 *ch2 = '\0';
3699
3700 env = getenv(ch1);
3701 if (env) {
3702 envlen = strlen(env);
3703 if (envlen <= nchr) {
3704 memcpy(outptr, env, envlen);
3705 outptr += envlen;
3706 nchr -= envlen;
3707 }
3708 }
3709
3710 continue;
3711 }
3712 }
3713
3714 *outptr++ = *inptr++;
3715 --nchr;
3716 }
3717
3718 *outptr = '\0';
3719 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003720}
3721
Jens Axboe74929ac2009-08-05 11:42:37 +02003722/*
3723 * Look for reserved variable names and replace them with real values
3724 */
3725static char *fio_keyword_replace(char *opt)
3726{
3727 char *s;
3728 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003729 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003730
3731 for (i = 0; fio_keywords[i].word != NULL; i++) {
3732 struct fio_keyword *kw = &fio_keywords[i];
3733
3734 while ((s = strstr(opt, kw->word)) != NULL) {
3735 char *new = malloc(strlen(opt) + 1);
3736 char *o_org = opt;
3737 int olen = s - opt;
3738 int len;
3739
3740 /*
3741 * Copy part of the string before the keyword and
3742 * sprintf() the replacement after it.
3743 */
3744 memcpy(new, opt, olen);
3745 len = sprintf(new + olen, "%s", kw->replace);
3746
3747 /*
3748 * If there's more in the original string, copy that
3749 * in too
3750 */
3751 opt += strlen(kw->word) + olen;
3752 if (strlen(opt))
3753 memcpy(new + olen + len, opt, opt - o_org - 1);
3754
3755 /*
3756 * replace opt and free the old opt
3757 */
3758 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003759 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003760
Steven Langd0c814e2011-10-28 08:37:13 +02003761 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003762 }
3763 }
3764
Steven Langd0c814e2011-10-28 08:37:13 +02003765 /*
3766 * Check for potential math and invoke bc, if possible
3767 */
3768 if (docalc)
3769 opt = bc_calc(opt);
3770
Jens Axboe7a958bd2009-11-13 12:33:54 +01003771 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003772}
3773
Steven Langd0c814e2011-10-28 08:37:13 +02003774static char **dup_and_sub_options(char **opts, int num_opts)
3775{
3776 int i;
3777 char **opts_copy = malloc(num_opts * sizeof(*opts));
3778 for (i = 0; i < num_opts; i++) {
3779 opts_copy[i] = option_dup_subs(opts[i]);
3780 if (!opts_copy[i])
3781 continue;
3782 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3783 }
3784 return opts_copy;
3785}
3786
Jens Axboe292cc472013-11-26 20:39:35 -07003787int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3788 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003789{
Steven Langde890a12011-11-09 14:03:34 +01003790 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003791 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003792
Jens Axboe9af4a242012-03-16 10:13:49 +01003793 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003794 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003795
Steven Langde890a12011-11-09 14:03:34 +01003796 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3797 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003798 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003799 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003800
Steven Langde890a12011-11-09 14:03:34 +01003801 if (opts_copy[i]) {
3802 if (newret && !o) {
3803 unknown++;
3804 continue;
3805 }
Steven Langd0c814e2011-10-28 08:37:13 +02003806 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003807 opts_copy[i] = NULL;
3808 }
3809
3810 ret |= newret;
3811 }
3812
3813 if (unknown) {
3814 ret |= ioengine_load(td);
3815 if (td->eo) {
3816 sort_options(opts_copy, td->io_ops->options, num_opts);
3817 opts = opts_copy;
3818 }
3819 for (i = 0; i < num_opts; i++) {
3820 struct fio_option *o = NULL;
3821 int newret = 1;
3822 if (!opts_copy[i])
3823 continue;
3824
3825 if (td->eo)
3826 newret = parse_option(opts_copy[i], opts[i],
3827 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003828 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003829
3830 ret |= newret;
3831 if (!o)
3832 log_err("Bad option <%s>\n", opts[i]);
3833
3834 free(opts_copy[i]);
3835 opts_copy[i] = NULL;
3836 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003837 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003838
Steven Langd0c814e2011-10-28 08:37:13 +02003839 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003840 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003841}
3842
3843int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3844{
Jens Axboe9af4a242012-03-16 10:13:49 +01003845 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003846}
3847
Steven Langde890a12011-11-09 14:03:34 +01003848int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3849 char *val)
3850{
Akinobu Mita8a96c802013-10-09 09:32:34 -06003851 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01003852}
3853
Jens Axboe214e1ec2007-03-15 10:48:13 +01003854void fio_fill_default_options(struct thread_data *td)
3855{
Jens Axboecb1402d2014-02-25 11:35:27 -08003856 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01003857 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003858}
3859
3860int fio_show_option_help(const char *opt)
3861{
Jens Axboe9af4a242012-03-16 10:13:49 +01003862 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003863}
Jens Axboed23bb322007-03-23 15:57:56 +01003864
Steven Langde890a12011-11-09 14:03:34 +01003865void options_mem_dupe(void *data, struct fio_option *options)
3866{
3867 struct fio_option *o;
3868 char **ptr;
3869
3870 for (o = &options[0]; o->name; o++) {
3871 if (o->type != FIO_OPT_STR_STORE)
3872 continue;
3873
Jens Axboef0fdbca2014-02-11 15:44:50 -07003874 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01003875 if (*ptr)
3876 *ptr = strdup(*ptr);
3877 }
3878}
3879
Jens Axboe7e356b22011-10-14 10:55:16 +02003880/*
3881 * dupe FIO_OPT_STR_STORE options
3882 */
Steven Langde890a12011-11-09 14:03:34 +01003883void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003884{
Jens Axboe9af4a242012-03-16 10:13:49 +01003885 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003886
3887 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003888 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003889
Steven Langde890a12011-11-09 14:03:34 +01003890 td->eo = malloc(td->io_ops->option_struct_size);
3891 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3892 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003893 }
3894}
3895
Jens Axboed6978a32009-07-18 21:04:09 +02003896unsigned int fio_get_kb_base(void *data)
3897{
Jens Axboe83ea4222012-03-28 14:01:46 +02003898 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02003899 unsigned int kb_base = 0;
3900
Jens Axboecb1402d2014-02-25 11:35:27 -08003901 /*
3902 * This is a hack... For private options, *data is not holding
3903 * a pointer to the thread_options, but to private data. This means
3904 * we can't safely dereference it, but magic is first so mem wise
3905 * it is valid. But this also means that if the job first sets
3906 * kb_base and expects that to be honored by private options,
3907 * it will be disappointed. We will return the global default
3908 * for this.
3909 */
3910 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02003911 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02003912 if (!kb_base)
3913 kb_base = 1024;
3914
3915 return kb_base;
3916}
Jens Axboe9f988e22010-03-04 10:42:38 +01003917
Jens Axboe07b32322010-03-05 09:48:44 +01003918int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003919{
Jens Axboe07b32322010-03-05 09:48:44 +01003920 struct fio_option *__o;
3921 int opt_index = 0;
3922
Jens Axboe9af4a242012-03-16 10:13:49 +01003923 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003924 while (__o->name) {
3925 opt_index++;
3926 __o++;
3927 }
3928
Jens Axboe7b504ed2014-02-11 14:19:38 -07003929 if (opt_index + 1 == FIO_MAX_OPTS) {
3930 log_err("fio: FIO_MAX_OPTS is too small\n");
3931 return 1;
3932 }
3933
Jens Axboe9af4a242012-03-16 10:13:49 +01003934 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07003935 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01003936 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003937}
Jens Axboee2de69d2010-03-04 14:05:48 +01003938
Jens Axboe07b32322010-03-05 09:48:44 +01003939void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003940{
Jens Axboe07b32322010-03-05 09:48:44 +01003941 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003942
Jens Axboe9af4a242012-03-16 10:13:49 +01003943 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003944 while (o->name) {
3945 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3946 o->type = FIO_OPT_INVALID;
3947 o->prof_name = NULL;
3948 }
3949 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003950 }
3951}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003952
3953void add_opt_posval(const char *optname, const char *ival, const char *help)
3954{
3955 struct fio_option *o;
3956 unsigned int i;
3957
Jens Axboe9af4a242012-03-16 10:13:49 +01003958 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003959 if (!o)
3960 return;
3961
3962 for (i = 0; i < PARSE_MAX_VP; i++) {
3963 if (o->posval[i].ival)
3964 continue;
3965
3966 o->posval[i].ival = ival;
3967 o->posval[i].help = help;
3968 break;
3969 }
3970}
3971
3972void del_opt_posval(const char *optname, const char *ival)
3973{
3974 struct fio_option *o;
3975 unsigned int i;
3976
Jens Axboe9af4a242012-03-16 10:13:49 +01003977 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003978 if (!o)
3979 return;
3980
3981 for (i = 0; i < PARSE_MAX_VP; i++) {
3982 if (!o->posval[i].ival)
3983 continue;
3984 if (strcmp(o->posval[i].ival, ival))
3985 continue;
3986
3987 o->posval[i].ival = NULL;
3988 o->posval[i].help = NULL;
3989 }
3990}
Jens Axboe7e356b22011-10-14 10:55:16 +02003991
3992void fio_options_free(struct thread_data *td)
3993{
Jens Axboe9af4a242012-03-16 10:13:49 +01003994 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003995 if (td->eo && td->io_ops && td->io_ops->options) {
3996 options_free(td->io_ops->options, td->eo);
3997 free(td->eo);
3998 td->eo = NULL;
3999 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004000}
Jens Axboec504ee52012-03-20 11:29:09 +01004001
4002struct fio_option *fio_option_find(const char *name)
4003{
4004 return find_option(fio_options, name);
4005}
4006