blob: 4a54c98c15045864931ea503d3f7920bab4ae431 [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;
286 }
287 return 0;
288
289}
290
291static int str_ignore_error_cb(void *data, const char *input)
292{
293 struct thread_data *td = data;
294 char *str, *p, *n;
295 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600296
297 if (parse_dryrun())
298 return 0;
299
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400300 p = str = strdup(input);
301
302 strip_blank_front(&str);
303 strip_blank_end(str);
304
305 while (p) {
306 n = strchr(p, ',');
307 if (n)
308 *n++ = '\0';
309 ret = ignore_error_type(td, type, p);
310 if (ret)
311 break;
312 p = n;
313 type++;
314 }
315 free(str);
316 return ret;
317}
318
Jens Axboe211097b2007-03-22 18:56:45 +0100319static int str_rw_cb(void *data, const char *str)
320{
321 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200322 struct thread_options *o = &td->o;
Jens Axboe211097b2007-03-22 18:56:45 +0100323 char *nr = get_opt_postfix(str);
324
Jens Axboe52c0cea2013-09-06 10:07:37 -0600325 if (parse_dryrun())
326 return 0;
327
Jens Axboe83ea4222012-03-28 14:01:46 +0200328 o->ddir_seq_nr = 1;
329 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200330
331 if (!nr)
332 return 0;
333
334 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200335 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200336 else {
337 long long val;
338
Jens Axboe0de5b262014-02-21 15:26:01 -0800339 if (str_to_decimal(nr, &val, 1, o, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200340 log_err("fio: rw postfix parsing failed\n");
341 free(nr);
342 return 1;
343 }
344
Jens Axboe83ea4222012-03-28 14:01:46 +0200345 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100346 }
Jens Axboe211097b2007-03-22 18:56:45 +0100347
Jens Axboe059b0802011-08-25 09:09:37 +0200348 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100349 return 0;
350}
351
Jens Axboe214e1ec2007-03-15 10:48:13 +0100352static int str_mem_cb(void *data, const char *mem)
353{
354 struct thread_data *td = data;
355
Shaohua Lid9759b12013-01-17 13:28:15 +0100356 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700357 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100358
359 return 0;
360}
361
Jens Axboec223da82010-03-24 13:23:53 +0100362static int fio_clock_source_cb(void *data, const char *str)
363{
364 struct thread_data *td = data;
365
366 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100367 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100368 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100369 return 0;
370}
371
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400372static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200373{
374 struct thread_data *td = data;
375
376 td->o.rwmix[DDIR_READ] = *val;
377 td->o.rwmix[DDIR_WRITE] = 100 - *val;
378 return 0;
379}
380
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400381static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200382{
383 struct thread_data *td = data;
384
385 td->o.rwmix[DDIR_WRITE] = *val;
386 td->o.rwmix[DDIR_READ] = 100 - *val;
387 return 0;
388}
389
Jens Axboe214e1ec2007-03-15 10:48:13 +0100390static int str_exitall_cb(void)
391{
392 exitall_on_terminate = 1;
393 return 0;
394}
395
Jens Axboe214e1ec2007-03-15 10:48:13 +0100396#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800397int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800398{
Jens Axboe50b58602014-02-28 15:08:25 -0800399 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800400 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800401
Jens Axboe50b58602014-02-28 15:08:25 -0800402 cpus_in_mask = fio_cpu_count(mask);
403 cpu_index = cpu_index % cpus_in_mask;
404
405 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800406 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800407 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800408 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800409
410 if (cpu_index != index)
411 fio_cpu_clear(mask, i);
412
413 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800414 }
415
416 return fio_cpu_count(mask);
417}
418
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400419static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100420{
421 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200422 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100423 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100424 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100425
Jens Axboe52c0cea2013-09-06 10:07:37 -0600426 if (parse_dryrun())
427 return 0;
428
Jens Axboed2ce18b2008-12-12 20:51:40 +0100429 ret = fio_cpuset_init(&td->o.cpumask);
430 if (ret < 0) {
431 log_err("fio: cpuset_init failed\n");
432 td_verror(td, ret, "fio_cpuset_init");
433 return 1;
434 }
435
Jens Axboec00a2282011-07-08 20:56:06 +0200436 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200437
Jens Axboe62a72732008-12-08 11:37:01 +0100438 for (i = 0; i < sizeof(int) * 8; i++) {
439 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100440 if (i > max_cpu) {
441 log_err("fio: CPU %d too large (max=%ld)\n", i,
442 max_cpu);
443 return 1;
444 }
Jens Axboe62a72732008-12-08 11:37:01 +0100445 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100446 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100447 }
448 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200449
Jens Axboe375b2692007-05-22 09:13:02 +0200450 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100451 return 0;
452}
453
Jens Axboee8462bd2009-07-06 12:59:04 +0200454static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
455 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200456{
Jens Axboed2e268b2007-06-15 10:33:49 +0200457 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100458 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100459 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200460
Jens Axboee8462bd2009-07-06 12:59:04 +0200461 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100462 if (ret < 0) {
463 log_err("fio: cpuset_init failed\n");
464 td_verror(td, ret, "fio_cpuset_init");
465 return 1;
466 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200467
468 p = str = strdup(input);
469
470 strip_blank_front(&str);
471 strip_blank_end(str);
472
Jens Axboec00a2282011-07-08 20:56:06 +0200473 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100474
Jens Axboed2e268b2007-06-15 10:33:49 +0200475 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100476 char *str2, *cpu2;
477 int icpu, icpu2;
478
Jens Axboed2e268b2007-06-15 10:33:49 +0200479 if (!strlen(cpu))
480 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100481
482 str2 = cpu;
483 icpu2 = -1;
484 while ((cpu2 = strsep(&str2, "-")) != NULL) {
485 if (!strlen(cpu2))
486 break;
487
488 icpu2 = atoi(cpu2);
489 }
490
491 icpu = atoi(cpu);
492 if (icpu2 == -1)
493 icpu2 = icpu;
494 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100495 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100496 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100497 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100498 ret = 1;
499 break;
500 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100501 if (icpu > max_cpu) {
502 log_err("fio: CPU %d too large (max=%ld)\n",
503 icpu, max_cpu);
504 ret = 1;
505 break;
506 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200507
Jens Axboe62a72732008-12-08 11:37:01 +0100508 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200509 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100510 icpu++;
511 }
Jens Axboe19608d62008-12-08 15:03:12 +0100512 if (ret)
513 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200514 }
515
516 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100517 if (!ret)
518 td->o.cpumask_set = 1;
519 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200520}
Jens Axboee8462bd2009-07-06 12:59:04 +0200521
522static int str_cpus_allowed_cb(void *data, const char *input)
523{
524 struct thread_data *td = data;
525 int ret;
526
Jens Axboe52c0cea2013-09-06 10:07:37 -0600527 if (parse_dryrun())
528 return 0;
529
Jens Axboee8462bd2009-07-06 12:59:04 +0200530 ret = set_cpus_allowed(td, &td->o.cpumask, input);
531 if (!ret)
532 td->o.cpumask_set = 1;
533
534 return ret;
535}
536
537static int str_verify_cpus_allowed_cb(void *data, const char *input)
538{
539 struct thread_data *td = data;
540 int ret;
541
542 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
543 if (!ret)
544 td->o.verify_cpumask_set = 1;
545
546 return ret;
547}
Jens Axboed2e268b2007-06-15 10:33:49 +0200548#endif
549
Jens Axboe67bf9822013-01-10 11:23:19 +0100550#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400551static int str_numa_cpunodes_cb(void *data, char *input)
552{
553 struct thread_data *td = data;
554
Jens Axboe52c0cea2013-09-06 10:07:37 -0600555 if (parse_dryrun())
556 return 0;
557
Yufei Rend0b937e2012-10-19 23:11:52 -0400558 /* numa_parse_nodestring() parses a character string list
559 * of nodes into a bit mask. The bit mask is allocated by
560 * numa_allocate_nodemask(), so it should be freed by
561 * numa_free_nodemask().
562 */
563 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
564 if (td->o.numa_cpunodesmask == NULL) {
565 log_err("fio: numa_parse_nodestring failed\n");
566 td_verror(td, 1, "str_numa_cpunodes_cb");
567 return 1;
568 }
569
570 td->o.numa_cpumask_set = 1;
571 return 0;
572}
573
574static int str_numa_mpol_cb(void *data, char *input)
575{
576 struct thread_data *td = data;
577 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600578 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400579 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600580 char *nodelist;
Yufei Rend0b937e2012-10-19 23:11:52 -0400581
Jens Axboe52c0cea2013-09-06 10:07:37 -0600582 if (parse_dryrun())
583 return 0;
584
585 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400586 if (nodelist) {
587 /* NUL-terminate mode */
588 *nodelist++ = '\0';
589 }
590
591 for (i = 0; i <= MPOL_LOCAL; i++) {
592 if (!strcmp(input, policy_types[i])) {
593 td->o.numa_mem_mode = i;
594 break;
595 }
596 }
597 if (i > MPOL_LOCAL) {
598 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
599 goto out;
600 }
601
602 switch (td->o.numa_mem_mode) {
603 case MPOL_PREFERRED:
604 /*
605 * Insist on a nodelist of one node only
606 */
607 if (nodelist) {
608 char *rest = nodelist;
609 while (isdigit(*rest))
610 rest++;
611 if (*rest) {
612 log_err("fio: one node only for \'prefer\'\n");
613 goto out;
614 }
615 } else {
616 log_err("fio: one node is needed for \'prefer\'\n");
617 goto out;
618 }
619 break;
620 case MPOL_INTERLEAVE:
621 /*
622 * Default to online nodes with memory if no nodelist
623 */
624 if (!nodelist)
625 nodelist = strdup("all");
626 break;
627 case MPOL_LOCAL:
628 case MPOL_DEFAULT:
629 /*
630 * Don't allow a nodelist
631 */
632 if (nodelist) {
633 log_err("fio: NO nodelist for \'local\'\n");
634 goto out;
635 }
636 break;
637 case MPOL_BIND:
638 /*
639 * Insist on a nodelist
640 */
641 if (!nodelist) {
642 log_err("fio: a nodelist is needed for \'bind\'\n");
643 goto out;
644 }
645 break;
646 }
647
648
649 /* numa_parse_nodestring() parses a character string list
650 * of nodes into a bit mask. The bit mask is allocated by
651 * numa_allocate_nodemask(), so it should be freed by
652 * numa_free_nodemask().
653 */
654 switch (td->o.numa_mem_mode) {
655 case MPOL_PREFERRED:
656 td->o.numa_mem_prefer_node = atoi(nodelist);
657 break;
658 case MPOL_INTERLEAVE:
659 case MPOL_BIND:
660 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
661 if (td->o.numa_memnodesmask == NULL) {
662 log_err("fio: numa_parse_nodestring failed\n");
663 td_verror(td, 1, "str_numa_memnodes_cb");
664 return 1;
665 }
666 break;
667 case MPOL_LOCAL:
668 case MPOL_DEFAULT:
669 default:
670 break;
671 }
672
673 td->o.numa_memmask_set = 1;
674 return 0;
675
676out:
677 return 1;
678}
679#endif
680
Jens Axboe214e1ec2007-03-15 10:48:13 +0100681static int str_fst_cb(void *data, const char *str)
682{
683 struct thread_data *td = data;
684 char *nr = get_opt_postfix(str);
685
686 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100687 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100688 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100689 free(nr);
690 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100691
692 return 0;
693}
694
Jens Axboe67bf9822013-01-10 11:23:19 +0100695#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100696static int str_sfr_cb(void *data, const char *str)
697{
698 struct thread_data *td = data;
699 char *nr = get_opt_postfix(str);
700
701 td->sync_file_range_nr = 1;
702 if (nr) {
703 td->sync_file_range_nr = atoi(nr);
704 free(nr);
705 }
706
707 return 0;
708}
Jens Axboe3ae06372010-03-19 19:17:15 +0100709#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100710
Jens Axboee25839d2012-11-06 10:49:42 +0100711static int str_random_distribution_cb(void *data, const char *str)
712{
713 struct thread_data *td = data;
714 double val;
715 char *nr;
716
Jens Axboe52c0cea2013-09-06 10:07:37 -0600717 if (parse_dryrun())
718 return 0;
719
Jens Axboe925fee32012-11-06 13:50:32 +0100720 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
721 val = 1.1;
722 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
723 val = 0.2;
724 else
Jens Axboee25839d2012-11-06 10:49:42 +0100725 return 0;
726
727 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100728 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100729 log_err("fio: random postfix parsing failed\n");
730 free(nr);
731 return 1;
732 }
733
Jens Axboe078189c2012-11-07 13:47:22 +0100734 free(nr);
735
Jens Axboe18ded912012-11-08 08:36:00 +0100736 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
737 if (val == 1.00) {
738 log_err("fio: zipf theta must different than 1.0\n");
739 return 1;
740 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700741 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100742 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100743 if (val <= 0.00 || val >= 1.00) {
744 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
745 return 1;
746 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700747 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100748 }
Jens Axboe925fee32012-11-06 13:50:32 +0100749
Jens Axboee25839d2012-11-06 10:49:42 +0100750 return 0;
751}
752
Jens Axboe8e827d32009-08-04 09:51:48 +0200753/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800754 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200755 * is escaped with a '\', then that ':' is part of the filename and does not
756 * indicate a new file.
757 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800758static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200759{
760 char *str = *ptr;
761 char *p, *start;
762
763 if (!str || !strlen(str))
764 return NULL;
765
766 start = str;
767 do {
768 /*
769 * No colon, we are done
770 */
771 p = strchr(str, ':');
772 if (!p) {
773 *ptr = NULL;
774 break;
775 }
776
777 /*
778 * We got a colon, but it's the first character. Skip and
779 * continue
780 */
781 if (p == start) {
782 str = ++start;
783 continue;
784 }
785
786 if (*(p - 1) != '\\') {
787 *p = '\0';
788 *ptr = p + 1;
789 break;
790 }
791
792 memmove(p - 1, p, strlen(p) + 1);
793 str = p;
794 } while (1);
795
796 return start;
797}
798
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800799
800static int get_max_name_idx(char *input)
801{
802 unsigned int cur_idx;
803 char *str, *p;
804
805 p = str = strdup(input);
806 for (cur_idx = 0; ; cur_idx++)
807 if (get_next_name(&str) == NULL)
808 break;
809
810 free(p);
811 return cur_idx;
812}
813
814/*
815 * Returns the directory at the index, indexes > entires will be
816 * assigned via modulo division of the index
817 */
818int set_name_idx(char *target, char *input, int index)
819{
820 unsigned int cur_idx;
821 int len;
822 char *fname, *str, *p;
823
824 p = str = strdup(input);
825
826 index %= get_max_name_idx(input);
827 for (cur_idx = 0; cur_idx <= index; cur_idx++)
828 fname = get_next_name(&str);
829
830 len = sprintf(target, "%s/", fname);
831 free(p);
832
833 return len;
834}
835
Jens Axboe214e1ec2007-03-15 10:48:13 +0100836static int str_filename_cb(void *data, const char *input)
837{
838 struct thread_data *td = data;
839 char *fname, *str, *p;
840
841 p = str = strdup(input);
842
843 strip_blank_front(&str);
844 strip_blank_end(str);
845
846 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100847 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100848
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800849 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100850 if (!strlen(fname))
851 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800852 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100853 }
854
855 free(p);
856 return 0;
857}
858
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800859static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100860{
861 struct thread_data *td = data;
862 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800863 char *dirname, *str, *p;
864 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100865
Jens Axboef9633d72013-09-06 09:59:56 -0600866 if (parse_dryrun())
867 return 0;
868
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800869 p = str = strdup(td->o.directory);
870 while ((dirname = get_next_name(&str)) != NULL) {
871 if (lstat(dirname, &sb) < 0) {
872 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100873
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800874 log_err("fio: %s is not a directory\n", dirname);
875 td_verror(td, ret, "lstat");
876 goto out;
877 }
878 if (!S_ISDIR(sb.st_mode)) {
879 log_err("fio: %s is not a directory\n", dirname);
880 ret = 1;
881 goto out;
882 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100883 }
884
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800885out:
886 free(p);
887 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100888}
889
Jens Axboef2a28032014-02-11 09:12:06 -0700890static int str_lockfile_cb(void *data, const char fio_unused *str)
891{
892 struct thread_data *td = data;
893
894 if (td->files_index) {
895 log_err("fio: lockfile= option must precede filename=\n");
896 return 1;
897 }
898
899 return 0;
900}
901
Jens Axboe214e1ec2007-03-15 10:48:13 +0100902static int str_opendir_cb(void *data, const char fio_unused *str)
903{
904 struct thread_data *td = data;
905
Jens Axboe52c0cea2013-09-06 10:07:37 -0600906 if (parse_dryrun())
907 return 0;
908
Jens Axboe214e1ec2007-03-15 10:48:13 +0100909 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100910 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100911
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100912 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100913}
914
Jens Axboece35b1e2014-01-14 15:35:58 -0700915static int pattern_cb(char *pattern, unsigned int max_size,
916 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200917{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100918 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700919 int i = 0, j = 0, len, k, base = 10;
920 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200921 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200922
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100923 loc1 = strstr(input, "0x");
924 loc2 = strstr(input, "0X");
925 if (loc1 || loc2)
926 base = 16;
927 off = strtol(input, NULL, base);
928 if (off != LONG_MAX || errno != ERANGE) {
929 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700930 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100931 off >>= 8;
932 i++;
933 }
934 } else {
935 len = strlen(input);
936 k = len - 1;
937 if (base == 16) {
938 if (loc1)
939 j = loc1 - input + 2;
940 else
941 j = loc2 - input + 2;
942 } else
943 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700944 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100945 while (k >= j) {
946 off = converthexchartoint(input[k--]);
947 if (k >= j)
948 off += (converthexchartoint(input[k--])
949 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700950 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100951 }
952 }
953 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100954
955 /*
956 * Fill the pattern all the way to the end. This greatly reduces
957 * the number of memcpy's we have to do when verifying the IO.
958 */
Jens Axboee078de42013-04-24 23:07:17 -0600959 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700960 while (i > 1 && i * 2 <= max_size) {
961 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100962 i *= 2;
963 }
Jens Axboee078de42013-04-24 23:07:17 -0600964
965 /*
966 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700967 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600968 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700969 while (i > 1 && i < max_size) {
970 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600971
Jens Axboece35b1e2014-01-14 15:35:58 -0700972 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600973 i += b;
974 }
975
Steven Lang9a2a86d2012-02-07 09:42:59 +0100976 if (i == 1) {
977 /*
978 * The code in verify_io_u_pattern assumes a single byte pattern
979 * fills the whole verify pattern buffer.
980 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700981 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +0100982 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100983
Jens Axboece35b1e2014-01-14 15:35:58 -0700984 *pattern_bytes = i;
985 return 0;
986}
987
988static int str_buffer_pattern_cb(void *data, const char *input)
989{
990 struct thread_data *td = data;
991 int ret;
992
993 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
994 &td->o.buffer_pattern_bytes);
995
996 if (!ret) {
997 td->o.refill_buffers = 0;
998 td->o.scramble_buffers = 0;
999 td->o.zero_buffers = 0;
1000 }
1001
1002 return ret;
1003}
1004
Jens Axboebedc9dc2014-03-17 12:51:09 -06001005static int str_buffer_compress_cb(void *data, unsigned long long *il)
1006{
1007 struct thread_data *td = data;
1008
1009 td->flags |= TD_F_COMPRESS;
1010 td->o.compress_percentage = *il;
1011 return 0;
1012}
1013
Jens Axboece35b1e2014-01-14 15:35:58 -07001014static int str_verify_pattern_cb(void *data, const char *input)
1015{
1016 struct thread_data *td = data;
1017 int ret;
1018
1019 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1020 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001021
Jens Axboe92bf48d2011-01-14 21:20:42 +01001022 /*
1023 * VERIFY_META could already be set
1024 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001025 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001026 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001027
Jens Axboece35b1e2014-01-14 15:35:58 -07001028 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001029}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001030
Jens Axboe993bf482008-11-14 13:04:53 +01001031static int str_gtod_reduce_cb(void *data, int *il)
1032{
1033 struct thread_data *td = data;
1034 int val = *il;
1035
Jens Axboe02af0982010-06-24 09:59:34 +02001036 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001037 td->o.disable_clat = !!val;
1038 td->o.disable_slat = !!val;
1039 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001040 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001041 if (val)
1042 td->tv_cache_mask = 63;
1043
1044 return 0;
1045}
1046
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001047static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001048{
1049 struct thread_data *td = data;
1050 int val = *il;
1051
1052 td->o.gtod_cpu = val;
1053 td->o.gtod_offload = 1;
1054 return 0;
1055}
1056
Jens Axboe7bb59102011-07-12 19:47:03 +02001057static int str_size_cb(void *data, unsigned long long *__val)
1058{
1059 struct thread_data *td = data;
1060 unsigned long long v = *__val;
1061
1062 if (parse_is_percent(v)) {
1063 td->o.size = 0;
1064 td->o.size_percent = -1ULL - v;
1065 } else
1066 td->o.size = v;
1067
1068 return 0;
1069}
1070
Jens Axboe896cac22009-07-01 10:38:35 +02001071static int rw_verify(struct fio_option *o, void *data)
1072{
1073 struct thread_data *td = data;
1074
1075 if (read_only && td_write(td)) {
1076 log_err("fio: job <%s> has write bit set, but fio is in"
1077 " read-only mode\n", td->o.name);
1078 return 1;
1079 }
1080
1081 return 0;
1082}
1083
Jens Axboe276ca4f2009-07-01 10:43:05 +02001084static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001085{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001086#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001087 struct thread_data *td = data;
1088
Jens Axboe29d43ff2009-07-01 10:42:18 +02001089 if (td->o.gtod_cpu) {
1090 log_err("fio: platform must support CPU affinity for"
1091 "gettimeofday() offloading\n");
1092 return 1;
1093 }
1094#endif
1095
1096 return 0;
1097}
1098
Jens Axboe214e1ec2007-03-15 10:48:13 +01001099/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001100 * Option grouping
1101 */
1102static struct opt_group fio_opt_groups[] = {
1103 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001104 .name = "General",
1105 .mask = FIO_OPT_C_GENERAL,
1106 },
1107 {
1108 .name = "I/O",
1109 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001110 },
1111 {
1112 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001113 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001114 },
1115 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001116 .name = "Statistics",
1117 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001118 },
1119 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001120 .name = "Logging",
1121 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001122 },
1123 {
Jens Axboe13fca822012-03-31 13:55:54 +02001124 .name = "Profiles",
1125 .mask = FIO_OPT_C_PROFILE,
1126 },
1127 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001128 .name = NULL,
1129 },
1130};
1131
Jens Axboee8b0e952012-03-19 14:37:08 +01001132static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1133 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001134{
1135 struct opt_group *og;
1136 int i;
1137
Jens Axboee8b0e952012-03-19 14:37:08 +01001138 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001139 return NULL;
1140
Jens Axboee8b0e952012-03-19 14:37:08 +01001141 for (i = 0; ogs[i].name; i++) {
1142 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001143
1144 if (*mask & og->mask) {
1145 *mask &= ~(og->mask);
1146 return og;
1147 }
1148 }
1149
1150 return NULL;
1151}
1152
Jens Axboee8b0e952012-03-19 14:37:08 +01001153struct opt_group *opt_group_from_mask(unsigned int *mask)
1154{
1155 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1156}
1157
1158static struct opt_group fio_opt_cat_groups[] = {
1159 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001160 .name = "Latency profiling",
1161 .mask = FIO_OPT_G_LATPROF,
1162 },
1163 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001164 .name = "Rate",
1165 .mask = FIO_OPT_G_RATE,
1166 },
1167 {
1168 .name = "Zone",
1169 .mask = FIO_OPT_G_ZONE,
1170 },
1171 {
1172 .name = "Read/write mix",
1173 .mask = FIO_OPT_G_RWMIX,
1174 },
1175 {
1176 .name = "Verify",
1177 .mask = FIO_OPT_G_VERIFY,
1178 },
1179 {
1180 .name = "Trim",
1181 .mask = FIO_OPT_G_TRIM,
1182 },
1183 {
1184 .name = "I/O Logging",
1185 .mask = FIO_OPT_G_IOLOG,
1186 },
1187 {
1188 .name = "I/O Depth",
1189 .mask = FIO_OPT_G_IO_DEPTH,
1190 },
1191 {
1192 .name = "I/O Flow",
1193 .mask = FIO_OPT_G_IO_FLOW,
1194 },
1195 {
Jens Axboe06260372012-03-19 15:16:08 +01001196 .name = "Description",
1197 .mask = FIO_OPT_G_DESC,
1198 },
1199 {
1200 .name = "Filename",
1201 .mask = FIO_OPT_G_FILENAME,
1202 },
1203 {
1204 .name = "General I/O",
1205 .mask = FIO_OPT_G_IO_BASIC,
1206 },
1207 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001208 .name = "Cgroups",
1209 .mask = FIO_OPT_G_CGROUP,
1210 },
1211 {
1212 .name = "Runtime",
1213 .mask = FIO_OPT_G_RUNTIME,
1214 },
1215 {
Jens Axboe10860052012-03-19 20:56:53 +01001216 .name = "Process",
1217 .mask = FIO_OPT_G_PROCESS,
1218 },
1219 {
1220 .name = "Job credentials / priority",
1221 .mask = FIO_OPT_G_CRED,
1222 },
1223 {
1224 .name = "Clock settings",
1225 .mask = FIO_OPT_G_CLOCK,
1226 },
1227 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001228 .name = "I/O Type",
1229 .mask = FIO_OPT_G_IO_TYPE,
1230 },
1231 {
1232 .name = "I/O Thinktime",
1233 .mask = FIO_OPT_G_THINKTIME,
1234 },
1235 {
1236 .name = "Randomizations",
1237 .mask = FIO_OPT_G_RANDOM,
1238 },
1239 {
1240 .name = "I/O buffers",
1241 .mask = FIO_OPT_G_IO_BUF,
1242 },
1243 {
Jens Axboe13fca822012-03-31 13:55:54 +02001244 .name = "Tiobench profile",
1245 .mask = FIO_OPT_G_TIOBENCH,
1246 },
1247
1248 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001249 .name = NULL,
1250 }
1251};
1252
1253struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1254{
1255 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1256}
1257
Jens Axboe9af4a242012-03-16 10:13:49 +01001258/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001259 * Map of job/command line options
1260 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001261struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001262 {
1263 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001264 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001265 .type = FIO_OPT_STR_STORE,
1266 .off1 = td_var_offset(description),
1267 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001268 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001269 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001270 },
1271 {
1272 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001273 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001274 .type = FIO_OPT_STR_STORE,
1275 .off1 = td_var_offset(name),
1276 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001277 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001278 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001279 },
1280 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001281 .name = "filename",
1282 .lname = "Filename(s)",
1283 .type = FIO_OPT_STR_STORE,
1284 .off1 = td_var_offset(filename),
1285 .cb = str_filename_cb,
1286 .prio = -1, /* must come after "directory" */
1287 .help = "File(s) to use for the workload",
1288 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001289 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001290 },
1291 {
1292 .name = "directory",
1293 .lname = "Directory",
1294 .type = FIO_OPT_STR_STORE,
1295 .off1 = td_var_offset(directory),
1296 .cb = str_directory_cb,
1297 .help = "Directory to store files in",
1298 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001299 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001300 },
1301 {
Jens Axboede98bd32013-04-05 11:09:20 +02001302 .name = "filename_format",
1303 .type = FIO_OPT_STR_STORE,
1304 .off1 = td_var_offset(filename_format),
1305 .prio = -1, /* must come after "directory" */
1306 .help = "Override default $jobname.$jobnum.$filenum naming",
1307 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001308 .category = FIO_OPT_C_FILE,
1309 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001310 },
1311 {
Jens Axboe29c13492008-03-01 19:25:20 +01001312 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001313 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001314 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001315 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001316 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001317 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001318 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001319 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001320 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001321 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001322 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001323 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001324 .posval = {
1325 { .ival = "none",
1326 .oval = FILE_LOCK_NONE,
1327 .help = "No file locking",
1328 },
1329 { .ival = "exclusive",
1330 .oval = FILE_LOCK_EXCLUSIVE,
1331 .help = "Exclusive file lock",
1332 },
1333 {
1334 .ival = "readwrite",
1335 .oval = FILE_LOCK_READWRITE,
1336 .help = "Read vs write lock",
1337 },
1338 },
Jens Axboe29c13492008-03-01 19:25:20 +01001339 },
1340 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001341 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001342 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001343 .type = FIO_OPT_STR_STORE,
1344 .off1 = td_var_offset(opendir),
1345 .cb = str_opendir_cb,
1346 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001347 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001348 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001349 },
1350 {
1351 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001352 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001353 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001354 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001355 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001356 .off1 = td_var_offset(td_ddir),
1357 .help = "IO direction",
1358 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001359 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001360 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001361 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001362 .posval = {
1363 { .ival = "read",
1364 .oval = TD_DDIR_READ,
1365 .help = "Sequential read",
1366 },
1367 { .ival = "write",
1368 .oval = TD_DDIR_WRITE,
1369 .help = "Sequential write",
1370 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001371 { .ival = "trim",
1372 .oval = TD_DDIR_TRIM,
1373 .help = "Sequential trim",
1374 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001375 { .ival = "randread",
1376 .oval = TD_DDIR_RANDREAD,
1377 .help = "Random read",
1378 },
1379 { .ival = "randwrite",
1380 .oval = TD_DDIR_RANDWRITE,
1381 .help = "Random write",
1382 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001383 { .ival = "randtrim",
1384 .oval = TD_DDIR_RANDTRIM,
1385 .help = "Random trim",
1386 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001387 { .ival = "rw",
1388 .oval = TD_DDIR_RW,
1389 .help = "Sequential read and write mix",
1390 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001391 { .ival = "readwrite",
1392 .oval = TD_DDIR_RW,
1393 .help = "Sequential read and write mix",
1394 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001395 { .ival = "randrw",
1396 .oval = TD_DDIR_RANDRW,
1397 .help = "Random read and write mix"
1398 },
1399 },
1400 },
1401 {
Jens Axboe38dad622010-07-20 14:46:00 -06001402 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001403 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001404 .type = FIO_OPT_STR,
1405 .off1 = td_var_offset(rw_seq),
1406 .help = "IO offset generator modifier",
1407 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001408 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001409 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001410 .posval = {
1411 { .ival = "sequential",
1412 .oval = RW_SEQ_SEQ,
1413 .help = "Generate sequential offsets",
1414 },
1415 { .ival = "identical",
1416 .oval = RW_SEQ_IDENT,
1417 .help = "Generate identical offsets",
1418 },
1419 },
1420 },
1421
1422 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001423 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001424 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001425 .type = FIO_OPT_STR_STORE,
1426 .off1 = td_var_offset(ioengine),
1427 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001428 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001429 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001430 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001431 .posval = {
1432 { .ival = "sync",
1433 .help = "Use read/write",
1434 },
gurudas paia31041e2007-10-23 15:12:30 +02001435 { .ival = "psync",
1436 .help = "Use pread/pwrite",
1437 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001438 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001439 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001440 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001441#ifdef CONFIG_PWRITEV
1442 { .ival = "pvsync",
1443 .help = "Use preadv/pwritev",
1444 },
1445#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001446#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001447 { .ival = "libaio",
1448 .help = "Linux native asynchronous IO",
1449 },
1450#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001451#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001452 { .ival = "posixaio",
1453 .help = "POSIX asynchronous IO",
1454 },
1455#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001456#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001457 { .ival = "solarisaio",
1458 .help = "Solaris native asynchronous IO",
1459 },
1460#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001461#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001462 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001463 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001464 },
Jens Axboe3be80072011-01-19 11:07:28 -07001465#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001466#ifdef CONFIG_RBD
1467 { .ival = "rbd",
1468 .help = "Rados Block Device asynchronous IO"
1469 },
1470#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001471 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001472 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001473 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001474#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001475 { .ival = "splice",
1476 .help = "splice/vmsplice based IO",
1477 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001478 { .ival = "netsplice",
1479 .help = "splice/vmsplice to/from the network",
1480 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001481#endif
1482#ifdef FIO_HAVE_SGIO
1483 { .ival = "sg",
1484 .help = "SCSI generic v3 IO",
1485 },
1486#endif
1487 { .ival = "null",
1488 .help = "Testing engine (no data transfer)",
1489 },
1490 { .ival = "net",
1491 .help = "Network IO",
1492 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001493 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001494 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001495 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001496#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001497 { .ival = "guasi",
1498 .help = "GUASI IO engine",
1499 },
1500#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001501#ifdef FIO_HAVE_BINJECT
1502 { .ival = "binject",
1503 .help = "binject direct inject block engine",
1504 },
1505#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001506#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001507 { .ival = "rdma",
1508 .help = "RDMA IO engine",
1509 },
1510#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001511#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001512 { .ival = "fusion-aw-sync",
1513 .help = "Fusion-io atomic write engine",
1514 },
1515#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001516#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001517 { .ival = "e4defrag",
1518 .help = "ext4 defrag engine",
1519 },
1520#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001521#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001522 { .ival = "falloc",
1523 .help = "fallocate() file based engine",
1524 },
1525#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001526 { .ival = "external",
1527 .help = "Load external engine (append name)",
1528 },
1529 },
1530 },
1531 {
1532 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001533 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001534 .type = FIO_OPT_INT,
1535 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001536 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001537 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001538 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001539 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001540 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001541 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001542 },
1543 {
1544 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001545 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001546 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001547 .type = FIO_OPT_INT,
1548 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001549 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001550 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001551 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001552 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001553 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001554 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001555 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001556 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001557 },
1558 {
Jens Axboe49504212008-06-05 09:03:30 +02001559 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001560 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001561 .type = FIO_OPT_INT,
1562 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001563 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001564 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001565 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001566 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001567 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001568 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001569 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001570 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001571 },
1572 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001573 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001574 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001575 .type = FIO_OPT_INT,
1576 .off1 = td_var_offset(iodepth_low),
1577 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001578 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001579 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001580 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001581 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001582 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001583 },
1584 {
1585 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001586 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001587 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001588 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001589 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001590 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001591 .category = FIO_OPT_C_IO,
1592 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001593 },
1594 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001595 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001596 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001597 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001598 .type = FIO_OPT_BOOL,
1599 .off1 = td_var_offset(fill_device),
1600 .help = "Write until an ENOSPC error occurs",
1601 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001602 .category = FIO_OPT_C_FILE,
1603 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001604 },
1605 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001606 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001607 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001608 .type = FIO_OPT_STR_VAL,
1609 .off1 = td_var_offset(file_size_low),
1610 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001611 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001612 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001613 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001614 .category = FIO_OPT_C_FILE,
1615 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001616 },
1617 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001618 .name = "file_append",
1619 .lname = "File append",
1620 .type = FIO_OPT_BOOL,
1621 .off1 = td_var_offset(file_append),
1622 .help = "IO will start at the end of the file(s)",
1623 .def = "0",
1624 .category = FIO_OPT_C_FILE,
1625 .group = FIO_OPT_G_INVALID,
1626 },
1627 {
Jens Axboe67a10002007-07-31 23:12:16 +02001628 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001629 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001630 .alias = "fileoffset",
1631 .type = FIO_OPT_STR_VAL,
1632 .off1 = td_var_offset(start_offset),
1633 .help = "Start IO from this offset",
1634 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001635 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001636 .category = FIO_OPT_C_IO,
1637 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001638 },
1639 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001640 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001641 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001642 .type = FIO_OPT_STR_VAL,
1643 .off1 = td_var_offset(offset_increment),
1644 .help = "What is the increment from one offset to the next",
1645 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001646 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001647 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001648 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001649 .category = FIO_OPT_C_IO,
1650 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001651 },
1652 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001653 .name = "number_ios",
1654 .lname = "Number of IOs to perform",
1655 .type = FIO_OPT_STR_VAL,
1656 .off1 = td_var_offset(number_ios),
1657 .help = "Force job completion of this number of IOs",
1658 .def = "0",
1659 .category = FIO_OPT_C_IO,
1660 .group = FIO_OPT_G_INVALID,
1661 },
1662 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001663 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001664 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001665 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001666 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001667 .off1 = td_var_offset(bs[DDIR_READ]),
1668 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001669 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001670 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001671 .help = "Block size unit",
1672 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001673 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001674 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001675 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001676 .category = FIO_OPT_C_IO,
1677 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001678 },
1679 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001680 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001681 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001682 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001683 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001684 .off1 = td_var_offset(ba[DDIR_READ]),
1685 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001686 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001687 .minval = 1,
1688 .help = "IO block offset alignment",
1689 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001690 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001691 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001692 .category = FIO_OPT_C_IO,
1693 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001694 },
1695 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001696 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001697 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001698 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001699 .type = FIO_OPT_RANGE,
1700 .off1 = td_var_offset(min_bs[DDIR_READ]),
1701 .off2 = td_var_offset(max_bs[DDIR_READ]),
1702 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1703 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001704 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1705 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001706 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001707 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001708 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001709 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001710 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001711 .category = FIO_OPT_C_IO,
1712 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001713 },
1714 {
Jens Axboe564ca972007-12-14 12:21:19 +01001715 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001716 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001717 .type = FIO_OPT_STR,
1718 .cb = str_bssplit_cb,
1719 .help = "Set a specific mix of block sizes",
1720 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001721 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001722 .category = FIO_OPT_C_IO,
1723 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001724 },
1725 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001726 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001727 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001728 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001729 .type = FIO_OPT_STR_SET,
1730 .off1 = td_var_offset(bs_unaligned),
1731 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001732 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001733 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001734 .category = FIO_OPT_C_IO,
1735 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001736 },
1737 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001738 .name = "bs_is_seq_rand",
1739 .lname = "Block size division is seq/random (not read/write)",
1740 .type = FIO_OPT_BOOL,
1741 .off1 = td_var_offset(bs_is_seq_rand),
1742 .help = "Consider any blocksize setting to be sequential,ramdom",
1743 .def = "0",
1744 .parent = "blocksize",
1745 .category = FIO_OPT_C_IO,
1746 .group = FIO_OPT_G_INVALID,
1747 },
1748 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001749 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001750 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001751 .type = FIO_OPT_BOOL,
1752 .off1 = td_var_offset(rand_repeatable),
1753 .help = "Use repeatable random IO pattern",
1754 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001755 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001756 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001757 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001758 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001759 },
1760 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001761 .name = "randseed",
1762 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001763 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001764 .off1 = td_var_offset(rand_seed),
1765 .help = "Set the random generator seed value",
1766 .parent = "rw",
1767 .category = FIO_OPT_C_IO,
1768 .group = FIO_OPT_G_RANDOM,
1769 },
1770 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001771 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001772 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001773 .type = FIO_OPT_BOOL,
1774 .off1 = td_var_offset(use_os_rand),
1775 .help = "Set to use OS random generator",
1776 .def = "0",
1777 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001778 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001779 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001780 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001781 },
1782 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001783 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001784 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001785 .type = FIO_OPT_STR_SET,
1786 .off1 = td_var_offset(norandommap),
1787 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001788 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001789 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001790 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001791 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001792 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001793 },
1794 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001795 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001796 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001797 .type = FIO_OPT_BOOL,
1798 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001799 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001800 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001801 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001802 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001803 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001804 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001805 },
1806 {
Jens Axboe8055e412012-11-26 08:43:47 +01001807 .name = "random_generator",
1808 .type = FIO_OPT_STR,
1809 .off1 = td_var_offset(random_generator),
1810 .help = "Type of random number generator to use",
1811 .def = "tausworthe",
1812 .posval = {
1813 { .ival = "tausworthe",
1814 .oval = FIO_RAND_GEN_TAUSWORTHE,
1815 .help = "Strong Tausworthe generator",
1816 },
1817 { .ival = "lfsr",
1818 .oval = FIO_RAND_GEN_LFSR,
1819 .help = "Variable length LFSR",
1820 },
1821 },
Jens Axboe48107592012-12-04 09:43:11 +01001822 .category = FIO_OPT_C_IO,
1823 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001824 },
1825 {
Jens Axboee25839d2012-11-06 10:49:42 +01001826 .name = "random_distribution",
1827 .type = FIO_OPT_STR,
1828 .off1 = td_var_offset(random_distribution),
1829 .cb = str_random_distribution_cb,
1830 .help = "Random offset distribution generator",
1831 .def = "random",
1832 .posval = {
1833 { .ival = "random",
1834 .oval = FIO_RAND_DIST_RANDOM,
1835 .help = "Completely random",
1836 },
1837 { .ival = "zipf",
1838 .oval = FIO_RAND_DIST_ZIPF,
1839 .help = "Zipf distribution",
1840 },
Jens Axboe925fee32012-11-06 13:50:32 +01001841 { .ival = "pareto",
1842 .oval = FIO_RAND_DIST_PARETO,
1843 .help = "Pareto distribution",
1844 },
Jens Axboee25839d2012-11-06 10:49:42 +01001845 },
Jens Axboe48107592012-12-04 09:43:11 +01001846 .category = FIO_OPT_C_IO,
1847 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001848 },
1849 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001850 .name = "percentage_random",
1851 .lname = "Percentage Random",
1852 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001853 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1854 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1855 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001856 .maxval = 100,
1857 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001858 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001859 .interval = 5,
1860 .inverse = "percentage_sequential",
1861 .category = FIO_OPT_C_IO,
1862 .group = FIO_OPT_G_RANDOM,
1863 },
1864 {
1865 .name = "percentage_sequential",
1866 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001867 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001868 .category = FIO_OPT_C_IO,
1869 .group = FIO_OPT_G_RANDOM,
1870 },
1871 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001872 .name = "allrandrepeat",
1873 .type = FIO_OPT_BOOL,
1874 .off1 = td_var_offset(allrand_repeatable),
1875 .help = "Use repeatable random numbers for everything",
1876 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001877 .category = FIO_OPT_C_IO,
1878 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001879 },
1880 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001881 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001882 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001883 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001884 .type = FIO_OPT_INT,
1885 .off1 = td_var_offset(nr_files),
1886 .help = "Split job workload between this number of files",
1887 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001888 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001889 .category = FIO_OPT_C_FILE,
1890 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001891 },
1892 {
1893 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001894 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001895 .type = FIO_OPT_INT,
1896 .off1 = td_var_offset(open_files),
1897 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001898 .category = FIO_OPT_C_FILE,
1899 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001900 },
1901 {
1902 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001903 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001904 .type = FIO_OPT_STR,
1905 .cb = str_fst_cb,
1906 .off1 = td_var_offset(file_service_type),
1907 .help = "How to select which file to service next",
1908 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001909 .category = FIO_OPT_C_FILE,
1910 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001911 .posval = {
1912 { .ival = "random",
1913 .oval = FIO_FSERVICE_RANDOM,
1914 .help = "Choose a file at random",
1915 },
1916 { .ival = "roundrobin",
1917 .oval = FIO_FSERVICE_RR,
1918 .help = "Round robin select files",
1919 },
Jens Axboea086c252009-03-04 08:27:37 +01001920 { .ival = "sequential",
1921 .oval = FIO_FSERVICE_SEQ,
1922 .help = "Finish one file before moving to the next",
1923 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001924 },
Jens Axboe67a10002007-07-31 23:12:16 +02001925 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001926 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001927 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001928#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001929 {
1930 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001931 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001932 .type = FIO_OPT_STR,
1933 .off1 = td_var_offset(fallocate_mode),
1934 .help = "Whether pre-allocation is performed when laying out files",
1935 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001936 .category = FIO_OPT_C_FILE,
1937 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001938 .posval = {
1939 { .ival = "none",
1940 .oval = FIO_FALLOCATE_NONE,
1941 .help = "Do not pre-allocate space",
1942 },
1943 { .ival = "posix",
1944 .oval = FIO_FALLOCATE_POSIX,
1945 .help = "Use posix_fallocate()",
1946 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001947#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001948 { .ival = "keep",
1949 .oval = FIO_FALLOCATE_KEEP_SIZE,
1950 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1951 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001952#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001953 /* Compatibility with former boolean values */
1954 { .ival = "0",
1955 .oval = FIO_FALLOCATE_NONE,
1956 .help = "Alias for 'none'",
1957 },
1958 { .ival = "1",
1959 .oval = FIO_FALLOCATE_POSIX,
1960 .help = "Alias for 'posix'",
1961 },
1962 },
1963 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001964#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001965 {
1966 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01001967 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001968 .type = FIO_OPT_BOOL,
1969 .off1 = td_var_offset(fadvise_hint),
1970 .help = "Use fadvise() to advise the kernel on IO pattern",
1971 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001972 .category = FIO_OPT_C_FILE,
1973 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001974 },
1975 {
1976 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001977 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001978 .type = FIO_OPT_INT,
1979 .off1 = td_var_offset(fsync_blocks),
1980 .help = "Issue fsync for writes every given number of blocks",
1981 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001982 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001983 .category = FIO_OPT_C_FILE,
1984 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001985 },
1986 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02001987 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01001988 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02001989 .type = FIO_OPT_INT,
1990 .off1 = td_var_offset(fdatasync_blocks),
1991 .help = "Issue fdatasync for writes every given number of blocks",
1992 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001993 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001994 .category = FIO_OPT_C_FILE,
1995 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02001996 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02001997 {
1998 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01001999 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002000 .type = FIO_OPT_INT,
2001 .off1 = td_var_offset(barrier_blocks),
2002 .help = "Make every Nth write a barrier write",
2003 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002004 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002005 .category = FIO_OPT_C_IO,
2006 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002007 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002008#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002009 {
2010 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002011 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002012 .posval = {
2013 { .ival = "wait_before",
2014 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2015 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002016 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002017 },
2018 { .ival = "write",
2019 .oval = SYNC_FILE_RANGE_WRITE,
2020 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002021 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002022 },
2023 {
2024 .ival = "wait_after",
2025 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2026 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002027 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002028 },
2029 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002030 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002031 .cb = str_sfr_cb,
2032 .off1 = td_var_offset(sync_file_range),
2033 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002034 .category = FIO_OPT_C_FILE,
2035 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002036 },
2037#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002038 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002039 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002040 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002041 .type = FIO_OPT_BOOL,
2042 .off1 = td_var_offset(odirect),
2043 .help = "Use O_DIRECT IO (negates buffered)",
2044 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002045 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002046 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002047 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002048 },
2049 {
Chris Masond01612f2013-11-15 15:52:58 -07002050 .name = "atomic",
2051 .lname = "Atomic I/O",
2052 .type = FIO_OPT_BOOL,
2053 .off1 = td_var_offset(oatomic),
2054 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2055 .def = "0",
2056 .category = FIO_OPT_C_IO,
2057 .group = FIO_OPT_G_IO_TYPE,
2058 },
2059 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002060 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002061 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002062 .type = FIO_OPT_BOOL,
2063 .off1 = td_var_offset(odirect),
2064 .neg = 1,
2065 .help = "Use buffered IO (negates direct)",
2066 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002067 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002068 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002069 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002070 },
2071 {
2072 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002073 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002074 .type = FIO_OPT_BOOL,
2075 .off1 = td_var_offset(overwrite),
2076 .help = "When writing, set whether to overwrite current data",
2077 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002078 .category = FIO_OPT_C_FILE,
2079 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002080 },
2081 {
2082 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002083 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002084 .type = FIO_OPT_INT,
2085 .off1 = td_var_offset(loops),
2086 .help = "Number of times to run the job",
2087 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002088 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002089 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002090 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002091 },
2092 {
2093 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002094 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002095 .type = FIO_OPT_INT,
2096 .off1 = td_var_offset(numjobs),
2097 .help = "Duplicate this job this many times",
2098 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002099 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002100 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002101 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002102 },
2103 {
2104 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002105 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002106 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002107 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002108 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002109 .help = "Only start job when this period has passed",
2110 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002111 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002112 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002113 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002114 },
2115 {
2116 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002117 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002118 .alias = "timeout",
2119 .type = FIO_OPT_STR_VAL_TIME,
2120 .off1 = td_var_offset(timeout),
2121 .help = "Stop workload when this amount of time has passed",
2122 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002123 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002124 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002125 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002126 },
2127 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002128 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002129 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002130 .type = FIO_OPT_STR_SET,
2131 .off1 = td_var_offset(time_based),
2132 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002133 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002134 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002135 },
2136 {
Juan Casse62167762013-09-17 14:06:13 -07002137 .name = "verify_only",
2138 .lname = "Verify only",
2139 .type = FIO_OPT_STR_SET,
2140 .off1 = td_var_offset(verify_only),
2141 .help = "Verifies previously written data is still valid",
2142 .category = FIO_OPT_C_GENERAL,
2143 .group = FIO_OPT_G_RUNTIME,
2144 },
2145 {
Jens Axboe721938a2008-09-10 09:46:16 +02002146 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002147 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002148 .type = FIO_OPT_STR_VAL_TIME,
2149 .off1 = td_var_offset(ramp_time),
2150 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002151 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002152 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002153 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002154 },
2155 {
Jens Axboec223da82010-03-24 13:23:53 +01002156 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002157 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002158 .type = FIO_OPT_STR,
2159 .cb = fio_clock_source_cb,
2160 .off1 = td_var_offset(clocksource),
2161 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002162 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002163 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002164 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002165#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002166 { .ival = "gettimeofday",
2167 .oval = CS_GTOD,
2168 .help = "Use gettimeofday(2) for timing",
2169 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002170#endif
2171#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002172 { .ival = "clock_gettime",
2173 .oval = CS_CGETTIME,
2174 .help = "Use clock_gettime(2) for timing",
2175 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002176#endif
Jens Axboec223da82010-03-24 13:23:53 +01002177#ifdef ARCH_HAVE_CPU_CLOCK
2178 { .ival = "cpu",
2179 .oval = CS_CPUCLOCK,
2180 .help = "Use CPU private clock",
2181 },
2182#endif
2183 },
2184 },
2185 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002186 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002187 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002188 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002189 .type = FIO_OPT_STR,
2190 .cb = str_mem_cb,
2191 .off1 = td_var_offset(mem_type),
2192 .help = "Backing type for IO buffers",
2193 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002194 .category = FIO_OPT_C_IO,
2195 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002196 .posval = {
2197 { .ival = "malloc",
2198 .oval = MEM_MALLOC,
2199 .help = "Use malloc(3) for IO buffers",
2200 },
Jens Axboeb370e462007-03-19 10:51:49 +01002201 { .ival = "shm",
2202 .oval = MEM_SHM,
2203 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002204 },
2205#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002206 { .ival = "shmhuge",
2207 .oval = MEM_SHMHUGE,
2208 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002209 },
2210#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002211 { .ival = "mmap",
2212 .oval = MEM_MMAP,
2213 .help = "Use mmap(2) (file or anon) for IO buffers",
2214 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002215#ifdef FIO_HAVE_HUGETLB
2216 { .ival = "mmaphuge",
2217 .oval = MEM_MMAPHUGE,
2218 .help = "Like mmap, but use huge pages",
2219 },
2220#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002221 },
2222 },
2223 {
Jens Axboed529ee12009-07-01 10:33:03 +02002224 .name = "iomem_align",
2225 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002226 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002227 .type = FIO_OPT_INT,
2228 .off1 = td_var_offset(mem_align),
2229 .minval = 0,
2230 .help = "IO memory buffer offset alignment",
2231 .def = "0",
2232 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002233 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002234 .category = FIO_OPT_C_IO,
2235 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002236 },
2237 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002238 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002239 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002240 .type = FIO_OPT_STR,
2241 .off1 = td_var_offset(verify),
2242 .help = "Verify data written",
2243 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002244 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002245 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002246 .posval = {
2247 { .ival = "0",
2248 .oval = VERIFY_NONE,
2249 .help = "Don't do IO verification",
2250 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002251 { .ival = "md5",
2252 .oval = VERIFY_MD5,
2253 .help = "Use md5 checksums for verification",
2254 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002255 { .ival = "crc64",
2256 .oval = VERIFY_CRC64,
2257 .help = "Use crc64 checksums for verification",
2258 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002259 { .ival = "crc32",
2260 .oval = VERIFY_CRC32,
2261 .help = "Use crc32 checksums for verification",
2262 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002263 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002264 .oval = VERIFY_CRC32C,
2265 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002266 },
Jens Axboebac39e02008-06-11 20:46:19 +02002267 { .ival = "crc32c",
2268 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002269 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002270 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002271 { .ival = "crc16",
2272 .oval = VERIFY_CRC16,
2273 .help = "Use crc16 checksums for verification",
2274 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002275 { .ival = "crc7",
2276 .oval = VERIFY_CRC7,
2277 .help = "Use crc7 checksums for verification",
2278 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002279 { .ival = "sha1",
2280 .oval = VERIFY_SHA1,
2281 .help = "Use sha1 checksums for verification",
2282 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002283 { .ival = "sha256",
2284 .oval = VERIFY_SHA256,
2285 .help = "Use sha256 checksums for verification",
2286 },
2287 { .ival = "sha512",
2288 .oval = VERIFY_SHA512,
2289 .help = "Use sha512 checksums for verification",
2290 },
Jens Axboe844ea602014-02-20 13:21:45 -08002291 { .ival = "xxhash",
2292 .oval = VERIFY_XXHASH,
2293 .help = "Use xxhash checksums for verification",
2294 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002295 { .ival = "meta",
2296 .oval = VERIFY_META,
2297 .help = "Use io information",
2298 },
Jens Axboe36690c92007-03-26 10:23:34 +02002299 {
2300 .ival = "null",
2301 .oval = VERIFY_NULL,
2302 .help = "Pretend to verify",
2303 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002304 },
2305 },
2306 {
Jens Axboe005c5652007-08-02 22:21:36 +02002307 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002308 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002309 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002310 .off1 = td_var_offset(do_verify),
2311 .help = "Run verification stage after write",
2312 .def = "1",
2313 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002314 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002317 },
2318 {
Jens Axboe160b9662007-03-27 10:59:49 +02002319 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002320 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002321 .type = FIO_OPT_BOOL,
2322 .off1 = td_var_offset(verifysort),
2323 .help = "Sort written verify blocks for read back",
2324 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002325 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002326 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002327 .category = FIO_OPT_C_IO,
2328 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002329 },
2330 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002331 .name = "verifysort_nr",
2332 .type = FIO_OPT_INT,
2333 .off1 = td_var_offset(verifysort_nr),
2334 .help = "Pre-load and sort verify blocks for a read workload",
2335 .minval = 0,
2336 .maxval = 131072,
2337 .def = "1024",
2338 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002339 .category = FIO_OPT_C_IO,
2340 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002341 },
2342 {
Jens Axboea59e1702007-07-30 08:53:27 +02002343 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002344 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002345 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002346 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002347 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002348 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002349 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002350 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002351 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002352 .category = FIO_OPT_C_IO,
2353 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002354 },
2355 {
Jens Axboea59e1702007-07-30 08:53:27 +02002356 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002357 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002358 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002359 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002360 .off1 = td_var_offset(verify_offset),
2361 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002362 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002363 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002364 .category = FIO_OPT_C_IO,
2365 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002366 },
2367 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002368 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002369 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002370 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002371 .cb = str_verify_pattern_cb,
2372 .help = "Fill pattern for IO buffers",
2373 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002374 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002375 .category = FIO_OPT_C_IO,
2376 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002377 },
2378 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002379 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002380 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002381 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002382 .off1 = td_var_offset(verify_fatal),
2383 .def = "0",
2384 .help = "Exit on a single verify failure, don't continue",
2385 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002386 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002387 .category = FIO_OPT_C_IO,
2388 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002389 },
2390 {
Jens Axboeb463e932011-01-12 09:03:23 +01002391 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002392 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002393 .type = FIO_OPT_BOOL,
2394 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002395 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002396 .help = "Dump contents of good and bad blocks on failure",
2397 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002398 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002399 .category = FIO_OPT_C_IO,
2400 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002401 },
2402 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002403 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002404 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002405 .type = FIO_OPT_INT,
2406 .off1 = td_var_offset(verify_async),
2407 .def = "0",
2408 .help = "Number of async verifier threads to use",
2409 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002410 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002411 .category = FIO_OPT_C_IO,
2412 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002413 },
Jens Axboe9e144182010-06-15 14:25:36 +02002414 {
2415 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002416 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002417 .type = FIO_OPT_STR_VAL,
2418 .off1 = td_var_offset(verify_backlog),
2419 .help = "Verify after this number of blocks are written",
2420 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002421 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002422 .category = FIO_OPT_C_IO,
2423 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002424 },
2425 {
2426 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002427 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002428 .type = FIO_OPT_INT,
2429 .off1 = td_var_offset(verify_batch),
2430 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002431 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002432 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002433 .category = FIO_OPT_C_IO,
2434 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002435 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002436#ifdef FIO_HAVE_CPU_AFFINITY
2437 {
2438 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002439 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002440 .type = FIO_OPT_STR,
2441 .cb = str_verify_cpus_allowed_cb,
2442 .help = "Set CPUs allowed for async verify threads",
2443 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002444 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002445 .category = FIO_OPT_C_IO,
2446 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002447 },
2448#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002449 {
2450 .name = "experimental_verify",
2451 .off1 = td_var_offset(experimental_verify),
2452 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002453 .help = "Enable experimental verification",
Jens Axboe836fcc02013-01-24 09:08:45 -07002454 .category = FIO_OPT_C_IO,
2455 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002456 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002457#ifdef FIO_HAVE_TRIM
2458 {
2459 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002460 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002461 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002462 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002463 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002464 .maxval = 100,
2465 .help = "Number of verify blocks to discard/trim",
2466 .parent = "verify",
2467 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002468 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002469 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002470 .category = FIO_OPT_C_IO,
2471 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002472 },
2473 {
2474 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002475 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002476 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002477 .help = "Verify that trim/discarded blocks are returned as zeroes",
2478 .off1 = td_var_offset(trim_zero),
2479 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002480 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002481 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002482 .category = FIO_OPT_C_IO,
2483 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002484 },
2485 {
2486 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002487 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002488 .type = FIO_OPT_STR_VAL,
2489 .off1 = td_var_offset(trim_backlog),
2490 .help = "Trim after this number of blocks are written",
2491 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002492 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002493 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002494 .category = FIO_OPT_C_IO,
2495 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002496 },
2497 {
2498 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002499 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002500 .type = FIO_OPT_INT,
2501 .off1 = td_var_offset(trim_batch),
2502 .help = "Trim this number of IO blocks",
2503 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002504 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002505 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002508 },
2509#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002510 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002511 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002512 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002513 .type = FIO_OPT_STR_STORE,
2514 .off1 = td_var_offset(write_iolog_file),
2515 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002516 .category = FIO_OPT_C_IO,
2517 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002518 },
2519 {
2520 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002521 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002522 .type = FIO_OPT_STR_STORE,
2523 .off1 = td_var_offset(read_iolog_file),
2524 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002525 .category = FIO_OPT_C_IO,
2526 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002527 },
2528 {
David Nellans64bbb862010-08-24 22:13:30 +02002529 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002530 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002531 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002532 .off1 = td_var_offset(no_stall),
2533 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002534 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002535 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002536 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002537 .category = FIO_OPT_C_IO,
2538 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002539 },
2540 {
David Nellansd1c46c02010-08-31 21:20:47 +02002541 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002542 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002543 .type = FIO_OPT_STR_STORE,
2544 .off1 = td_var_offset(replay_redirect),
2545 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002546 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002547 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002548 .category = FIO_OPT_C_IO,
2549 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002550 },
2551 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002552 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002553 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002554 .type = FIO_OPT_STR_STORE,
2555 .off1 = td_var_offset(exec_prerun),
2556 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002557 .category = FIO_OPT_C_GENERAL,
2558 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002559 },
2560 {
2561 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002562 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002563 .type = FIO_OPT_STR_STORE,
2564 .off1 = td_var_offset(exec_postrun),
2565 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002566 .category = FIO_OPT_C_GENERAL,
2567 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002568 },
2569#ifdef FIO_HAVE_IOSCHED_SWITCH
2570 {
2571 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002572 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002573 .type = FIO_OPT_STR_STORE,
2574 .off1 = td_var_offset(ioscheduler),
2575 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002576 .category = FIO_OPT_C_FILE,
2577 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002578 },
2579#endif
2580 {
2581 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002582 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002583 .type = FIO_OPT_STR_VAL,
2584 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002585 .help = "Amount of data to read per zone",
2586 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002587 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002590 },
2591 {
2592 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002593 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002594 .type = FIO_OPT_STR_VAL,
2595 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002596 .help = "Give size of an IO zone",
2597 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002598 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002599 .category = FIO_OPT_C_IO,
2600 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002601 },
2602 {
2603 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002604 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002605 .type = FIO_OPT_STR_VAL,
2606 .off1 = td_var_offset(zone_skip),
2607 .help = "Space between IO zones",
2608 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002609 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002612 },
2613 {
2614 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002615 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002616 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002617 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002618 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002619 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002620 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002621 .category = FIO_OPT_C_GENERAL,
2622 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002623 },
2624 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002625 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002626 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002627 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002628 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002629 .maxval = 100,
2630 .help = "Percentage of mixed workload that is reads",
2631 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002632 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002633 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002634 .category = FIO_OPT_C_IO,
2635 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002636 },
2637 {
2638 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002639 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002640 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002641 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002642 .maxval = 100,
2643 .help = "Percentage of mixed workload that is writes",
2644 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002645 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002646 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002647 .category = FIO_OPT_C_IO,
2648 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002649 },
2650 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002651 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002652 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002653 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002654 .category = FIO_OPT_C_IO,
2655 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002656 },
2657 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002658 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002659 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002660 .type = FIO_OPT_INT,
2661 .off1 = td_var_offset(nice),
2662 .help = "Set job CPU nice value",
2663 .minval = -19,
2664 .maxval = 20,
2665 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002666 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002667 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002668 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002669 },
2670#ifdef FIO_HAVE_IOPRIO
2671 {
2672 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002673 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002674 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002675 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002676 .help = "Set job IO priority value",
2677 .minval = 0,
2678 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002679 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002680 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002681 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002682 },
2683 {
2684 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002685 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002686 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002687 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 .help = "Set job IO priority class",
2689 .minval = 0,
2690 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002691 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002692 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002693 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002694 },
2695#endif
2696 {
2697 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002698 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002699 .type = FIO_OPT_INT,
2700 .off1 = td_var_offset(thinktime),
2701 .help = "Idle time between IO buffers (usec)",
2702 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002703 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002704 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002705 },
2706 {
2707 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002708 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002709 .type = FIO_OPT_INT,
2710 .off1 = td_var_offset(thinktime_spin),
2711 .help = "Start think time by spinning this amount (usec)",
2712 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002713 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002714 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002715 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002716 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002717 },
2718 {
2719 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002720 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002721 .type = FIO_OPT_INT,
2722 .off1 = td_var_offset(thinktime_blocks),
2723 .help = "IO buffer period between 'thinktime'",
2724 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002725 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002726 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002727 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002728 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002729 },
2730 {
2731 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002732 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002733 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002734 .off1 = td_var_offset(rate[DDIR_READ]),
2735 .off2 = td_var_offset(rate[DDIR_WRITE]),
2736 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002737 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002738 .category = FIO_OPT_C_IO,
2739 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002740 },
2741 {
2742 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002743 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002744 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002745 .off1 = td_var_offset(ratemin[DDIR_READ]),
2746 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2747 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002748 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002749 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002750 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002751 .category = FIO_OPT_C_IO,
2752 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002753 },
2754 {
2755 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002756 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002757 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002758 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2759 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2760 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002761 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002762 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002763 .category = FIO_OPT_C_IO,
2764 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002765 },
2766 {
2767 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002768 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002769 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002770 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2771 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2772 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002773 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002774 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002775 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002776 .category = FIO_OPT_C_IO,
2777 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002778 },
2779 {
2780 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002781 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002782 .type = FIO_OPT_INT,
2783 .off1 = td_var_offset(ratecycle),
2784 .help = "Window average for rate limits (msec)",
2785 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002786 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002787 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002788 .category = FIO_OPT_C_IO,
2789 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002790 },
2791 {
Jens Axboe15501532012-10-24 16:37:45 +02002792 .name = "max_latency",
2793 .type = FIO_OPT_INT,
2794 .off1 = td_var_offset(max_latency),
2795 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe1e5324e2012-11-14 14:25:31 -07002796 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002797 .group = FIO_OPT_G_LATPROF,
2798 },
2799 {
2800 .name = "latency_target",
2801 .lname = "Latency Target (usec)",
2802 .type = FIO_OPT_STR_VAL_TIME,
2803 .off1 = td_var_offset(latency_target),
2804 .help = "Ramp to max queue depth supporting this latency",
2805 .category = FIO_OPT_C_IO,
2806 .group = FIO_OPT_G_LATPROF,
2807 },
2808 {
2809 .name = "latency_window",
2810 .lname = "Latency Window (usec)",
2811 .type = FIO_OPT_STR_VAL_TIME,
2812 .off1 = td_var_offset(latency_window),
2813 .help = "Time to sustain latency_target",
2814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_LATPROF,
2816 },
2817 {
2818 .name = "latency_percentile",
2819 .lname = "Latency Percentile",
2820 .type = FIO_OPT_FLOAT_LIST,
2821 .off1 = td_var_offset(latency_percentile),
2822 .help = "Percentile of IOs must be below latency_target",
2823 .def = "100",
2824 .maxlen = 1,
2825 .minfp = 0.0,
2826 .maxfp = 100.0,
2827 .category = FIO_OPT_C_IO,
2828 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002829 },
2830 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002831 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002832 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002833 .type = FIO_OPT_BOOL,
2834 .off1 = td_var_offset(invalidate_cache),
2835 .help = "Invalidate buffer/page cache prior to running job",
2836 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002837 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002838 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002839 },
2840 {
2841 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002842 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002843 .type = FIO_OPT_BOOL,
2844 .off1 = td_var_offset(sync_io),
2845 .help = "Use O_SYNC for buffered writes",
2846 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002847 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002848 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002849 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002850 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002851 },
2852 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002853 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002854 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002855 .type = FIO_OPT_BOOL,
2856 .off1 = td_var_offset(create_serialize),
2857 .help = "Serialize creating of job files",
2858 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002859 .category = FIO_OPT_C_FILE,
2860 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002861 },
2862 {
2863 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002864 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002865 .type = FIO_OPT_BOOL,
2866 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002867 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002868 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002869 .category = FIO_OPT_C_FILE,
2870 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002871 },
2872 {
Jens Axboe814452b2009-03-04 12:53:13 +01002873 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002874 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002875 .type = FIO_OPT_BOOL,
2876 .off1 = td_var_offset(create_on_open),
2877 .help = "Create files when they are opened for IO",
2878 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002879 .category = FIO_OPT_C_FILE,
2880 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002881 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002882 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002883 .name = "create_only",
2884 .type = FIO_OPT_BOOL,
2885 .off1 = td_var_offset(create_only),
2886 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002887 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002888 .def = "0",
2889 },
2890 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002891 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002892 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002893 .type = FIO_OPT_BOOL,
2894 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002895 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002896 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002897 .category = FIO_OPT_C_FILE,
2898 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002899 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002900#ifdef FIO_HAVE_CPU_AFFINITY
2901 {
2902 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002903 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002904 .type = FIO_OPT_INT,
2905 .cb = str_cpumask_cb,
2906 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002907 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002908 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002909 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002910 {
2911 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002912 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002913 .type = FIO_OPT_STR,
2914 .cb = str_cpus_allowed_cb,
2915 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002916 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002917 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002918 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002919 {
2920 .name = "cpus_allowed_policy",
2921 .lname = "CPUs allowed distribution policy",
2922 .type = FIO_OPT_STR,
2923 .off1 = td_var_offset(cpus_allowed_policy),
2924 .help = "Distribution policy for cpus_allowed",
2925 .parent = "cpus_allowed",
2926 .prio = 1,
2927 .posval = {
2928 { .ival = "shared",
2929 .oval = FIO_CPUS_SHARED,
2930 .help = "Mask shared between threads",
2931 },
2932 { .ival = "split",
2933 .oval = FIO_CPUS_SPLIT,
2934 .help = "Mask split between threads",
2935 },
2936 },
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_CRED,
2939 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002940#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002941#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002942 {
2943 .name = "numa_cpu_nodes",
2944 .type = FIO_OPT_STR,
2945 .cb = str_numa_cpunodes_cb,
2946 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02002947 .category = FIO_OPT_C_GENERAL,
2948 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002949 },
2950 {
2951 .name = "numa_mem_policy",
2952 .type = FIO_OPT_STR,
2953 .cb = str_numa_mpol_cb,
2954 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02002955 .category = FIO_OPT_C_GENERAL,
2956 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002957 },
2958#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002959 {
2960 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002961 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002962 .type = FIO_OPT_BOOL,
2963 .off1 = td_var_offset(end_fsync),
2964 .help = "Include fsync at the end of job",
2965 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002966 .category = FIO_OPT_C_FILE,
2967 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002968 },
2969 {
2970 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01002971 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002972 .type = FIO_OPT_BOOL,
2973 .off1 = td_var_offset(fsync_on_close),
2974 .help = "fsync files on close",
2975 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002976 .category = FIO_OPT_C_FILE,
2977 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002978 },
2979 {
2980 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01002981 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002982 .type = FIO_OPT_BOOL,
2983 .off1 = td_var_offset(unlink),
2984 .help = "Unlink created files after job has completed",
2985 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002986 .category = FIO_OPT_C_FILE,
2987 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002988 },
2989 {
2990 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002991 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002992 .type = FIO_OPT_STR_SET,
2993 .cb = str_exitall_cb,
2994 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01002995 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002996 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002997 },
2998 {
2999 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003000 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003001 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003002 .type = FIO_OPT_STR_SET,
3003 .off1 = td_var_offset(stonewall),
3004 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003005 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003006 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003007 },
3008 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003009 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003010 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003011 .type = FIO_OPT_STR_SET,
3012 .off1 = td_var_offset(new_group),
3013 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003014 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003015 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003016 },
3017 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003018 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003019 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003020 .type = FIO_OPT_STR_SET,
3021 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003022 .help = "Use threads instead of processes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003023 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003024 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003025 },
3026 {
3027 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003028 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003029 .type = FIO_OPT_STR_STORE,
3030 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003031 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003032 .category = FIO_OPT_C_LOG,
3033 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003034 },
3035 {
3036 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003037 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003038 .type = FIO_OPT_STR_STORE,
3039 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003040 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003041 .category = FIO_OPT_C_LOG,
3042 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003043 },
3044 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003045 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003046 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003047 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003048 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003049 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003050 .category = FIO_OPT_C_LOG,
3051 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003052 },
3053 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003054 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003055 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003056 .type = FIO_OPT_INT,
3057 .off1 = td_var_offset(log_avg_msec),
3058 .help = "Average bw/iops/lat logs over this period of time",
3059 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003060 .category = FIO_OPT_C_LOG,
3061 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003062 },
3063 {
Jens Axboec504ee52012-03-20 11:29:09 +01003064 .name = "bwavgtime",
3065 .lname = "Bandwidth average time",
3066 .type = FIO_OPT_INT,
3067 .off1 = td_var_offset(bw_avg_time),
3068 .help = "Time window over which to calculate bandwidth"
3069 " (msec)",
3070 .def = "500",
3071 .parent = "write_bw_log",
3072 .hide = 1,
3073 .interval = 100,
3074 .category = FIO_OPT_C_LOG,
3075 .group = FIO_OPT_G_INVALID,
3076 },
3077 {
3078 .name = "iopsavgtime",
3079 .lname = "IOPS average time",
3080 .type = FIO_OPT_INT,
3081 .off1 = td_var_offset(iops_avg_time),
3082 .help = "Time window over which to calculate IOPS (msec)",
3083 .def = "500",
3084 .parent = "write_iops_log",
3085 .hide = 1,
3086 .interval = 100,
3087 .category = FIO_OPT_C_LOG,
3088 .group = FIO_OPT_G_INVALID,
3089 },
3090 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003091 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003092 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003093 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003094 .off1 = td_var_offset(group_reporting),
3095 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003096 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003097 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003098 },
3099 {
Jens Axboee9459e52007-04-17 15:46:32 +02003100 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003101 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003102 .type = FIO_OPT_STR_SET,
3103 .off1 = td_var_offset(zero_buffers),
3104 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003105 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003106 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003107 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003108 {
3109 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003110 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003111 .type = FIO_OPT_STR_SET,
3112 .off1 = td_var_offset(refill_buffers),
3113 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003114 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003115 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003116 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003117 {
Jens Axboefd684182011-09-19 09:24:44 +02003118 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003119 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003120 .type = FIO_OPT_BOOL,
3121 .off1 = td_var_offset(scramble_buffers),
3122 .help = "Slightly scramble buffers on every IO submit",
3123 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003124 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003125 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003126 },
3127 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003128 .name = "buffer_pattern",
3129 .lname = "Buffer pattern",
3130 .type = FIO_OPT_STR,
3131 .cb = str_buffer_pattern_cb,
3132 .help = "Fill pattern for IO buffers",
3133 .category = FIO_OPT_C_IO,
3134 .group = FIO_OPT_G_IO_BUF,
3135 },
3136 {
Jens Axboe9c426842012-03-02 21:02:12 +01003137 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003138 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003139 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003140 .cb = str_buffer_compress_cb,
Jens Axboe9c426842012-03-02 21:02:12 +01003141 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003142 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003143 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003144 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003145 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003146 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003147 },
3148 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003149 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003150 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003151 .type = FIO_OPT_INT,
3152 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003153 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003154 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003155 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003156 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003157 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003158 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003159 },
3160 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003161 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003162 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003163 .type = FIO_OPT_BOOL,
3164 .off1 = td_var_offset(clat_percentiles),
3165 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003166 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003167 .category = FIO_OPT_C_STAT,
3168 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003169 },
3170 {
3171 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003172 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003173 .type = FIO_OPT_FLOAT_LIST,
3174 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003175 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003176 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003177 .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 +02003178 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3179 .minfp = 0.0,
3180 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003181 .category = FIO_OPT_C_STAT,
3182 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003183 },
3184
Jens Axboe0a839f32007-04-26 09:02:34 +02003185#ifdef FIO_HAVE_DISK_UTIL
3186 {
3187 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003188 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003189 .type = FIO_OPT_BOOL,
3190 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003191 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003192 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003193 .category = FIO_OPT_C_STAT,
3194 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003195 },
3196#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003197 {
Jens Axboe993bf482008-11-14 13:04:53 +01003198 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003199 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003200 .type = FIO_OPT_BOOL,
3201 .help = "Greatly reduce number of gettimeofday() calls",
3202 .cb = str_gtod_reduce_cb,
3203 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003204 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003205 .category = FIO_OPT_C_STAT,
3206 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003207 },
3208 {
Jens Axboe02af0982010-06-24 09:59:34 +02003209 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003210 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003211 .type = FIO_OPT_BOOL,
3212 .off1 = td_var_offset(disable_lat),
3213 .help = "Disable latency numbers",
3214 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003215 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003216 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003217 .category = FIO_OPT_C_STAT,
3218 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003219 },
3220 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003221 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003222 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003223 .type = FIO_OPT_BOOL,
3224 .off1 = td_var_offset(disable_clat),
3225 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003226 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003227 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003228 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003229 .category = FIO_OPT_C_STAT,
3230 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003231 },
3232 {
3233 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003234 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003235 .type = FIO_OPT_BOOL,
3236 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003237 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003238 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003239 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003240 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003241 .category = FIO_OPT_C_STAT,
3242 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003243 },
3244 {
3245 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003246 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003247 .type = FIO_OPT_BOOL,
3248 .off1 = td_var_offset(disable_bw),
3249 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003250 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003251 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003252 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003253 .category = FIO_OPT_C_STAT,
3254 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003255 },
3256 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003257 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003258 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003259 .type = FIO_OPT_INT,
3260 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003261 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003262 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003263 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003264 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003265 },
3266 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003267 .name = "unified_rw_reporting",
3268 .type = FIO_OPT_BOOL,
3269 .off1 = td_var_offset(unified_rw_rep),
3270 .help = "Unify reporting across data direction",
3271 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003272 .category = FIO_OPT_C_GENERAL,
3273 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003274 },
3275 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003276 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003277 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003278 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003279 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003280 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003281 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003282 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003283 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003284 .posval = {
3285 { .ival = "none",
3286 .oval = ERROR_TYPE_NONE,
3287 .help = "Exit when an error is encountered",
3288 },
3289 { .ival = "read",
3290 .oval = ERROR_TYPE_READ,
3291 .help = "Continue on read errors only",
3292 },
3293 { .ival = "write",
3294 .oval = ERROR_TYPE_WRITE,
3295 .help = "Continue on write errors only",
3296 },
3297 { .ival = "io",
3298 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3299 .help = "Continue on any IO errors",
3300 },
3301 { .ival = "verify",
3302 .oval = ERROR_TYPE_VERIFY,
3303 .help = "Continue on verify errors only",
3304 },
3305 { .ival = "all",
3306 .oval = ERROR_TYPE_ANY,
3307 .help = "Continue on all io and verify errors",
3308 },
3309 { .ival = "0",
3310 .oval = ERROR_TYPE_NONE,
3311 .help = "Alias for 'none'",
3312 },
3313 { .ival = "1",
3314 .oval = ERROR_TYPE_ANY,
3315 .help = "Alias for 'all'",
3316 },
3317 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003318 },
3319 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003320 .name = "ignore_error",
3321 .type = FIO_OPT_STR,
3322 .cb = str_ignore_error_cb,
3323 .help = "Set a specific list of errors to ignore",
3324 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003325 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003326 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003327 },
3328 {
3329 .name = "error_dump",
3330 .type = FIO_OPT_BOOL,
3331 .off1 = td_var_offset(error_dump),
3332 .def = "0",
3333 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003334 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003335 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003336 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003337 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003338 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003339 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003340 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003341 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003342 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003343 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003344 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003345 },
3346 {
Jens Axboea696fa22009-12-04 10:05:02 +01003347 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003348 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003349 .type = FIO_OPT_STR_STORE,
3350 .off1 = td_var_offset(cgroup),
3351 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003352 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003353 .group = FIO_OPT_G_CGROUP,
3354 },
3355 {
3356 .name = "cgroup_nodelete",
3357 .lname = "Cgroup no-delete",
3358 .type = FIO_OPT_BOOL,
3359 .off1 = td_var_offset(cgroup_nodelete),
3360 .help = "Do not delete cgroups after job completion",
3361 .def = "0",
3362 .parent = "cgroup",
3363 .category = FIO_OPT_C_GENERAL,
3364 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003365 },
3366 {
3367 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003368 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003369 .type = FIO_OPT_INT,
3370 .off1 = td_var_offset(cgroup_weight),
3371 .help = "Use given weight for cgroup",
3372 .minval = 100,
3373 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003374 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003375 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003376 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003377 },
3378 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003379 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003380 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003381 .type = FIO_OPT_INT,
3382 .off1 = td_var_offset(uid),
3383 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003384 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003385 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003386 },
3387 {
3388 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003389 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003390 .type = FIO_OPT_INT,
3391 .off1 = td_var_offset(gid),
3392 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003393 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003394 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003395 },
3396 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003397 .name = "kb_base",
3398 .lname = "KB Base",
3399 .type = FIO_OPT_INT,
3400 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003401 .prio = 1,
3402 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003403 .posval = {
3404 { .ival = "1024",
3405 .oval = 1024,
3406 .help = "Use 1024 as the K base",
3407 },
3408 { .ival = "1000",
3409 .oval = 1000,
3410 .help = "Use 1000 as the K base",
3411 },
3412 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003413 .help = "How many bytes per KB for reporting (1000 or 1024)",
3414 .category = FIO_OPT_C_GENERAL,
3415 .group = FIO_OPT_G_INVALID,
3416 },
3417 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003418 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003419 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003420 .type = FIO_OPT_INT,
3421 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003422 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003423 .posval = {
3424 { .ival = "0",
3425 .oval = 0,
3426 .help = "Auto-detect",
3427 },
3428 { .ival = "8",
3429 .oval = 8,
3430 .help = "Normal (byte based)",
3431 },
3432 { .ival = "1",
3433 .oval = 1,
3434 .help = "Bit based",
3435 },
3436 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003437 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3438 .category = FIO_OPT_C_GENERAL,
3439 .group = FIO_OPT_G_INVALID,
3440 },
3441 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003442 .name = "hugepage-size",
3443 .lname = "Hugepage size",
3444 .type = FIO_OPT_INT,
3445 .off1 = td_var_offset(hugepage_size),
3446 .help = "When using hugepages, specify size of each page",
3447 .def = __fio_stringify(FIO_HUGE_PAGE),
3448 .interval = 1024 * 1024,
3449 .category = FIO_OPT_C_GENERAL,
3450 .group = FIO_OPT_G_INVALID,
3451 },
3452 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003453 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003454 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003455 .type = FIO_OPT_INT,
3456 .off1 = td_var_offset(flow_id),
3457 .help = "The flow index ID to use",
3458 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003459 .category = FIO_OPT_C_IO,
3460 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003461 },
3462 {
3463 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003464 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003465 .type = FIO_OPT_INT,
3466 .off1 = td_var_offset(flow),
3467 .help = "Weight for flow control of this job",
3468 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003469 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003470 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003471 .category = FIO_OPT_C_IO,
3472 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003473 },
3474 {
3475 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003476 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003477 .type = FIO_OPT_INT,
3478 .off1 = td_var_offset(flow_watermark),
3479 .help = "High watermark for flow control. This option"
3480 " should be set to the same value for all threads"
3481 " with non-zero flow.",
3482 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003483 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003484 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003485 .category = FIO_OPT_C_IO,
3486 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003487 },
3488 {
3489 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003490 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003491 .type = FIO_OPT_INT,
3492 .off1 = td_var_offset(flow_sleep),
3493 .help = "How many microseconds to sleep after being held"
3494 " back by the flow control mechanism",
3495 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003496 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003497 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003498 .category = FIO_OPT_C_IO,
3499 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003500 },
3501 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003502 .name = NULL,
3503 },
3504};
3505
Jens Axboe17af15d2010-04-13 10:38:16 +02003506static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003507 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003508{
Jens Axboe17af15d2010-04-13 10:38:16 +02003509 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003510 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003511 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003512 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003513 else
3514 lopt->has_arg = required_argument;
3515}
3516
Steven Langde890a12011-11-09 14:03:34 +01003517static void options_to_lopts(struct fio_option *opts,
3518 struct option *long_options,
3519 int i, int option_type)
3520{
3521 struct fio_option *o = &opts[0];
3522 while (o->name) {
3523 add_to_lopt(&long_options[i], o, o->name, option_type);
3524 if (o->alias) {
3525 i++;
3526 add_to_lopt(&long_options[i], o, o->alias, option_type);
3527 }
3528
3529 i++;
3530 o++;
3531 assert(i < FIO_NR_OPTIONS);
3532 }
3533}
3534
3535void fio_options_set_ioengine_opts(struct option *long_options,
3536 struct thread_data *td)
3537{
3538 unsigned int i;
3539
3540 i = 0;
3541 while (long_options[i].name) {
3542 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3543 memset(&long_options[i], 0, sizeof(*long_options));
3544 break;
3545 }
3546 i++;
3547 }
3548
3549 /*
3550 * Just clear out the prior ioengine options.
3551 */
3552 if (!td || !td->eo)
3553 return;
3554
3555 options_to_lopts(td->io_ops->options, long_options, i,
3556 FIO_GETOPT_IOENGINE);
3557}
3558
Jens Axboe214e1ec2007-03-15 10:48:13 +01003559void fio_options_dup_and_init(struct option *long_options)
3560{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003561 unsigned int i;
3562
Jens Axboe9af4a242012-03-16 10:13:49 +01003563 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003564
3565 i = 0;
3566 while (long_options[i].name)
3567 i++;
3568
Jens Axboe9af4a242012-03-16 10:13:49 +01003569 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003570}
3571
Jens Axboe74929ac2009-08-05 11:42:37 +02003572struct fio_keyword {
3573 const char *word;
3574 const char *desc;
3575 char *replace;
3576};
3577
3578static struct fio_keyword fio_keywords[] = {
3579 {
3580 .word = "$pagesize",
3581 .desc = "Page size in the system",
3582 },
3583 {
3584 .word = "$mb_memory",
3585 .desc = "Megabytes of memory online",
3586 },
3587 {
3588 .word = "$ncpus",
3589 .desc = "Number of CPUs online in the system",
3590 },
3591 {
3592 .word = NULL,
3593 },
3594};
3595
3596void fio_keywords_init(void)
3597{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003598 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003599 char buf[128];
3600 long l;
3601
Jens Axboea4cfc472012-10-09 10:30:48 -06003602 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003603 fio_keywords[0].replace = strdup(buf);
3604
Jens Axboe8eb016d2011-07-11 10:24:20 +02003605 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003606 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003607 fio_keywords[1].replace = strdup(buf);
3608
Jens Axboec00a2282011-07-08 20:56:06 +02003609 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003610 sprintf(buf, "%lu", l);
3611 fio_keywords[2].replace = strdup(buf);
3612}
3613
Jens Axboe892a6ff2009-11-13 12:19:49 +01003614#define BC_APP "bc"
3615
3616static char *bc_calc(char *str)
3617{
Steven Langd0c814e2011-10-28 08:37:13 +02003618 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003619 FILE *f;
3620 int ret;
3621
3622 /*
3623 * No math, just return string
3624 */
Steven Langd0c814e2011-10-28 08:37:13 +02003625 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3626 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003627 return str;
3628
3629 /*
3630 * Split option from value, we only need to calculate the value
3631 */
3632 tmp = strchr(str, '=');
3633 if (!tmp)
3634 return str;
3635
3636 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003637
Steven Langd0c814e2011-10-28 08:37:13 +02003638 /*
3639 * Prevent buffer overflows; such a case isn't reasonable anyway
3640 */
3641 if (strlen(str) >= 128 || strlen(tmp) > 100)
3642 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003643
3644 sprintf(buf, "which %s > /dev/null", BC_APP);
3645 if (system(buf)) {
3646 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003647 return NULL;
3648 }
3649
Steven Langd0c814e2011-10-28 08:37:13 +02003650 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003651 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003652 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003653 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003654
Steven Langd0c814e2011-10-28 08:37:13 +02003655 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe3c3ed072012-03-27 09:12:39 +02003656 if (ret <= 0)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003657 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003658
Jens Axboe892a6ff2009-11-13 12:19:49 +01003659 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003660 buf[(tmp - str) + ret - 1] = '\0';
3661 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003662 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003663 return strdup(buf);
3664}
3665
3666/*
3667 * Return a copy of the input string with substrings of the form ${VARNAME}
3668 * substituted with the value of the environment variable VARNAME. The
3669 * substitution always occurs, even if VARNAME is empty or the corresponding
3670 * environment variable undefined.
3671 */
3672static char *option_dup_subs(const char *opt)
3673{
3674 char out[OPT_LEN_MAX+1];
3675 char in[OPT_LEN_MAX+1];
3676 char *outptr = out;
3677 char *inptr = in;
3678 char *ch1, *ch2, *env;
3679 ssize_t nchr = OPT_LEN_MAX;
3680 size_t envlen;
3681
3682 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3683 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3684 return NULL;
3685 }
3686
3687 in[OPT_LEN_MAX] = '\0';
3688 strncpy(in, opt, OPT_LEN_MAX);
3689
3690 while (*inptr && nchr > 0) {
3691 if (inptr[0] == '$' && inptr[1] == '{') {
3692 ch2 = strchr(inptr, '}');
3693 if (ch2 && inptr+1 < ch2) {
3694 ch1 = inptr+2;
3695 inptr = ch2+1;
3696 *ch2 = '\0';
3697
3698 env = getenv(ch1);
3699 if (env) {
3700 envlen = strlen(env);
3701 if (envlen <= nchr) {
3702 memcpy(outptr, env, envlen);
3703 outptr += envlen;
3704 nchr -= envlen;
3705 }
3706 }
3707
3708 continue;
3709 }
3710 }
3711
3712 *outptr++ = *inptr++;
3713 --nchr;
3714 }
3715
3716 *outptr = '\0';
3717 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003718}
3719
Jens Axboe74929ac2009-08-05 11:42:37 +02003720/*
3721 * Look for reserved variable names and replace them with real values
3722 */
3723static char *fio_keyword_replace(char *opt)
3724{
3725 char *s;
3726 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003727 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003728
3729 for (i = 0; fio_keywords[i].word != NULL; i++) {
3730 struct fio_keyword *kw = &fio_keywords[i];
3731
3732 while ((s = strstr(opt, kw->word)) != NULL) {
3733 char *new = malloc(strlen(opt) + 1);
3734 char *o_org = opt;
3735 int olen = s - opt;
3736 int len;
3737
3738 /*
3739 * Copy part of the string before the keyword and
3740 * sprintf() the replacement after it.
3741 */
3742 memcpy(new, opt, olen);
3743 len = sprintf(new + olen, "%s", kw->replace);
3744
3745 /*
3746 * If there's more in the original string, copy that
3747 * in too
3748 */
3749 opt += strlen(kw->word) + olen;
3750 if (strlen(opt))
3751 memcpy(new + olen + len, opt, opt - o_org - 1);
3752
3753 /*
3754 * replace opt and free the old opt
3755 */
3756 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003757 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003758
Steven Langd0c814e2011-10-28 08:37:13 +02003759 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003760 }
3761 }
3762
Steven Langd0c814e2011-10-28 08:37:13 +02003763 /*
3764 * Check for potential math and invoke bc, if possible
3765 */
3766 if (docalc)
3767 opt = bc_calc(opt);
3768
Jens Axboe7a958bd2009-11-13 12:33:54 +01003769 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003770}
3771
Steven Langd0c814e2011-10-28 08:37:13 +02003772static char **dup_and_sub_options(char **opts, int num_opts)
3773{
3774 int i;
3775 char **opts_copy = malloc(num_opts * sizeof(*opts));
3776 for (i = 0; i < num_opts; i++) {
3777 opts_copy[i] = option_dup_subs(opts[i]);
3778 if (!opts_copy[i])
3779 continue;
3780 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3781 }
3782 return opts_copy;
3783}
3784
Jens Axboe292cc472013-11-26 20:39:35 -07003785int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3786 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003787{
Steven Langde890a12011-11-09 14:03:34 +01003788 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003789 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003790
Jens Axboe9af4a242012-03-16 10:13:49 +01003791 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003792 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003793
Steven Langde890a12011-11-09 14:03:34 +01003794 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3795 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003796 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003797 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003798
Steven Langde890a12011-11-09 14:03:34 +01003799 if (opts_copy[i]) {
3800 if (newret && !o) {
3801 unknown++;
3802 continue;
3803 }
Steven Langd0c814e2011-10-28 08:37:13 +02003804 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003805 opts_copy[i] = NULL;
3806 }
3807
3808 ret |= newret;
3809 }
3810
3811 if (unknown) {
3812 ret |= ioengine_load(td);
3813 if (td->eo) {
3814 sort_options(opts_copy, td->io_ops->options, num_opts);
3815 opts = opts_copy;
3816 }
3817 for (i = 0; i < num_opts; i++) {
3818 struct fio_option *o = NULL;
3819 int newret = 1;
3820 if (!opts_copy[i])
3821 continue;
3822
3823 if (td->eo)
3824 newret = parse_option(opts_copy[i], opts[i],
3825 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003826 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003827
3828 ret |= newret;
3829 if (!o)
3830 log_err("Bad option <%s>\n", opts[i]);
3831
3832 free(opts_copy[i]);
3833 opts_copy[i] = NULL;
3834 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003835 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003836
Steven Langd0c814e2011-10-28 08:37:13 +02003837 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003838 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003839}
3840
3841int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3842{
Jens Axboe9af4a242012-03-16 10:13:49 +01003843 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003844}
3845
Steven Langde890a12011-11-09 14:03:34 +01003846int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3847 char *val)
3848{
Akinobu Mita8a96c802013-10-09 09:32:34 -06003849 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01003850}
3851
Jens Axboe214e1ec2007-03-15 10:48:13 +01003852void fio_fill_default_options(struct thread_data *td)
3853{
Jens Axboecb1402d2014-02-25 11:35:27 -08003854 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01003855 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003856}
3857
3858int fio_show_option_help(const char *opt)
3859{
Jens Axboe9af4a242012-03-16 10:13:49 +01003860 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003861}
Jens Axboed23bb322007-03-23 15:57:56 +01003862
Steven Langde890a12011-11-09 14:03:34 +01003863void options_mem_dupe(void *data, struct fio_option *options)
3864{
3865 struct fio_option *o;
3866 char **ptr;
3867
3868 for (o = &options[0]; o->name; o++) {
3869 if (o->type != FIO_OPT_STR_STORE)
3870 continue;
3871
Jens Axboef0fdbca2014-02-11 15:44:50 -07003872 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01003873 if (*ptr)
3874 *ptr = strdup(*ptr);
3875 }
3876}
3877
Jens Axboe7e356b22011-10-14 10:55:16 +02003878/*
3879 * dupe FIO_OPT_STR_STORE options
3880 */
Steven Langde890a12011-11-09 14:03:34 +01003881void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003882{
Jens Axboe9af4a242012-03-16 10:13:49 +01003883 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003884
3885 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003886 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003887
Steven Langde890a12011-11-09 14:03:34 +01003888 td->eo = malloc(td->io_ops->option_struct_size);
3889 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3890 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003891 }
3892}
3893
Jens Axboed6978a32009-07-18 21:04:09 +02003894unsigned int fio_get_kb_base(void *data)
3895{
Jens Axboe83ea4222012-03-28 14:01:46 +02003896 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02003897 unsigned int kb_base = 0;
3898
Jens Axboecb1402d2014-02-25 11:35:27 -08003899 /*
3900 * This is a hack... For private options, *data is not holding
3901 * a pointer to the thread_options, but to private data. This means
3902 * we can't safely dereference it, but magic is first so mem wise
3903 * it is valid. But this also means that if the job first sets
3904 * kb_base and expects that to be honored by private options,
3905 * it will be disappointed. We will return the global default
3906 * for this.
3907 */
3908 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02003909 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02003910 if (!kb_base)
3911 kb_base = 1024;
3912
3913 return kb_base;
3914}
Jens Axboe9f988e22010-03-04 10:42:38 +01003915
Jens Axboe07b32322010-03-05 09:48:44 +01003916int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003917{
Jens Axboe07b32322010-03-05 09:48:44 +01003918 struct fio_option *__o;
3919 int opt_index = 0;
3920
Jens Axboe9af4a242012-03-16 10:13:49 +01003921 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003922 while (__o->name) {
3923 opt_index++;
3924 __o++;
3925 }
3926
Jens Axboe7b504ed2014-02-11 14:19:38 -07003927 if (opt_index + 1 == FIO_MAX_OPTS) {
3928 log_err("fio: FIO_MAX_OPTS is too small\n");
3929 return 1;
3930 }
3931
Jens Axboe9af4a242012-03-16 10:13:49 +01003932 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07003933 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01003934 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01003935}
Jens Axboee2de69d2010-03-04 14:05:48 +01003936
Jens Axboe07b32322010-03-05 09:48:44 +01003937void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01003938{
Jens Axboe07b32322010-03-05 09:48:44 +01003939 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01003940
Jens Axboe9af4a242012-03-16 10:13:49 +01003941 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003942 while (o->name) {
3943 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3944 o->type = FIO_OPT_INVALID;
3945 o->prof_name = NULL;
3946 }
3947 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01003948 }
3949}
Jens Axboef5b6bb82010-03-05 10:09:59 +01003950
3951void add_opt_posval(const char *optname, const char *ival, const char *help)
3952{
3953 struct fio_option *o;
3954 unsigned int i;
3955
Jens Axboe9af4a242012-03-16 10:13:49 +01003956 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003957 if (!o)
3958 return;
3959
3960 for (i = 0; i < PARSE_MAX_VP; i++) {
3961 if (o->posval[i].ival)
3962 continue;
3963
3964 o->posval[i].ival = ival;
3965 o->posval[i].help = help;
3966 break;
3967 }
3968}
3969
3970void del_opt_posval(const char *optname, const char *ival)
3971{
3972 struct fio_option *o;
3973 unsigned int i;
3974
Jens Axboe9af4a242012-03-16 10:13:49 +01003975 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01003976 if (!o)
3977 return;
3978
3979 for (i = 0; i < PARSE_MAX_VP; i++) {
3980 if (!o->posval[i].ival)
3981 continue;
3982 if (strcmp(o->posval[i].ival, ival))
3983 continue;
3984
3985 o->posval[i].ival = NULL;
3986 o->posval[i].help = NULL;
3987 }
3988}
Jens Axboe7e356b22011-10-14 10:55:16 +02003989
3990void fio_options_free(struct thread_data *td)
3991{
Jens Axboe9af4a242012-03-16 10:13:49 +01003992 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01003993 if (td->eo && td->io_ops && td->io_ops->options) {
3994 options_free(td->io_ops->options, td->eo);
3995 free(td->eo);
3996 td->eo = NULL;
3997 }
Jens Axboe7e356b22011-10-14 10:55:16 +02003998}
Jens Axboec504ee52012-03-20 11:29:09 +01003999
4000struct fio_option *fio_option_find(const char *name)
4001{
4002 return find_option(fio_options, name);
4003}
4004