blob: 3a3321f7b9d6a3d9b0b5bbf4b8da1d283182c3e3 [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)
Jens Axboe1616e022014-04-14 08:59:17 -0600272 error[i] = -error[i];
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400273 }
274 if (!error[i]) {
275 log_err("Unknown error %s, please use number value \n",
276 fname);
Erwan Velu0fddbf72013-07-22 23:46:10 +0200277 free(error);
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400278 return 1;
279 }
280 i++;
281 }
282 if (i) {
283 td->o.continue_on_error |= 1 << etype;
284 td->o.ignore_error_nr[etype] = i;
285 td->o.ignore_error[etype] = error;
Jens Axboec7b086b2014-04-11 11:20:29 -0600286 } else
287 free(error);
288
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400289 return 0;
290
291}
292
293static int str_ignore_error_cb(void *data, const char *input)
294{
295 struct thread_data *td = data;
296 char *str, *p, *n;
297 int type = 0, ret = 1;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600298
299 if (parse_dryrun())
300 return 0;
301
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +0400302 p = str = strdup(input);
303
304 strip_blank_front(&str);
305 strip_blank_end(str);
306
307 while (p) {
308 n = strchr(p, ',');
309 if (n)
310 *n++ = '\0';
311 ret = ignore_error_type(td, type, p);
312 if (ret)
313 break;
314 p = n;
315 type++;
316 }
317 free(str);
318 return ret;
319}
320
Jens Axboe211097b2007-03-22 18:56:45 +0100321static int str_rw_cb(void *data, const char *str)
322{
323 struct thread_data *td = data;
Jens Axboe83ea4222012-03-28 14:01:46 +0200324 struct thread_options *o = &td->o;
Jens Axboe27ca9492014-04-11 11:25:32 -0600325 char *nr;
Jens Axboe211097b2007-03-22 18:56:45 +0100326
Jens Axboe52c0cea2013-09-06 10:07:37 -0600327 if (parse_dryrun())
328 return 0;
329
Jens Axboe83ea4222012-03-28 14:01:46 +0200330 o->ddir_seq_nr = 1;
331 o->ddir_seq_add = 0;
Jens Axboe059b0802011-08-25 09:09:37 +0200332
Jens Axboe27ca9492014-04-11 11:25:32 -0600333 nr = get_opt_postfix(str);
Jens Axboe059b0802011-08-25 09:09:37 +0200334 if (!nr)
335 return 0;
336
337 if (td_random(td))
Jens Axboe83ea4222012-03-28 14:01:46 +0200338 o->ddir_seq_nr = atoi(nr);
Jens Axboe059b0802011-08-25 09:09:37 +0200339 else {
340 long long val;
341
Jens Axboe0de5b262014-02-21 15:26:01 -0800342 if (str_to_decimal(nr, &val, 1, o, 0)) {
Jens Axboe059b0802011-08-25 09:09:37 +0200343 log_err("fio: rw postfix parsing failed\n");
344 free(nr);
345 return 1;
346 }
347
Jens Axboe83ea4222012-03-28 14:01:46 +0200348 o->ddir_seq_add = val;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100349 }
Jens Axboe211097b2007-03-22 18:56:45 +0100350
Jens Axboe059b0802011-08-25 09:09:37 +0200351 free(nr);
Jens Axboe211097b2007-03-22 18:56:45 +0100352 return 0;
353}
354
Jens Axboe214e1ec2007-03-15 10:48:13 +0100355static int str_mem_cb(void *data, const char *mem)
356{
357 struct thread_data *td = data;
358
Shaohua Lid9759b12013-01-17 13:28:15 +0100359 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
Jens Axboe836fcc02013-01-24 09:08:45 -0700360 td->o.mmapfile = get_opt_postfix(mem);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100361
362 return 0;
363}
364
Jens Axboec223da82010-03-24 13:23:53 +0100365static int fio_clock_source_cb(void *data, const char *str)
366{
367 struct thread_data *td = data;
368
369 fio_clock_source = td->o.clocksource;
Jens Axboefa80fea2012-12-09 20:29:00 +0100370 fio_clock_source_set = 1;
Jens Axboe01423ea2012-12-14 20:37:06 +0100371 fio_clock_init();
Jens Axboec223da82010-03-24 13:23:53 +0100372 return 0;
373}
374
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400375static int str_rwmix_read_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200376{
377 struct thread_data *td = data;
378
379 td->o.rwmix[DDIR_READ] = *val;
380 td->o.rwmix[DDIR_WRITE] = 100 - *val;
381 return 0;
382}
383
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400384static int str_rwmix_write_cb(void *data, unsigned long long *val)
Jens Axboecb499fc2008-05-28 10:33:32 +0200385{
386 struct thread_data *td = data;
387
388 td->o.rwmix[DDIR_WRITE] = *val;
389 td->o.rwmix[DDIR_READ] = 100 - *val;
390 return 0;
391}
392
Jens Axboe214e1ec2007-03-15 10:48:13 +0100393static int str_exitall_cb(void)
394{
395 exitall_on_terminate = 1;
396 return 0;
397}
398
Jens Axboe214e1ec2007-03-15 10:48:13 +0100399#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe50b58602014-02-28 15:08:25 -0800400int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
Jens Axboec2acfba2014-02-27 15:52:02 -0800401{
Jens Axboe50b58602014-02-28 15:08:25 -0800402 unsigned int i, index, cpus_in_mask;
Jens Axboec2acfba2014-02-27 15:52:02 -0800403 const long max_cpu = cpus_online();
Jens Axboec2acfba2014-02-27 15:52:02 -0800404
Jens Axboe50b58602014-02-28 15:08:25 -0800405 cpus_in_mask = fio_cpu_count(mask);
406 cpu_index = cpu_index % cpus_in_mask;
407
408 index = 0;
Jens Axboec2acfba2014-02-27 15:52:02 -0800409 for (i = 0; i < max_cpu; i++) {
Jens Axboe50b58602014-02-28 15:08:25 -0800410 if (!fio_cpu_isset(mask, i))
Jens Axboec2acfba2014-02-27 15:52:02 -0800411 continue;
Jens Axboe50b58602014-02-28 15:08:25 -0800412
413 if (cpu_index != index)
414 fio_cpu_clear(mask, i);
415
416 index++;
Jens Axboec2acfba2014-02-27 15:52:02 -0800417 }
418
419 return fio_cpu_count(mask);
420}
421
Cigy Cyriac85bc8332010-08-10 19:21:09 -0400422static int str_cpumask_cb(void *data, unsigned long long *val)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100423{
424 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200425 unsigned int i;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100426 long max_cpu;
Jens Axboed2ce18b2008-12-12 20:51:40 +0100427 int ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100428
Jens Axboe52c0cea2013-09-06 10:07:37 -0600429 if (parse_dryrun())
430 return 0;
431
Jens Axboed2ce18b2008-12-12 20:51:40 +0100432 ret = fio_cpuset_init(&td->o.cpumask);
433 if (ret < 0) {
434 log_err("fio: cpuset_init failed\n");
435 td_verror(td, ret, "fio_cpuset_init");
436 return 1;
437 }
438
Jens Axboec00a2282011-07-08 20:56:06 +0200439 max_cpu = cpus_online();
Jens Axboed2e268b2007-06-15 10:33:49 +0200440
Jens Axboe62a72732008-12-08 11:37:01 +0100441 for (i = 0; i < sizeof(int) * 8; i++) {
442 if ((1 << i) & *val) {
Jens Axboeb03daaf2008-12-08 20:31:43 +0100443 if (i > max_cpu) {
444 log_err("fio: CPU %d too large (max=%ld)\n", i,
445 max_cpu);
446 return 1;
447 }
Jens Axboe62a72732008-12-08 11:37:01 +0100448 dprint(FD_PARSE, "set cpu allowed %d\n", i);
Jens Axboe6d459ee2008-12-12 20:02:58 +0100449 fio_cpu_set(&td->o.cpumask, i);
Jens Axboe62a72732008-12-08 11:37:01 +0100450 }
451 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200452
Jens Axboe375b2692007-05-22 09:13:02 +0200453 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100454 return 0;
455}
456
Jens Axboee8462bd2009-07-06 12:59:04 +0200457static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
458 const char *input)
Jens Axboed2e268b2007-06-15 10:33:49 +0200459{
Jens Axboed2e268b2007-06-15 10:33:49 +0200460 char *cpu, *str, *p;
Jens Axboeb03daaf2008-12-08 20:31:43 +0100461 long max_cpu;
Jens Axboe19608d62008-12-08 15:03:12 +0100462 int ret = 0;
Jens Axboed2e268b2007-06-15 10:33:49 +0200463
Jens Axboee8462bd2009-07-06 12:59:04 +0200464 ret = fio_cpuset_init(mask);
Jens Axboed2ce18b2008-12-12 20:51:40 +0100465 if (ret < 0) {
466 log_err("fio: cpuset_init failed\n");
467 td_verror(td, ret, "fio_cpuset_init");
468 return 1;
469 }
Jens Axboed2e268b2007-06-15 10:33:49 +0200470
471 p = str = strdup(input);
472
473 strip_blank_front(&str);
474 strip_blank_end(str);
475
Jens Axboec00a2282011-07-08 20:56:06 +0200476 max_cpu = cpus_online();
Jens Axboeb03daaf2008-12-08 20:31:43 +0100477
Jens Axboed2e268b2007-06-15 10:33:49 +0200478 while ((cpu = strsep(&str, ",")) != NULL) {
Jens Axboe62a72732008-12-08 11:37:01 +0100479 char *str2, *cpu2;
480 int icpu, icpu2;
481
Jens Axboed2e268b2007-06-15 10:33:49 +0200482 if (!strlen(cpu))
483 break;
Jens Axboe62a72732008-12-08 11:37:01 +0100484
485 str2 = cpu;
486 icpu2 = -1;
487 while ((cpu2 = strsep(&str2, "-")) != NULL) {
488 if (!strlen(cpu2))
489 break;
490
491 icpu2 = atoi(cpu2);
492 }
493
494 icpu = atoi(cpu);
495 if (icpu2 == -1)
496 icpu2 = icpu;
497 while (icpu <= icpu2) {
Jens Axboe6d459ee2008-12-12 20:02:58 +0100498 if (icpu >= FIO_MAX_CPUS) {
Jens Axboe19608d62008-12-08 15:03:12 +0100499 log_err("fio: your OS only supports up to"
Jens Axboe6d459ee2008-12-12 20:02:58 +0100500 " %d CPUs\n", (int) FIO_MAX_CPUS);
Jens Axboe19608d62008-12-08 15:03:12 +0100501 ret = 1;
502 break;
503 }
Jens Axboeb03daaf2008-12-08 20:31:43 +0100504 if (icpu > max_cpu) {
505 log_err("fio: CPU %d too large (max=%ld)\n",
506 icpu, max_cpu);
507 ret = 1;
508 break;
509 }
Jens Axboe0b9d69e2009-09-11 22:29:54 +0200510
Jens Axboe62a72732008-12-08 11:37:01 +0100511 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
Jens Axboee8462bd2009-07-06 12:59:04 +0200512 fio_cpu_set(mask, icpu);
Jens Axboe62a72732008-12-08 11:37:01 +0100513 icpu++;
514 }
Jens Axboe19608d62008-12-08 15:03:12 +0100515 if (ret)
516 break;
Jens Axboed2e268b2007-06-15 10:33:49 +0200517 }
518
519 free(p);
Jens Axboe19608d62008-12-08 15:03:12 +0100520 if (!ret)
521 td->o.cpumask_set = 1;
522 return ret;
Jens Axboed2e268b2007-06-15 10:33:49 +0200523}
Jens Axboee8462bd2009-07-06 12:59:04 +0200524
525static int str_cpus_allowed_cb(void *data, const char *input)
526{
527 struct thread_data *td = data;
528 int ret;
529
Jens Axboe52c0cea2013-09-06 10:07:37 -0600530 if (parse_dryrun())
531 return 0;
532
Jens Axboee8462bd2009-07-06 12:59:04 +0200533 ret = set_cpus_allowed(td, &td->o.cpumask, input);
534 if (!ret)
535 td->o.cpumask_set = 1;
536
537 return ret;
538}
539
540static int str_verify_cpus_allowed_cb(void *data, const char *input)
541{
542 struct thread_data *td = data;
543 int ret;
544
545 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
546 if (!ret)
547 td->o.verify_cpumask_set = 1;
548
549 return ret;
550}
Jens Axboed2e268b2007-06-15 10:33:49 +0200551#endif
552
Jens Axboe67bf9822013-01-10 11:23:19 +0100553#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -0400554static int str_numa_cpunodes_cb(void *data, char *input)
555{
556 struct thread_data *td = data;
Daniel Gollub43522842014-05-01 17:07:49 +0200557 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400558
Jens Axboe52c0cea2013-09-06 10:07:37 -0600559 if (parse_dryrun())
560 return 0;
561
Yufei Rend0b937e2012-10-19 23:11:52 -0400562 /* numa_parse_nodestring() parses a character string list
563 * of nodes into a bit mask. The bit mask is allocated by
564 * numa_allocate_nodemask(), so it should be freed by
565 * numa_free_nodemask().
566 */
Daniel Gollub43522842014-05-01 17:07:49 +0200567 verify_bitmask = numa_parse_nodestring(input);
568 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400569 log_err("fio: numa_parse_nodestring failed\n");
570 td_verror(td, 1, "str_numa_cpunodes_cb");
571 return 1;
572 }
Daniel Gollub43522842014-05-01 17:07:49 +0200573 numa_free_nodemask(verify_bitmask);
Yufei Rend0b937e2012-10-19 23:11:52 -0400574
Daniel Gollub43522842014-05-01 17:07:49 +0200575 td->o.numa_cpunodes = strdup(input);
Yufei Rend0b937e2012-10-19 23:11:52 -0400576 td->o.numa_cpumask_set = 1;
577 return 0;
578}
579
580static int str_numa_mpol_cb(void *data, char *input)
581{
582 struct thread_data *td = data;
583 const char * const policy_types[] =
Jens Axboe05d6f442013-07-17 16:15:31 -0600584 { "default", "prefer", "bind", "interleave", "local", NULL };
Yufei Rend0b937e2012-10-19 23:11:52 -0400585 int i;
Jens Axboe52c0cea2013-09-06 10:07:37 -0600586 char *nodelist;
Daniel Gollub43522842014-05-01 17:07:49 +0200587 struct bitmask *verify_bitmask;
Yufei Rend0b937e2012-10-19 23:11:52 -0400588
Jens Axboe52c0cea2013-09-06 10:07:37 -0600589 if (parse_dryrun())
590 return 0;
591
592 nodelist = strchr(input, ':');
Yufei Rend0b937e2012-10-19 23:11:52 -0400593 if (nodelist) {
594 /* NUL-terminate mode */
595 *nodelist++ = '\0';
596 }
597
598 for (i = 0; i <= MPOL_LOCAL; i++) {
599 if (!strcmp(input, policy_types[i])) {
600 td->o.numa_mem_mode = i;
601 break;
602 }
603 }
604 if (i > MPOL_LOCAL) {
605 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
606 goto out;
607 }
608
609 switch (td->o.numa_mem_mode) {
610 case MPOL_PREFERRED:
611 /*
612 * Insist on a nodelist of one node only
613 */
614 if (nodelist) {
615 char *rest = nodelist;
616 while (isdigit(*rest))
617 rest++;
618 if (*rest) {
619 log_err("fio: one node only for \'prefer\'\n");
620 goto out;
621 }
622 } else {
623 log_err("fio: one node is needed for \'prefer\'\n");
624 goto out;
625 }
626 break;
627 case MPOL_INTERLEAVE:
628 /*
629 * Default to online nodes with memory if no nodelist
630 */
631 if (!nodelist)
632 nodelist = strdup("all");
633 break;
634 case MPOL_LOCAL:
635 case MPOL_DEFAULT:
636 /*
637 * Don't allow a nodelist
638 */
639 if (nodelist) {
640 log_err("fio: NO nodelist for \'local\'\n");
641 goto out;
642 }
643 break;
644 case MPOL_BIND:
645 /*
646 * Insist on a nodelist
647 */
648 if (!nodelist) {
649 log_err("fio: a nodelist is needed for \'bind\'\n");
650 goto out;
651 }
652 break;
653 }
654
655
656 /* numa_parse_nodestring() parses a character string list
657 * of nodes into a bit mask. The bit mask is allocated by
658 * numa_allocate_nodemask(), so it should be freed by
659 * numa_free_nodemask().
660 */
661 switch (td->o.numa_mem_mode) {
662 case MPOL_PREFERRED:
663 td->o.numa_mem_prefer_node = atoi(nodelist);
664 break;
665 case MPOL_INTERLEAVE:
666 case MPOL_BIND:
Daniel Gollub43522842014-05-01 17:07:49 +0200667 verify_bitmask = numa_parse_nodestring(nodelist);
668 if (verify_bitmask == NULL) {
Yufei Rend0b937e2012-10-19 23:11:52 -0400669 log_err("fio: numa_parse_nodestring failed\n");
670 td_verror(td, 1, "str_numa_memnodes_cb");
671 return 1;
672 }
Daniel Gollub43522842014-05-01 17:07:49 +0200673 td->o.numa_memnodes = strdup(nodelist);
674 numa_free_nodemask(verify_bitmask);
675
Yufei Rend0b937e2012-10-19 23:11:52 -0400676 break;
677 case MPOL_LOCAL:
678 case MPOL_DEFAULT:
679 default:
680 break;
681 }
682
683 td->o.numa_memmask_set = 1;
684 return 0;
685
686out:
687 return 1;
688}
689#endif
690
Jens Axboe214e1ec2007-03-15 10:48:13 +0100691static int str_fst_cb(void *data, const char *str)
692{
693 struct thread_data *td = data;
694 char *nr = get_opt_postfix(str);
695
696 td->file_service_nr = 1;
Jens Axboe182ec6e2008-11-14 13:06:06 +0100697 if (nr) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100698 td->file_service_nr = atoi(nr);
Jens Axboe182ec6e2008-11-14 13:06:06 +0100699 free(nr);
700 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100701
702 return 0;
703}
704
Jens Axboe67bf9822013-01-10 11:23:19 +0100705#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +0100706static int str_sfr_cb(void *data, const char *str)
707{
708 struct thread_data *td = data;
709 char *nr = get_opt_postfix(str);
710
711 td->sync_file_range_nr = 1;
712 if (nr) {
713 td->sync_file_range_nr = atoi(nr);
714 free(nr);
715 }
716
717 return 0;
718}
Jens Axboe3ae06372010-03-19 19:17:15 +0100719#endif
Jens Axboe44f29692010-03-09 20:09:44 +0100720
Jens Axboee25839d2012-11-06 10:49:42 +0100721static int str_random_distribution_cb(void *data, const char *str)
722{
723 struct thread_data *td = data;
724 double val;
725 char *nr;
726
Jens Axboe52c0cea2013-09-06 10:07:37 -0600727 if (parse_dryrun())
728 return 0;
729
Jens Axboe925fee32012-11-06 13:50:32 +0100730 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
731 val = 1.1;
732 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
733 val = 0.2;
734 else
Jens Axboee25839d2012-11-06 10:49:42 +0100735 return 0;
736
737 nr = get_opt_postfix(str);
Jens Axboe925fee32012-11-06 13:50:32 +0100738 if (nr && !str_to_float(nr, &val)) {
Jens Axboee25839d2012-11-06 10:49:42 +0100739 log_err("fio: random postfix parsing failed\n");
740 free(nr);
741 return 1;
742 }
743
Jens Axboe078189c2012-11-07 13:47:22 +0100744 free(nr);
745
Jens Axboe18ded912012-11-08 08:36:00 +0100746 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
747 if (val == 1.00) {
748 log_err("fio: zipf theta must different than 1.0\n");
749 return 1;
750 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700751 td->o.zipf_theta.u.f = val;
Jens Axboe18ded912012-11-08 08:36:00 +0100752 } else {
Jens Axboe078189c2012-11-07 13:47:22 +0100753 if (val <= 0.00 || val >= 1.00) {
754 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
755 return 1;
756 }
Jens Axboe1e5324e2012-11-14 14:25:31 -0700757 td->o.pareto_h.u.f = val;
Jens Axboe078189c2012-11-07 13:47:22 +0100758 }
Jens Axboe925fee32012-11-06 13:50:32 +0100759
Jens Axboee25839d2012-11-06 10:49:42 +0100760 return 0;
761}
762
Jens Axboe8e827d32009-08-04 09:51:48 +0200763/*
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800764 * Return next name in the string. Files are separated with ':'. If the ':'
Jens Axboe8e827d32009-08-04 09:51:48 +0200765 * is escaped with a '\', then that ':' is part of the filename and does not
766 * indicate a new file.
767 */
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800768static char *get_next_name(char **ptr)
Jens Axboe8e827d32009-08-04 09:51:48 +0200769{
770 char *str = *ptr;
771 char *p, *start;
772
773 if (!str || !strlen(str))
774 return NULL;
775
776 start = str;
777 do {
778 /*
779 * No colon, we are done
780 */
781 p = strchr(str, ':');
782 if (!p) {
783 *ptr = NULL;
784 break;
785 }
786
787 /*
788 * We got a colon, but it's the first character. Skip and
789 * continue
790 */
791 if (p == start) {
792 str = ++start;
793 continue;
794 }
795
796 if (*(p - 1) != '\\') {
797 *p = '\0';
798 *ptr = p + 1;
799 break;
800 }
801
802 memmove(p - 1, p, strlen(p) + 1);
803 str = p;
804 } while (1);
805
806 return start;
807}
808
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800809
810static int get_max_name_idx(char *input)
811{
812 unsigned int cur_idx;
813 char *str, *p;
814
815 p = str = strdup(input);
816 for (cur_idx = 0; ; cur_idx++)
817 if (get_next_name(&str) == NULL)
818 break;
819
820 free(p);
821 return cur_idx;
822}
823
824/*
825 * Returns the directory at the index, indexes > entires will be
826 * assigned via modulo division of the index
827 */
828int set_name_idx(char *target, char *input, int index)
829{
830 unsigned int cur_idx;
831 int len;
832 char *fname, *str, *p;
833
834 p = str = strdup(input);
835
836 index %= get_max_name_idx(input);
837 for (cur_idx = 0; cur_idx <= index; cur_idx++)
838 fname = get_next_name(&str);
839
840 len = sprintf(target, "%s/", fname);
841 free(p);
842
843 return len;
844}
845
Jens Axboe214e1ec2007-03-15 10:48:13 +0100846static int str_filename_cb(void *data, const char *input)
847{
848 struct thread_data *td = data;
849 char *fname, *str, *p;
850
851 p = str = strdup(input);
852
853 strip_blank_front(&str);
854 strip_blank_end(str);
855
856 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100857 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100858
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800859 while ((fname = get_next_name(&str)) != NULL) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100860 if (!strlen(fname))
861 break;
Jens Axboe5903e7b2014-02-26 13:42:13 -0800862 add_file(td, fname, 0, 1);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100863 }
864
865 free(p);
866 return 0;
867}
868
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800869static int str_directory_cb(void *data, const char fio_unused *unused)
Jens Axboe214e1ec2007-03-15 10:48:13 +0100870{
871 struct thread_data *td = data;
872 struct stat sb;
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800873 char *dirname, *str, *p;
874 int ret = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100875
Jens Axboef9633d72013-09-06 09:59:56 -0600876 if (parse_dryrun())
877 return 0;
878
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800879 p = str = strdup(td->o.directory);
880 while ((dirname = get_next_name(&str)) != NULL) {
881 if (lstat(dirname, &sb) < 0) {
882 ret = errno;
Jens Axboe921c7662008-03-26 09:17:55 +0100883
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800884 log_err("fio: %s is not a directory\n", dirname);
885 td_verror(td, ret, "lstat");
886 goto out;
887 }
888 if (!S_ISDIR(sb.st_mode)) {
889 log_err("fio: %s is not a directory\n", dirname);
890 ret = 1;
891 goto out;
892 }
Jens Axboe214e1ec2007-03-15 10:48:13 +0100893 }
894
Christian Ehrhardtbcbfeef2014-02-20 09:13:06 -0800895out:
896 free(p);
897 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100898}
899
Jens Axboef2a28032014-02-11 09:12:06 -0700900static int str_lockfile_cb(void *data, const char fio_unused *str)
901{
902 struct thread_data *td = data;
903
904 if (td->files_index) {
905 log_err("fio: lockfile= option must precede filename=\n");
906 return 1;
907 }
908
909 return 0;
910}
911
Jens Axboe214e1ec2007-03-15 10:48:13 +0100912static int str_opendir_cb(void *data, const char fio_unused *str)
913{
914 struct thread_data *td = data;
915
Jens Axboe52c0cea2013-09-06 10:07:37 -0600916 if (parse_dryrun())
917 return 0;
918
Jens Axboe214e1ec2007-03-15 10:48:13 +0100919 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100920 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100921
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100922 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100923}
924
Jens Axboece35b1e2014-01-14 15:35:58 -0700925static int pattern_cb(char *pattern, unsigned int max_size,
926 const char *input, unsigned int *pattern_bytes)
Jens Axboe90059d62007-07-30 09:33:12 +0200927{
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100928 long off;
Jens Axboece35b1e2014-01-14 15:35:58 -0700929 int i = 0, j = 0, len, k, base = 10;
930 uint32_t pattern_length;
Jens Axboe3c3ed072012-03-27 09:12:39 +0200931 char *loc1, *loc2;
Jens Axboe90059d62007-07-30 09:33:12 +0200932
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100933 loc1 = strstr(input, "0x");
934 loc2 = strstr(input, "0X");
935 if (loc1 || loc2)
936 base = 16;
937 off = strtol(input, NULL, base);
938 if (off != LONG_MAX || errno != ERANGE) {
939 while (off) {
Jens Axboece35b1e2014-01-14 15:35:58 -0700940 pattern[i] = off & 0xff;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100941 off >>= 8;
942 i++;
943 }
944 } else {
945 len = strlen(input);
946 k = len - 1;
947 if (base == 16) {
948 if (loc1)
949 j = loc1 - input + 2;
950 else
951 j = loc2 - input + 2;
952 } else
953 return 1;
Jens Axboece35b1e2014-01-14 15:35:58 -0700954 if (len - j < max_size * 2) {
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100955 while (k >= j) {
956 off = converthexchartoint(input[k--]);
957 if (k >= j)
958 off += (converthexchartoint(input[k--])
959 * 16);
Jens Axboece35b1e2014-01-14 15:35:58 -0700960 pattern[i++] = (char) off;
Radha Ramachandran0e92f872009-10-27 20:14:27 +0100961 }
962 }
963 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100964
965 /*
966 * Fill the pattern all the way to the end. This greatly reduces
967 * the number of memcpy's we have to do when verifying the IO.
968 */
Jens Axboee078de42013-04-24 23:07:17 -0600969 pattern_length = i;
Jens Axboece35b1e2014-01-14 15:35:58 -0700970 while (i > 1 && i * 2 <= max_size) {
971 memcpy(&pattern[i], &pattern[0], i);
Steven Langefcd9dc2012-02-02 20:22:04 +0100972 i *= 2;
973 }
Jens Axboee078de42013-04-24 23:07:17 -0600974
975 /*
976 * Fill remainder, if the pattern multiple ends up not being
Jens Axboece35b1e2014-01-14 15:35:58 -0700977 * max_size.
Jens Axboee078de42013-04-24 23:07:17 -0600978 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700979 while (i > 1 && i < max_size) {
980 unsigned int b = min(pattern_length, max_size - i);
Jens Axboee078de42013-04-24 23:07:17 -0600981
Jens Axboece35b1e2014-01-14 15:35:58 -0700982 memcpy(&pattern[i], &pattern[0], b);
Jens Axboee078de42013-04-24 23:07:17 -0600983 i += b;
984 }
985
Steven Lang9a2a86d2012-02-07 09:42:59 +0100986 if (i == 1) {
987 /*
988 * The code in verify_io_u_pattern assumes a single byte pattern
989 * fills the whole verify pattern buffer.
990 */
Jens Axboece35b1e2014-01-14 15:35:58 -0700991 memset(pattern, pattern[0], max_size);
Steven Lang9a2a86d2012-02-07 09:42:59 +0100992 }
Steven Langefcd9dc2012-02-02 20:22:04 +0100993
Jens Axboece35b1e2014-01-14 15:35:58 -0700994 *pattern_bytes = i;
995 return 0;
996}
997
998static int str_buffer_pattern_cb(void *data, const char *input)
999{
1000 struct thread_data *td = data;
1001 int ret;
1002
1003 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1004 &td->o.buffer_pattern_bytes);
1005
1006 if (!ret) {
1007 td->o.refill_buffers = 0;
1008 td->o.scramble_buffers = 0;
1009 td->o.zero_buffers = 0;
1010 }
1011
1012 return ret;
1013}
1014
Jens Axboebedc9dc2014-03-17 12:51:09 -06001015static int str_buffer_compress_cb(void *data, unsigned long long *il)
1016{
1017 struct thread_data *td = data;
1018
1019 td->flags |= TD_F_COMPRESS;
1020 td->o.compress_percentage = *il;
1021 return 0;
1022}
1023
Jens Axboece35b1e2014-01-14 15:35:58 -07001024static int str_verify_pattern_cb(void *data, const char *input)
1025{
1026 struct thread_data *td = data;
1027 int ret;
1028
1029 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1030 &td->o.verify_pattern_bytes);
Steven Langefcd9dc2012-02-02 20:22:04 +01001031
Jens Axboe92bf48d2011-01-14 21:20:42 +01001032 /*
1033 * VERIFY_META could already be set
1034 */
Jens Axboece35b1e2014-01-14 15:35:58 -07001035 if (!ret && td->o.verify == VERIFY_NONE)
Jens Axboe92bf48d2011-01-14 21:20:42 +01001036 td->o.verify = VERIFY_PATTERN;
Steven Langefcd9dc2012-02-02 20:22:04 +01001037
Jens Axboece35b1e2014-01-14 15:35:58 -07001038 return ret;
Jens Axboe90059d62007-07-30 09:33:12 +02001039}
Jens Axboe214e1ec2007-03-15 10:48:13 +01001040
Jens Axboe993bf482008-11-14 13:04:53 +01001041static int str_gtod_reduce_cb(void *data, int *il)
1042{
1043 struct thread_data *td = data;
1044 int val = *il;
1045
Jens Axboe02af0982010-06-24 09:59:34 +02001046 td->o.disable_lat = !!val;
Jens Axboe993bf482008-11-14 13:04:53 +01001047 td->o.disable_clat = !!val;
1048 td->o.disable_slat = !!val;
1049 td->o.disable_bw = !!val;
Jens Axboe0dc1bc02011-10-13 08:55:29 +02001050 td->o.clat_percentiles = !val;
Jens Axboe993bf482008-11-14 13:04:53 +01001051 if (val)
1052 td->tv_cache_mask = 63;
1053
1054 return 0;
1055}
1056
Cigy Cyriac85bc8332010-08-10 19:21:09 -04001057static int str_gtod_cpu_cb(void *data, long long *il)
Jens Axboebe4ecfd2008-12-08 14:10:52 +01001058{
1059 struct thread_data *td = data;
1060 int val = *il;
1061
1062 td->o.gtod_cpu = val;
1063 td->o.gtod_offload = 1;
1064 return 0;
1065}
1066
Jens Axboe7bb59102011-07-12 19:47:03 +02001067static int str_size_cb(void *data, unsigned long long *__val)
1068{
1069 struct thread_data *td = data;
1070 unsigned long long v = *__val;
1071
1072 if (parse_is_percent(v)) {
1073 td->o.size = 0;
1074 td->o.size_percent = -1ULL - v;
1075 } else
1076 td->o.size = v;
1077
1078 return 0;
1079}
1080
Jens Axboe896cac22009-07-01 10:38:35 +02001081static int rw_verify(struct fio_option *o, void *data)
1082{
1083 struct thread_data *td = data;
1084
1085 if (read_only && td_write(td)) {
1086 log_err("fio: job <%s> has write bit set, but fio is in"
1087 " read-only mode\n", td->o.name);
1088 return 1;
1089 }
1090
1091 return 0;
1092}
1093
Jens Axboe276ca4f2009-07-01 10:43:05 +02001094static int gtod_cpu_verify(struct fio_option *o, void *data)
Jens Axboe29d43ff2009-07-01 10:42:18 +02001095{
Jens Axboe276ca4f2009-07-01 10:43:05 +02001096#ifndef FIO_HAVE_CPU_AFFINITY
Jens Axboe29d43ff2009-07-01 10:42:18 +02001097 struct thread_data *td = data;
1098
Jens Axboe29d43ff2009-07-01 10:42:18 +02001099 if (td->o.gtod_cpu) {
1100 log_err("fio: platform must support CPU affinity for"
1101 "gettimeofday() offloading\n");
1102 return 1;
1103 }
1104#endif
1105
1106 return 0;
1107}
1108
Jens Axboe214e1ec2007-03-15 10:48:13 +01001109/*
Jens Axboe9af4a242012-03-16 10:13:49 +01001110 * Option grouping
1111 */
1112static struct opt_group fio_opt_groups[] = {
1113 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001114 .name = "General",
1115 .mask = FIO_OPT_C_GENERAL,
1116 },
1117 {
1118 .name = "I/O",
1119 .mask = FIO_OPT_C_IO,
Jens Axboe9af4a242012-03-16 10:13:49 +01001120 },
1121 {
1122 .name = "File",
Jens Axboee8b0e952012-03-19 14:37:08 +01001123 .mask = FIO_OPT_C_FILE,
Jens Axboe9af4a242012-03-16 10:13:49 +01001124 },
1125 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001126 .name = "Statistics",
1127 .mask = FIO_OPT_C_STAT,
Jens Axboe9af4a242012-03-16 10:13:49 +01001128 },
1129 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001130 .name = "Logging",
1131 .mask = FIO_OPT_C_LOG,
Jens Axboe9af4a242012-03-16 10:13:49 +01001132 },
1133 {
Jens Axboe13fca822012-03-31 13:55:54 +02001134 .name = "Profiles",
1135 .mask = FIO_OPT_C_PROFILE,
1136 },
1137 {
Jens Axboe9af4a242012-03-16 10:13:49 +01001138 .name = NULL,
1139 },
1140};
1141
Jens Axboee8b0e952012-03-19 14:37:08 +01001142static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1143 unsigned int inv_mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001144{
1145 struct opt_group *og;
1146 int i;
1147
Jens Axboee8b0e952012-03-19 14:37:08 +01001148 if (*mask == inv_mask || !*mask)
Jens Axboe9af4a242012-03-16 10:13:49 +01001149 return NULL;
1150
Jens Axboee8b0e952012-03-19 14:37:08 +01001151 for (i = 0; ogs[i].name; i++) {
1152 og = &ogs[i];
Jens Axboe9af4a242012-03-16 10:13:49 +01001153
1154 if (*mask & og->mask) {
1155 *mask &= ~(og->mask);
1156 return og;
1157 }
1158 }
1159
1160 return NULL;
1161}
1162
Jens Axboee8b0e952012-03-19 14:37:08 +01001163struct opt_group *opt_group_from_mask(unsigned int *mask)
1164{
1165 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1166}
1167
1168static struct opt_group fio_opt_cat_groups[] = {
1169 {
Jens Axboe3e260a42013-12-09 12:38:53 -07001170 .name = "Latency profiling",
1171 .mask = FIO_OPT_G_LATPROF,
1172 },
1173 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001174 .name = "Rate",
1175 .mask = FIO_OPT_G_RATE,
1176 },
1177 {
1178 .name = "Zone",
1179 .mask = FIO_OPT_G_ZONE,
1180 },
1181 {
1182 .name = "Read/write mix",
1183 .mask = FIO_OPT_G_RWMIX,
1184 },
1185 {
1186 .name = "Verify",
1187 .mask = FIO_OPT_G_VERIFY,
1188 },
1189 {
1190 .name = "Trim",
1191 .mask = FIO_OPT_G_TRIM,
1192 },
1193 {
1194 .name = "I/O Logging",
1195 .mask = FIO_OPT_G_IOLOG,
1196 },
1197 {
1198 .name = "I/O Depth",
1199 .mask = FIO_OPT_G_IO_DEPTH,
1200 },
1201 {
1202 .name = "I/O Flow",
1203 .mask = FIO_OPT_G_IO_FLOW,
1204 },
1205 {
Jens Axboe06260372012-03-19 15:16:08 +01001206 .name = "Description",
1207 .mask = FIO_OPT_G_DESC,
1208 },
1209 {
1210 .name = "Filename",
1211 .mask = FIO_OPT_G_FILENAME,
1212 },
1213 {
1214 .name = "General I/O",
1215 .mask = FIO_OPT_G_IO_BASIC,
1216 },
1217 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01001218 .name = "Cgroups",
1219 .mask = FIO_OPT_G_CGROUP,
1220 },
1221 {
1222 .name = "Runtime",
1223 .mask = FIO_OPT_G_RUNTIME,
1224 },
1225 {
Jens Axboe10860052012-03-19 20:56:53 +01001226 .name = "Process",
1227 .mask = FIO_OPT_G_PROCESS,
1228 },
1229 {
1230 .name = "Job credentials / priority",
1231 .mask = FIO_OPT_G_CRED,
1232 },
1233 {
1234 .name = "Clock settings",
1235 .mask = FIO_OPT_G_CLOCK,
1236 },
1237 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01001238 .name = "I/O Type",
1239 .mask = FIO_OPT_G_IO_TYPE,
1240 },
1241 {
1242 .name = "I/O Thinktime",
1243 .mask = FIO_OPT_G_THINKTIME,
1244 },
1245 {
1246 .name = "Randomizations",
1247 .mask = FIO_OPT_G_RANDOM,
1248 },
1249 {
1250 .name = "I/O buffers",
1251 .mask = FIO_OPT_G_IO_BUF,
1252 },
1253 {
Jens Axboe13fca822012-03-31 13:55:54 +02001254 .name = "Tiobench profile",
1255 .mask = FIO_OPT_G_TIOBENCH,
1256 },
1257
1258 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001259 .name = NULL,
1260 }
1261};
1262
1263struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1264{
1265 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1266}
1267
Jens Axboe9af4a242012-03-16 10:13:49 +01001268/*
Jens Axboe214e1ec2007-03-15 10:48:13 +01001269 * Map of job/command line options
1270 */
Jens Axboe9af4a242012-03-16 10:13:49 +01001271struct fio_option fio_options[FIO_MAX_OPTS] = {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001272 {
1273 .name = "description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001274 .lname = "Description of job",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001275 .type = FIO_OPT_STR_STORE,
1276 .off1 = td_var_offset(description),
1277 .help = "Text job description",
Jens Axboee8b0e952012-03-19 14:37:08 +01001278 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001279 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001280 },
1281 {
1282 .name = "name",
Jens Axboee8b0e952012-03-19 14:37:08 +01001283 .lname = "Job name",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001284 .type = FIO_OPT_STR_STORE,
1285 .off1 = td_var_offset(name),
1286 .help = "Name of this job",
Jens Axboee8b0e952012-03-19 14:37:08 +01001287 .category = FIO_OPT_C_GENERAL,
Jens Axboe06260372012-03-19 15:16:08 +01001288 .group = FIO_OPT_G_DESC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001289 },
1290 {
Jens Axboee8b0e952012-03-19 14:37:08 +01001291 .name = "filename",
1292 .lname = "Filename(s)",
1293 .type = FIO_OPT_STR_STORE,
1294 .off1 = td_var_offset(filename),
1295 .cb = str_filename_cb,
1296 .prio = -1, /* must come after "directory" */
1297 .help = "File(s) to use for the workload",
1298 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001299 .group = FIO_OPT_G_FILENAME,
Jens Axboee8b0e952012-03-19 14:37:08 +01001300 },
1301 {
1302 .name = "directory",
1303 .lname = "Directory",
1304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(directory),
1306 .cb = str_directory_cb,
1307 .help = "Directory to store files in",
1308 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001309 .group = FIO_OPT_G_FILENAME,
Jens Axboe90fef2d2009-07-17 22:33:32 +02001310 },
1311 {
Jens Axboede98bd32013-04-05 11:09:20 +02001312 .name = "filename_format",
1313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(filename_format),
1315 .prio = -1, /* must come after "directory" */
1316 .help = "Override default $jobname.$jobnum.$filenum naming",
1317 .def = "$jobname.$jobnum.$filenum",
Jens Axboe93bb6262013-04-10 13:01:30 +02001318 .category = FIO_OPT_C_FILE,
1319 .group = FIO_OPT_G_FILENAME,
Steven Noonanad705bc2013-04-08 15:05:25 -07001320 },
1321 {
Jens Axboe29c13492008-03-01 19:25:20 +01001322 .name = "lockfile",
Jens Axboee8b0e952012-03-19 14:37:08 +01001323 .lname = "Lockfile",
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001324 .type = FIO_OPT_STR,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001325 .off1 = td_var_offset(file_lock_mode),
Jens Axboe29c13492008-03-01 19:25:20 +01001326 .help = "Lock file when doing IO to it",
Jens Axboebc6a0a52014-02-07 10:57:13 -07001327 .prio = 1,
Jens Axboe29c13492008-03-01 19:25:20 +01001328 .parent = "filename",
Jens Axboed71c1542012-03-16 20:16:59 +01001329 .hide = 0,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001330 .def = "none",
Jens Axboef2a28032014-02-11 09:12:06 -07001331 .cb = str_lockfile_cb,
Jens Axboee8b0e952012-03-19 14:37:08 +01001332 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001333 .group = FIO_OPT_G_FILENAME,
Jens Axboe4d4e80f2008-03-04 10:18:56 +01001334 .posval = {
1335 { .ival = "none",
1336 .oval = FILE_LOCK_NONE,
1337 .help = "No file locking",
1338 },
1339 { .ival = "exclusive",
1340 .oval = FILE_LOCK_EXCLUSIVE,
1341 .help = "Exclusive file lock",
1342 },
1343 {
1344 .ival = "readwrite",
1345 .oval = FILE_LOCK_READWRITE,
1346 .help = "Read vs write lock",
1347 },
1348 },
Jens Axboe29c13492008-03-01 19:25:20 +01001349 },
1350 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001351 .name = "opendir",
Jens Axboee8b0e952012-03-19 14:37:08 +01001352 .lname = "Open directory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001353 .type = FIO_OPT_STR_STORE,
1354 .off1 = td_var_offset(opendir),
1355 .cb = str_opendir_cb,
1356 .help = "Recursively add files from this directory and down",
Jens Axboee8b0e952012-03-19 14:37:08 +01001357 .category = FIO_OPT_C_FILE,
Jens Axboe06260372012-03-19 15:16:08 +01001358 .group = FIO_OPT_G_FILENAME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001359 },
1360 {
1361 .name = "rw",
Jens Axboee8b0e952012-03-19 14:37:08 +01001362 .lname = "Read/write",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001363 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001364 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +01001365 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001366 .off1 = td_var_offset(td_ddir),
1367 .help = "IO direction",
1368 .def = "read",
Jens Axboe896cac22009-07-01 10:38:35 +02001369 .verify = rw_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01001370 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001371 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001372 .posval = {
1373 { .ival = "read",
1374 .oval = TD_DDIR_READ,
1375 .help = "Sequential read",
1376 },
1377 { .ival = "write",
1378 .oval = TD_DDIR_WRITE,
1379 .help = "Sequential write",
1380 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001381 { .ival = "trim",
1382 .oval = TD_DDIR_TRIM,
1383 .help = "Sequential trim",
1384 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001385 { .ival = "randread",
1386 .oval = TD_DDIR_RANDREAD,
1387 .help = "Random read",
1388 },
1389 { .ival = "randwrite",
1390 .oval = TD_DDIR_RANDWRITE,
1391 .help = "Random write",
1392 },
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001393 { .ival = "randtrim",
1394 .oval = TD_DDIR_RANDTRIM,
1395 .help = "Random trim",
1396 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001397 { .ival = "rw",
1398 .oval = TD_DDIR_RW,
1399 .help = "Sequential read and write mix",
1400 },
Jens Axboe10b023d2012-03-23 13:40:06 +01001401 { .ival = "readwrite",
1402 .oval = TD_DDIR_RW,
1403 .help = "Sequential read and write mix",
1404 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001405 { .ival = "randrw",
1406 .oval = TD_DDIR_RANDRW,
1407 .help = "Random read and write mix"
1408 },
1409 },
1410 },
1411 {
Jens Axboe38dad622010-07-20 14:46:00 -06001412 .name = "rw_sequencer",
Jens Axboee8b0e952012-03-19 14:37:08 +01001413 .lname = "RW Sequencer",
Jens Axboe38dad622010-07-20 14:46:00 -06001414 .type = FIO_OPT_STR,
1415 .off1 = td_var_offset(rw_seq),
1416 .help = "IO offset generator modifier",
1417 .def = "sequential",
Jens Axboee8b0e952012-03-19 14:37:08 +01001418 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001419 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe38dad622010-07-20 14:46:00 -06001420 .posval = {
1421 { .ival = "sequential",
1422 .oval = RW_SEQ_SEQ,
1423 .help = "Generate sequential offsets",
1424 },
1425 { .ival = "identical",
1426 .oval = RW_SEQ_IDENT,
1427 .help = "Generate identical offsets",
1428 },
1429 },
1430 },
1431
1432 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001433 .name = "ioengine",
Jens Axboee8b0e952012-03-19 14:37:08 +01001434 .lname = "IO Engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001435 .type = FIO_OPT_STR_STORE,
1436 .off1 = td_var_offset(ioengine),
1437 .help = "IO engine to use",
Jens Axboe58483fa2011-01-19 11:09:58 -07001438 .def = FIO_PREFERRED_ENGINE,
Jens Axboee8b0e952012-03-19 14:37:08 +01001439 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001440 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001441 .posval = {
1442 { .ival = "sync",
1443 .help = "Use read/write",
1444 },
gurudas paia31041e2007-10-23 15:12:30 +02001445 { .ival = "psync",
1446 .help = "Use pread/pwrite",
1447 },
Jens Axboe1d2af022008-02-04 10:59:07 +01001448 { .ival = "vsync",
Bruce Cran03e20d62011-01-02 20:14:54 +01001449 .help = "Use readv/writev",
Jens Axboe1d2af022008-02-04 10:59:07 +01001450 },
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001451#ifdef CONFIG_PWRITEV
1452 { .ival = "pvsync",
1453 .help = "Use preadv/pwritev",
1454 },
1455#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001456#ifdef CONFIG_LIBAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001457 { .ival = "libaio",
1458 .help = "Linux native asynchronous IO",
1459 },
1460#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001461#ifdef CONFIG_POSIXAIO
Jens Axboe214e1ec2007-03-15 10:48:13 +01001462 { .ival = "posixaio",
1463 .help = "POSIX asynchronous IO",
1464 },
1465#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001466#ifdef CONFIG_SOLARISAIO
Jens Axboe417f0062008-06-02 11:59:30 +02001467 { .ival = "solarisaio",
1468 .help = "Solaris native asynchronous IO",
1469 },
1470#endif
Jens Axboe4700b232013-01-24 15:33:33 -07001471#ifdef CONFIG_WINDOWSAIO
Bruce Cran03e20d62011-01-02 20:14:54 +01001472 { .ival = "windowsaio",
Jens Axboe3be80072011-01-19 11:07:28 -07001473 .help = "Windows native asynchronous IO"
Steven Langde890a12011-11-09 14:03:34 +01001474 },
Jens Axboe3be80072011-01-19 11:07:28 -07001475#endif
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001476#ifdef CONFIG_RBD
1477 { .ival = "rbd",
1478 .help = "Rados Block Device asynchronous IO"
1479 },
1480#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01001481 { .ival = "mmap",
Bruce Cran03e20d62011-01-02 20:14:54 +01001482 .help = "Memory mapped IO"
Jens Axboe214e1ec2007-03-15 10:48:13 +01001483 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001484#ifdef CONFIG_LINUX_SPLICE
Jens Axboe214e1ec2007-03-15 10:48:13 +01001485 { .ival = "splice",
1486 .help = "splice/vmsplice based IO",
1487 },
Jens Axboe9cce02e2007-06-22 15:42:21 +02001488 { .ival = "netsplice",
1489 .help = "splice/vmsplice to/from the network",
1490 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001491#endif
1492#ifdef FIO_HAVE_SGIO
1493 { .ival = "sg",
1494 .help = "SCSI generic v3 IO",
1495 },
1496#endif
1497 { .ival = "null",
1498 .help = "Testing engine (no data transfer)",
1499 },
1500 { .ival = "net",
1501 .help = "Network IO",
1502 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001503 { .ival = "cpuio",
Bruce Cran03e20d62011-01-02 20:14:54 +01001504 .help = "CPU cycle burner engine",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001505 },
Jens Axboe67bf9822013-01-10 11:23:19 +01001506#ifdef CONFIG_GUASI
Jens Axboeb8c82a42007-03-21 08:48:26 +01001507 { .ival = "guasi",
1508 .help = "GUASI IO engine",
1509 },
1510#endif
Jens Axboe79a43182010-09-07 13:28:58 +02001511#ifdef FIO_HAVE_BINJECT
1512 { .ival = "binject",
1513 .help = "binject direct inject block engine",
1514 },
1515#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001516#ifdef CONFIG_RDMA
ren yufei21b8aee2011-08-01 10:01:57 +02001517 { .ival = "rdma",
1518 .help = "RDMA IO engine",
1519 },
1520#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01001521#ifdef CONFIG_FUSION_AW
Jens Axboe8200b8c2012-09-18 23:55:43 +02001522 { .ival = "fusion-aw-sync",
1523 .help = "Fusion-io atomic write engine",
1524 },
1525#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001526#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001527 { .ival = "e4defrag",
1528 .help = "ext4 defrag engine",
1529 },
1530#endif
Jens Axboe997843c2013-01-24 15:27:40 -07001531#ifdef CONFIG_LINUX_FALLOCATE
Jens Axboe1ecc95c2012-09-20 13:46:34 +02001532 { .ival = "falloc",
1533 .help = "fallocate() file based engine",
1534 },
1535#endif
chenh321fc5a2014-03-31 11:32:29 -04001536#ifdef CONFIG_GFAPI
1537 { .ival = "gfapi",
chenhcb92c7f2014-04-02 13:01:01 -04001538 .help = "Glusterfs libgfapi(sync) based engine"
1539 },
1540 { .ival = "gfapi_async",
1541 .help = "Glusterfs libgfapi(async) based engine"
chenh321fc5a2014-03-31 11:32:29 -04001542 },
1543#endif
1544
Jens Axboe214e1ec2007-03-15 10:48:13 +01001545 { .ival = "external",
1546 .help = "Load external engine (append name)",
1547 },
1548 },
1549 },
1550 {
1551 .name = "iodepth",
Jens Axboee8b0e952012-03-19 14:37:08 +01001552 .lname = "IO Depth",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001553 .type = FIO_OPT_INT,
1554 .off1 = td_var_offset(iodepth),
Bruce Cran03e20d62011-01-02 20:14:54 +01001555 .help = "Number of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +01001556 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001557 .interval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001558 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001559 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001560 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001561 },
1562 {
1563 .name = "iodepth_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01001564 .lname = "IO Depth batch",
Jens Axboe49504212008-06-05 09:03:30 +02001565 .alias = "iodepth_batch_submit",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001566 .type = FIO_OPT_INT,
1567 .off1 = td_var_offset(iodepth_batch),
Jens Axboed65db442009-01-16 19:15:33 +01001568 .help = "Number of IO buffers to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +02001569 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001570 .hide = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001571 .minval = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001572 .interval = 1,
Jens Axboea2e6f8a2008-01-18 10:28:11 +01001573 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001574 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001575 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001576 },
1577 {
Jens Axboe49504212008-06-05 09:03:30 +02001578 .name = "iodepth_batch_complete",
Jens Axboee8b0e952012-03-19 14:37:08 +01001579 .lname = "IO Depth batch complete",
Jens Axboe49504212008-06-05 09:03:30 +02001580 .type = FIO_OPT_INT,
1581 .off1 = td_var_offset(iodepth_batch_complete),
Jens Axboed65db442009-01-16 19:15:33 +01001582 .help = "Number of IO buffers to retrieve in one go",
Jens Axboe49504212008-06-05 09:03:30 +02001583 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001584 .hide = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001585 .minval = 0,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001586 .interval = 1,
Jens Axboe49504212008-06-05 09:03:30 +02001587 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01001588 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001589 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe49504212008-06-05 09:03:30 +02001590 },
1591 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001592 .name = "iodepth_low",
Jens Axboee8b0e952012-03-19 14:37:08 +01001593 .lname = "IO Depth batch low",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001594 .type = FIO_OPT_INT,
1595 .off1 = td_var_offset(iodepth_low),
1596 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +02001597 .parent = "iodepth",
Jens Axboed71c1542012-03-16 20:16:59 +01001598 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001599 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001600 .category = FIO_OPT_C_IO,
Jens Axboe06260372012-03-19 15:16:08 +01001601 .group = FIO_OPT_G_IO_BASIC,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001602 },
1603 {
1604 .name = "size",
Jens Axboee8b0e952012-03-19 14:37:08 +01001605 .lname = "Size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001606 .type = FIO_OPT_STR_VAL,
Jens Axboe7bb59102011-07-12 19:47:03 +02001607 .cb = str_size_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001608 .help = "Total size of device or files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001609 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001610 .category = FIO_OPT_C_IO,
1611 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001612 },
1613 {
Jens Axboe77731b22014-04-28 12:08:47 -06001614 .name = "io_limit",
1615 .lname = "IO Limit",
1616 .type = FIO_OPT_STR_VAL,
1617 .off1 = td_var_offset(io_limit),
1618 .interval = 1024 * 1024,
1619 .category = FIO_OPT_C_IO,
1620 .group = FIO_OPT_G_INVALID,
1621 },
1622 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001623 .name = "fill_device",
Jens Axboee8b0e952012-03-19 14:37:08 +01001624 .lname = "Fill device",
Jens Axboe74586c12011-01-20 10:16:03 -07001625 .alias = "fill_fs",
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001626 .type = FIO_OPT_BOOL,
1627 .off1 = td_var_offset(fill_device),
1628 .help = "Write until an ENOSPC error occurs",
1629 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001630 .category = FIO_OPT_C_FILE,
1631 .group = FIO_OPT_G_INVALID,
Shawn Lewisaa31f1f2008-01-11 09:45:11 +01001632 },
1633 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001634 .name = "filesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01001635 .lname = "File size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001636 .type = FIO_OPT_STR_VAL,
1637 .off1 = td_var_offset(file_size_low),
1638 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001639 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001640 .help = "Size of individual files",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001641 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001642 .category = FIO_OPT_C_FILE,
1643 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001644 },
1645 {
Jens Axboebedc9dc2014-03-17 12:51:09 -06001646 .name = "file_append",
1647 .lname = "File append",
1648 .type = FIO_OPT_BOOL,
1649 .off1 = td_var_offset(file_append),
1650 .help = "IO will start at the end of the file(s)",
1651 .def = "0",
1652 .category = FIO_OPT_C_FILE,
1653 .group = FIO_OPT_G_INVALID,
1654 },
1655 {
Jens Axboe67a10002007-07-31 23:12:16 +02001656 .name = "offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01001657 .lname = "IO offset",
Jens Axboe67a10002007-07-31 23:12:16 +02001658 .alias = "fileoffset",
1659 .type = FIO_OPT_STR_VAL,
1660 .off1 = td_var_offset(start_offset),
1661 .help = "Start IO from this offset",
1662 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001663 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001664 .category = FIO_OPT_C_IO,
1665 .group = FIO_OPT_G_INVALID,
Jens Axboe67a10002007-07-31 23:12:16 +02001666 },
1667 {
Jens Axboe2d7cd862012-03-15 14:53:38 +01001668 .name = "offset_increment",
Jens Axboee8b0e952012-03-19 14:37:08 +01001669 .lname = "IO offset increment",
Jens Axboe2d7cd862012-03-15 14:53:38 +01001670 .type = FIO_OPT_STR_VAL,
1671 .off1 = td_var_offset(offset_increment),
1672 .help = "What is the increment from one offset to the next",
1673 .parent = "offset",
Jens Axboed71c1542012-03-16 20:16:59 +01001674 .hide = 1,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001675 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001676 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01001677 .category = FIO_OPT_C_IO,
1678 .group = FIO_OPT_G_INVALID,
Jens Axboe2d7cd862012-03-15 14:53:38 +01001679 },
1680 {
Jens Axboeddf24e42013-08-09 12:53:44 -06001681 .name = "number_ios",
1682 .lname = "Number of IOs to perform",
1683 .type = FIO_OPT_STR_VAL,
1684 .off1 = td_var_offset(number_ios),
1685 .help = "Force job completion of this number of IOs",
1686 .def = "0",
1687 .category = FIO_OPT_C_IO,
1688 .group = FIO_OPT_G_INVALID,
1689 },
1690 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001691 .name = "bs",
Jens Axboee8b0e952012-03-19 14:37:08 +01001692 .lname = "Block size",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001693 .alias = "blocksize",
Jens Axboee01b22b2009-06-09 15:43:25 +02001694 .type = FIO_OPT_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001695 .off1 = td_var_offset(bs[DDIR_READ]),
1696 .off2 = td_var_offset(bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001697 .off3 = td_var_offset(bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001698 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001699 .help = "Block size unit",
1700 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +02001701 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001702 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001703 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001704 .category = FIO_OPT_C_IO,
1705 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001706 },
1707 {
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001708 .name = "ba",
Jens Axboee8b0e952012-03-19 14:37:08 +01001709 .lname = "Block size align",
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001710 .alias = "blockalign",
Jens Axboee01b22b2009-06-09 15:43:25 +02001711 .type = FIO_OPT_INT,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001712 .off1 = td_var_offset(ba[DDIR_READ]),
1713 .off2 = td_var_offset(ba[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001714 .off3 = td_var_offset(ba[DDIR_TRIM]),
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001715 .minval = 1,
1716 .help = "IO block offset alignment",
1717 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001718 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001719 .interval = 512,
Jens Axboee8b0e952012-03-19 14:37:08 +01001720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
Jens Axboe2b7a01d2009-03-11 11:00:13 +01001722 },
1723 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001724 .name = "bsrange",
Jens Axboee8b0e952012-03-19 14:37:08 +01001725 .lname = "Block size range",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001726 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001727 .type = FIO_OPT_RANGE,
1728 .off1 = td_var_offset(min_bs[DDIR_READ]),
1729 .off2 = td_var_offset(max_bs[DDIR_READ]),
1730 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1731 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Shaohua Li6eaf09d2012-09-14 08:49:43 +02001732 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1733 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
Jens Axboec3edbdb2007-07-20 14:25:31 +02001734 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001735 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +02001736 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001737 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01001738 .interval = 4096,
Jens Axboee8b0e952012-03-19 14:37:08 +01001739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001741 },
1742 {
Jens Axboe564ca972007-12-14 12:21:19 +01001743 .name = "bssplit",
Jens Axboee8b0e952012-03-19 14:37:08 +01001744 .lname = "Block size split",
Jens Axboe564ca972007-12-14 12:21:19 +01001745 .type = FIO_OPT_STR,
1746 .cb = str_bssplit_cb,
1747 .help = "Set a specific mix of block sizes",
1748 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001749 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001750 .category = FIO_OPT_C_IO,
1751 .group = FIO_OPT_G_INVALID,
Jens Axboe564ca972007-12-14 12:21:19 +01001752 },
1753 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001754 .name = "bs_unaligned",
Jens Axboee8b0e952012-03-19 14:37:08 +01001755 .lname = "Block size unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +01001756 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001757 .type = FIO_OPT_STR_SET,
1758 .off1 = td_var_offset(bs_unaligned),
1759 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +02001760 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001761 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001762 .category = FIO_OPT_C_IO,
1763 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001764 },
1765 {
Jens Axboe6aca9b32013-07-25 12:45:26 -06001766 .name = "bs_is_seq_rand",
1767 .lname = "Block size division is seq/random (not read/write)",
1768 .type = FIO_OPT_BOOL,
1769 .off1 = td_var_offset(bs_is_seq_rand),
1770 .help = "Consider any blocksize setting to be sequential,ramdom",
1771 .def = "0",
1772 .parent = "blocksize",
1773 .category = FIO_OPT_C_IO,
1774 .group = FIO_OPT_G_INVALID,
1775 },
1776 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001777 .name = "randrepeat",
Jens Axboee8b0e952012-03-19 14:37:08 +01001778 .lname = "Random repeatable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001779 .type = FIO_OPT_BOOL,
1780 .off1 = td_var_offset(rand_repeatable),
1781 .help = "Use repeatable random IO pattern",
1782 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +02001783 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001784 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001785 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001786 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001787 },
1788 {
Jens Axboe04778ba2014-01-10 20:57:01 -07001789 .name = "randseed",
1790 .lname = "The random generator seed",
Grant Grundler363cffa2014-01-28 15:11:23 -07001791 .type = FIO_OPT_STR_VAL,
Jens Axboe04778ba2014-01-10 20:57:01 -07001792 .off1 = td_var_offset(rand_seed),
1793 .help = "Set the random generator seed value",
1794 .parent = "rw",
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_RANDOM,
1797 },
1798 {
Jens Axboe2615cc42011-03-28 09:35:09 +02001799 .name = "use_os_rand",
Jens Axboee8b0e952012-03-19 14:37:08 +01001800 .lname = "Use OS random",
Jens Axboe2615cc42011-03-28 09:35:09 +02001801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(use_os_rand),
1803 .help = "Set to use OS random generator",
1804 .def = "0",
1805 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001806 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001807 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001808 .group = FIO_OPT_G_RANDOM,
Jens Axboe2615cc42011-03-28 09:35:09 +02001809 },
1810 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001811 .name = "norandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001812 .lname = "No randommap",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001813 .type = FIO_OPT_STR_SET,
1814 .off1 = td_var_offset(norandommap),
1815 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +02001816 .parent = "rw",
Jens Axboed71c1542012-03-16 20:16:59 +01001817 .hide = 1,
Jens Axboeb2452a42012-03-20 10:29:45 +01001818 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001819 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001820 .group = FIO_OPT_G_RANDOM,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001821 },
1822 {
Jens Axboe2b386d22008-03-26 10:32:57 +01001823 .name = "softrandommap",
Jens Axboee8b0e952012-03-19 14:37:08 +01001824 .lname = "Soft randommap",
Jens Axboe2b386d22008-03-26 10:32:57 +01001825 .type = FIO_OPT_BOOL,
1826 .off1 = td_var_offset(softrandommap),
Jens Axboef66ab3c2008-06-05 11:48:22 +02001827 .help = "Set norandommap if randommap allocation fails",
Jens Axboe2b386d22008-03-26 10:32:57 +01001828 .parent = "norandommap",
Jens Axboed71c1542012-03-16 20:16:59 +01001829 .hide = 1,
Jens Axboe2b386d22008-03-26 10:32:57 +01001830 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01001831 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01001832 .group = FIO_OPT_G_RANDOM,
Jens Axboe2b386d22008-03-26 10:32:57 +01001833 },
1834 {
Jens Axboe8055e412012-11-26 08:43:47 +01001835 .name = "random_generator",
1836 .type = FIO_OPT_STR,
1837 .off1 = td_var_offset(random_generator),
1838 .help = "Type of random number generator to use",
1839 .def = "tausworthe",
1840 .posval = {
1841 { .ival = "tausworthe",
1842 .oval = FIO_RAND_GEN_TAUSWORTHE,
1843 .help = "Strong Tausworthe generator",
1844 },
1845 { .ival = "lfsr",
1846 .oval = FIO_RAND_GEN_LFSR,
1847 .help = "Variable length LFSR",
1848 },
1849 },
Jens Axboe48107592012-12-04 09:43:11 +01001850 .category = FIO_OPT_C_IO,
1851 .group = FIO_OPT_G_RANDOM,
Jens Axboe8055e412012-11-26 08:43:47 +01001852 },
1853 {
Jens Axboee25839d2012-11-06 10:49:42 +01001854 .name = "random_distribution",
1855 .type = FIO_OPT_STR,
1856 .off1 = td_var_offset(random_distribution),
1857 .cb = str_random_distribution_cb,
1858 .help = "Random offset distribution generator",
1859 .def = "random",
1860 .posval = {
1861 { .ival = "random",
1862 .oval = FIO_RAND_DIST_RANDOM,
1863 .help = "Completely random",
1864 },
1865 { .ival = "zipf",
1866 .oval = FIO_RAND_DIST_ZIPF,
1867 .help = "Zipf distribution",
1868 },
Jens Axboe925fee32012-11-06 13:50:32 +01001869 { .ival = "pareto",
1870 .oval = FIO_RAND_DIST_PARETO,
1871 .help = "Pareto distribution",
1872 },
Jens Axboee25839d2012-11-06 10:49:42 +01001873 },
Jens Axboe48107592012-12-04 09:43:11 +01001874 .category = FIO_OPT_C_IO,
1875 .group = FIO_OPT_G_RANDOM,
Jens Axboee25839d2012-11-06 10:49:42 +01001876 },
1877 {
Jens Axboe211c9b82013-04-26 08:56:17 -06001878 .name = "percentage_random",
1879 .lname = "Percentage Random",
1880 .type = FIO_OPT_INT,
Jens Axboed9472272013-07-25 10:20:45 -06001881 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1882 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1883 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
Jens Axboe211c9b82013-04-26 08:56:17 -06001884 .maxval = 100,
1885 .help = "Percentage of seq/random mix that should be random",
Jens Axboed9472272013-07-25 10:20:45 -06001886 .def = "100,100,100",
Jens Axboe211c9b82013-04-26 08:56:17 -06001887 .interval = 5,
1888 .inverse = "percentage_sequential",
1889 .category = FIO_OPT_C_IO,
1890 .group = FIO_OPT_G_RANDOM,
1891 },
1892 {
1893 .name = "percentage_sequential",
1894 .lname = "Percentage Sequential",
Jens Axboed9472272013-07-25 10:20:45 -06001895 .type = FIO_OPT_DEPRECATED,
Jens Axboe211c9b82013-04-26 08:56:17 -06001896 .category = FIO_OPT_C_IO,
1897 .group = FIO_OPT_G_RANDOM,
1898 },
1899 {
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001900 .name = "allrandrepeat",
1901 .type = FIO_OPT_BOOL,
1902 .off1 = td_var_offset(allrand_repeatable),
1903 .help = "Use repeatable random numbers for everything",
1904 .def = "0",
Jens Axboea869d9c2014-02-20 13:22:48 -08001905 .category = FIO_OPT_C_IO,
1906 .group = FIO_OPT_G_RANDOM,
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -08001907 },
1908 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001909 .name = "nrfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001910 .lname = "Number of files",
Jens Axboed7c8be02010-11-25 08:21:39 +01001911 .alias = "nr_files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001912 .type = FIO_OPT_INT,
1913 .off1 = td_var_offset(nr_files),
1914 .help = "Split job workload between this number of files",
1915 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01001916 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01001917 .category = FIO_OPT_C_FILE,
1918 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001919 },
1920 {
1921 .name = "openfiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01001922 .lname = "Number of open files",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001923 .type = FIO_OPT_INT,
1924 .off1 = td_var_offset(open_files),
1925 .help = "Number of files to keep open at the same time",
Jens Axboee8b0e952012-03-19 14:37:08 +01001926 .category = FIO_OPT_C_FILE,
1927 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001928 },
1929 {
1930 .name = "file_service_type",
Jens Axboee8b0e952012-03-19 14:37:08 +01001931 .lname = "File service type",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001932 .type = FIO_OPT_STR,
1933 .cb = str_fst_cb,
1934 .off1 = td_var_offset(file_service_type),
1935 .help = "How to select which file to service next",
1936 .def = "roundrobin",
Jens Axboee8b0e952012-03-19 14:37:08 +01001937 .category = FIO_OPT_C_FILE,
1938 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001939 .posval = {
1940 { .ival = "random",
1941 .oval = FIO_FSERVICE_RANDOM,
1942 .help = "Choose a file at random",
1943 },
1944 { .ival = "roundrobin",
1945 .oval = FIO_FSERVICE_RR,
1946 .help = "Round robin select files",
1947 },
Jens Axboea086c252009-03-04 08:27:37 +01001948 { .ival = "sequential",
1949 .oval = FIO_FSERVICE_SEQ,
1950 .help = "Finish one file before moving to the next",
1951 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001952 },
Jens Axboe67a10002007-07-31 23:12:16 +02001953 .parent = "nrfiles",
Jens Axboed71c1542012-03-16 20:16:59 +01001954 .hide = 1,
Jens Axboe67a10002007-07-31 23:12:16 +02001955 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001956#ifdef CONFIG_POSIX_FALLOCATE
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001957 {
1958 .name = "fallocate",
Jens Axboee8b0e952012-03-19 14:37:08 +01001959 .lname = "Fallocate",
Eric Gourioua596f042011-06-17 09:11:45 +02001960 .type = FIO_OPT_STR,
1961 .off1 = td_var_offset(fallocate_mode),
1962 .help = "Whether pre-allocation is performed when laying out files",
1963 .def = "posix",
Jens Axboee8b0e952012-03-19 14:37:08 +01001964 .category = FIO_OPT_C_FILE,
1965 .group = FIO_OPT_G_INVALID,
Eric Gourioua596f042011-06-17 09:11:45 +02001966 .posval = {
1967 { .ival = "none",
1968 .oval = FIO_FALLOCATE_NONE,
1969 .help = "Do not pre-allocate space",
1970 },
1971 { .ival = "posix",
1972 .oval = FIO_FALLOCATE_POSIX,
1973 .help = "Use posix_fallocate()",
1974 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001975#ifdef CONFIG_LINUX_FALLOCATE
Eric Gourioua596f042011-06-17 09:11:45 +02001976 { .ival = "keep",
1977 .oval = FIO_FALLOCATE_KEEP_SIZE,
1978 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1979 },
Jens Axboe7bc8c2c2010-01-28 11:31:31 +01001980#endif
Eric Gourioua596f042011-06-17 09:11:45 +02001981 /* Compatibility with former boolean values */
1982 { .ival = "0",
1983 .oval = FIO_FALLOCATE_NONE,
1984 .help = "Alias for 'none'",
1985 },
1986 { .ival = "1",
1987 .oval = FIO_FALLOCATE_POSIX,
1988 .help = "Alias for 'posix'",
1989 },
1990 },
1991 },
Jens Axboe97ac9922013-01-24 15:00:25 -07001992#endif /* CONFIG_POSIX_FALLOCATE */
Jens Axboe67a10002007-07-31 23:12:16 +02001993 {
1994 .name = "fadvise_hint",
Jens Axboee8b0e952012-03-19 14:37:08 +01001995 .lname = "Fadvise hint",
Jens Axboe67a10002007-07-31 23:12:16 +02001996 .type = FIO_OPT_BOOL,
1997 .off1 = td_var_offset(fadvise_hint),
1998 .help = "Use fadvise() to advise the kernel on IO pattern",
1999 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002000 .category = FIO_OPT_C_FILE,
2001 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002002 },
2003 {
2004 .name = "fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002005 .lname = "Fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002006 .type = FIO_OPT_INT,
2007 .off1 = td_var_offset(fsync_blocks),
2008 .help = "Issue fsync for writes every given number of blocks",
2009 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002010 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002011 .category = FIO_OPT_C_FILE,
2012 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002013 },
2014 {
Jens Axboe5f9099e2009-06-16 22:40:26 +02002015 .name = "fdatasync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002016 .lname = "Fdatasync",
Jens Axboe5f9099e2009-06-16 22:40:26 +02002017 .type = FIO_OPT_INT,
2018 .off1 = td_var_offset(fdatasync_blocks),
2019 .help = "Issue fdatasync for writes every given number of blocks",
2020 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002021 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002022 .category = FIO_OPT_C_FILE,
2023 .group = FIO_OPT_G_INVALID,
Jens Axboe5f9099e2009-06-16 22:40:26 +02002024 },
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002025 {
2026 .name = "write_barrier",
Jens Axboee8b0e952012-03-19 14:37:08 +01002027 .lname = "Write barrier",
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002028 .type = FIO_OPT_INT,
2029 .off1 = td_var_offset(barrier_blocks),
2030 .help = "Make every Nth write a barrier write",
2031 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002032 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002033 .category = FIO_OPT_C_IO,
2034 .group = FIO_OPT_G_INVALID,
Jens Axboe1ef2b6b2010-10-08 15:07:01 +02002035 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002036#ifdef CONFIG_SYNC_FILE_RANGE
Jens Axboe44f29692010-03-09 20:09:44 +01002037 {
2038 .name = "sync_file_range",
Jens Axboee8b0e952012-03-19 14:37:08 +01002039 .lname = "Sync file range",
Jens Axboe44f29692010-03-09 20:09:44 +01002040 .posval = {
2041 { .ival = "wait_before",
2042 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2043 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002044 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002045 },
2046 { .ival = "write",
2047 .oval = SYNC_FILE_RANGE_WRITE,
2048 .help = "SYNC_FILE_RANGE_WRITE",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002049 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002050 },
2051 {
2052 .ival = "wait_after",
2053 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2054 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
Daniel Gollubebadc0c2014-02-12 08:24:57 -07002055 .orval = 1,
Jens Axboe44f29692010-03-09 20:09:44 +01002056 },
2057 },
Jens Axboe3843deb2010-03-09 20:41:15 +01002058 .type = FIO_OPT_STR_MULTI,
Jens Axboe44f29692010-03-09 20:09:44 +01002059 .cb = str_sfr_cb,
2060 .off1 = td_var_offset(sync_file_range),
2061 .help = "Use sync_file_range()",
Jens Axboee8b0e952012-03-19 14:37:08 +01002062 .category = FIO_OPT_C_FILE,
2063 .group = FIO_OPT_G_INVALID,
Jens Axboe44f29692010-03-09 20:09:44 +01002064 },
2065#endif
Jens Axboe5f9099e2009-06-16 22:40:26 +02002066 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002067 .name = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002068 .lname = "Direct I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002069 .type = FIO_OPT_BOOL,
2070 .off1 = td_var_offset(odirect),
2071 .help = "Use O_DIRECT IO (negates buffered)",
2072 .def = "0",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002073 .inverse = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002074 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002075 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002076 },
2077 {
Chris Masond01612f2013-11-15 15:52:58 -07002078 .name = "atomic",
2079 .lname = "Atomic I/O",
2080 .type = FIO_OPT_BOOL,
2081 .off1 = td_var_offset(oatomic),
2082 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2083 .def = "0",
2084 .category = FIO_OPT_C_IO,
2085 .group = FIO_OPT_G_IO_TYPE,
2086 },
2087 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002088 .name = "buffered",
Jens Axboee8b0e952012-03-19 14:37:08 +01002089 .lname = "Buffered I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002090 .type = FIO_OPT_BOOL,
2091 .off1 = td_var_offset(odirect),
2092 .neg = 1,
2093 .help = "Use buffered IO (negates direct)",
2094 .def = "1",
Jens Axboea01a1bc2012-03-19 21:13:01 +01002095 .inverse = "direct",
Jens Axboee8b0e952012-03-19 14:37:08 +01002096 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002097 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002098 },
2099 {
2100 .name = "overwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002101 .lname = "Overwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(overwrite),
2104 .help = "When writing, set whether to overwrite current data",
2105 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002106 .category = FIO_OPT_C_FILE,
2107 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002108 },
2109 {
2110 .name = "loops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002111 .lname = "Loops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002112 .type = FIO_OPT_INT,
2113 .off1 = td_var_offset(loops),
2114 .help = "Number of times to run the job",
2115 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002116 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002117 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002118 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002119 },
2120 {
2121 .name = "numjobs",
Jens Axboee8b0e952012-03-19 14:37:08 +01002122 .lname = "Number of jobs",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002123 .type = FIO_OPT_INT,
2124 .off1 = td_var_offset(numjobs),
2125 .help = "Duplicate this job this many times",
2126 .def = "1",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002127 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002128 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002129 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002130 },
2131 {
2132 .name = "startdelay",
Jens Axboee8b0e952012-03-19 14:37:08 +01002133 .lname = "Start delay",
Jens Axboea5737c92010-06-29 10:40:30 +02002134 .type = FIO_OPT_STR_VAL_TIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002135 .off1 = td_var_offset(start_delay),
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -08002136 .off2 = td_var_offset(start_delay_high),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002137 .help = "Only start job when this period has passed",
2138 .def = "0",
Jens Axboe0de5b262014-02-21 15:26:01 -08002139 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002140 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002141 .group = FIO_OPT_G_RUNTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002142 },
2143 {
2144 .name = "runtime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002145 .lname = "Runtime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002146 .alias = "timeout",
2147 .type = FIO_OPT_STR_VAL_TIME,
2148 .off1 = td_var_offset(timeout),
2149 .help = "Stop workload when this amount of time has passed",
2150 .def = "0",
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 Axboe214e1ec2007-03-15 10:48:13 +01002154 },
2155 {
Jens Axboecf4464c2007-04-17 20:14:42 +02002156 .name = "time_based",
Jens Axboee8b0e952012-03-19 14:37:08 +01002157 .lname = "Time based",
Jens Axboecf4464c2007-04-17 20:14:42 +02002158 .type = FIO_OPT_STR_SET,
2159 .off1 = td_var_offset(time_based),
2160 .help = "Keep running until runtime/timeout is met",
Jens Axboee8b0e952012-03-19 14:37:08 +01002161 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002162 .group = FIO_OPT_G_RUNTIME,
Jens Axboecf4464c2007-04-17 20:14:42 +02002163 },
2164 {
Juan Casse62167762013-09-17 14:06:13 -07002165 .name = "verify_only",
2166 .lname = "Verify only",
2167 .type = FIO_OPT_STR_SET,
2168 .off1 = td_var_offset(verify_only),
2169 .help = "Verifies previously written data is still valid",
2170 .category = FIO_OPT_C_GENERAL,
2171 .group = FIO_OPT_G_RUNTIME,
2172 },
2173 {
Jens Axboe721938a2008-09-10 09:46:16 +02002174 .name = "ramp_time",
Jens Axboee8b0e952012-03-19 14:37:08 +01002175 .lname = "Ramp time",
Jens Axboe721938a2008-09-10 09:46:16 +02002176 .type = FIO_OPT_STR_VAL_TIME,
2177 .off1 = td_var_offset(ramp_time),
2178 .help = "Ramp up time before measuring performance",
Jens Axboe0de5b262014-02-21 15:26:01 -08002179 .is_seconds = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002180 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01002181 .group = FIO_OPT_G_RUNTIME,
Jens Axboe721938a2008-09-10 09:46:16 +02002182 },
2183 {
Jens Axboec223da82010-03-24 13:23:53 +01002184 .name = "clocksource",
Jens Axboee8b0e952012-03-19 14:37:08 +01002185 .lname = "Clock source",
Jens Axboec223da82010-03-24 13:23:53 +01002186 .type = FIO_OPT_STR,
2187 .cb = fio_clock_source_cb,
2188 .off1 = td_var_offset(clocksource),
2189 .help = "What type of timing source to use",
Jens Axboee8b0e952012-03-19 14:37:08 +01002190 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002191 .group = FIO_OPT_G_CLOCK,
Jens Axboec223da82010-03-24 13:23:53 +01002192 .posval = {
Jens Axboe67bf9822013-01-10 11:23:19 +01002193#ifdef CONFIG_GETTIMEOFDAY
Jens Axboec223da82010-03-24 13:23:53 +01002194 { .ival = "gettimeofday",
2195 .oval = CS_GTOD,
2196 .help = "Use gettimeofday(2) for timing",
2197 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002198#endif
2199#ifdef CONFIG_CLOCK_GETTIME
Jens Axboec223da82010-03-24 13:23:53 +01002200 { .ival = "clock_gettime",
2201 .oval = CS_CGETTIME,
2202 .help = "Use clock_gettime(2) for timing",
2203 },
Jens Axboe67bf9822013-01-10 11:23:19 +01002204#endif
Jens Axboec223da82010-03-24 13:23:53 +01002205#ifdef ARCH_HAVE_CPU_CLOCK
2206 { .ival = "cpu",
2207 .oval = CS_CPUCLOCK,
2208 .help = "Use CPU private clock",
2209 },
2210#endif
2211 },
2212 },
2213 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002214 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +01002215 .alias = "iomem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002216 .lname = "I/O Memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002217 .type = FIO_OPT_STR,
2218 .cb = str_mem_cb,
2219 .off1 = td_var_offset(mem_type),
2220 .help = "Backing type for IO buffers",
2221 .def = "malloc",
Jens Axboee8b0e952012-03-19 14:37:08 +01002222 .category = FIO_OPT_C_IO,
2223 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002224 .posval = {
2225 { .ival = "malloc",
2226 .oval = MEM_MALLOC,
2227 .help = "Use malloc(3) for IO buffers",
2228 },
Jens Axboeef7035a2014-06-18 15:30:09 -07002229#ifndef CONFIG_NO_SHM
Jens Axboeb370e462007-03-19 10:51:49 +01002230 { .ival = "shm",
2231 .oval = MEM_SHM,
2232 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002233 },
2234#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002235 { .ival = "shmhuge",
2236 .oval = MEM_SHMHUGE,
2237 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002238 },
2239#endif
Jens Axboeef7035a2014-06-18 15:30:09 -07002240#endif
Jens Axboeb370e462007-03-19 10:51:49 +01002241 { .ival = "mmap",
2242 .oval = MEM_MMAP,
2243 .help = "Use mmap(2) (file or anon) for IO buffers",
2244 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +01002245#ifdef FIO_HAVE_HUGETLB
2246 { .ival = "mmaphuge",
2247 .oval = MEM_MMAPHUGE,
2248 .help = "Like mmap, but use huge pages",
2249 },
2250#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002251 },
2252 },
2253 {
Jens Axboed529ee12009-07-01 10:33:03 +02002254 .name = "iomem_align",
2255 .alias = "mem_align",
Jens Axboee8b0e952012-03-19 14:37:08 +01002256 .lname = "I/O memory alignment",
Jens Axboed529ee12009-07-01 10:33:03 +02002257 .type = FIO_OPT_INT,
2258 .off1 = td_var_offset(mem_align),
2259 .minval = 0,
2260 .help = "IO memory buffer offset alignment",
2261 .def = "0",
2262 .parent = "iomem",
Jens Axboed71c1542012-03-16 20:16:59 +01002263 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002264 .category = FIO_OPT_C_IO,
2265 .group = FIO_OPT_G_INVALID,
Jens Axboed529ee12009-07-01 10:33:03 +02002266 },
2267 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002268 .name = "verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002269 .lname = "Verify",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002270 .type = FIO_OPT_STR,
2271 .off1 = td_var_offset(verify),
2272 .help = "Verify data written",
2273 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002274 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002275 .group = FIO_OPT_G_VERIFY,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002276 .posval = {
2277 { .ival = "0",
2278 .oval = VERIFY_NONE,
2279 .help = "Don't do IO verification",
2280 },
Jens Axboefcca4b52007-07-27 15:42:00 +02002281 { .ival = "md5",
2282 .oval = VERIFY_MD5,
2283 .help = "Use md5 checksums for verification",
2284 },
Jens Axboed77a7af2007-07-27 15:35:06 +02002285 { .ival = "crc64",
2286 .oval = VERIFY_CRC64,
2287 .help = "Use crc64 checksums for verification",
2288 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002289 { .ival = "crc32",
2290 .oval = VERIFY_CRC32,
2291 .help = "Use crc32 checksums for verification",
2292 },
Jens Axboeaf497e62008-08-04 15:40:35 +02002293 { .ival = "crc32c-intel",
Jens Axboee3aaafc2012-02-22 20:28:17 +01002294 .oval = VERIFY_CRC32C,
2295 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboeaf497e62008-08-04 15:40:35 +02002296 },
Jens Axboebac39e02008-06-11 20:46:19 +02002297 { .ival = "crc32c",
2298 .oval = VERIFY_CRC32C,
Jens Axboee3aaafc2012-02-22 20:28:17 +01002299 .help = "Use crc32c checksums for verification (hw assisted, if available)",
Jens Axboebac39e02008-06-11 20:46:19 +02002300 },
Jens Axboe969f7ed2007-07-27 09:07:17 +02002301 { .ival = "crc16",
2302 .oval = VERIFY_CRC16,
2303 .help = "Use crc16 checksums for verification",
2304 },
Jens Axboe1e154bd2007-07-27 09:52:40 +02002305 { .ival = "crc7",
2306 .oval = VERIFY_CRC7,
2307 .help = "Use crc7 checksums for verification",
2308 },
Jens Axboe7c353ce2009-08-09 22:40:33 +02002309 { .ival = "sha1",
2310 .oval = VERIFY_SHA1,
2311 .help = "Use sha1 checksums for verification",
2312 },
Jens Axboecd14cc12007-07-30 10:59:33 +02002313 { .ival = "sha256",
2314 .oval = VERIFY_SHA256,
2315 .help = "Use sha256 checksums for verification",
2316 },
2317 { .ival = "sha512",
2318 .oval = VERIFY_SHA512,
2319 .help = "Use sha512 checksums for verification",
2320 },
Jens Axboe844ea602014-02-20 13:21:45 -08002321 { .ival = "xxhash",
2322 .oval = VERIFY_XXHASH,
2323 .help = "Use xxhash checksums for verification",
2324 },
Shawn Lewis7437ee82007-08-02 21:05:58 +02002325 { .ival = "meta",
2326 .oval = VERIFY_META,
2327 .help = "Use io information",
2328 },
Jens Axboe36690c92007-03-26 10:23:34 +02002329 {
2330 .ival = "null",
2331 .oval = VERIFY_NULL,
2332 .help = "Pretend to verify",
2333 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002334 },
2335 },
2336 {
Jens Axboe005c5652007-08-02 22:21:36 +02002337 .name = "do_verify",
Jens Axboee8b0e952012-03-19 14:37:08 +01002338 .lname = "Perform verify step",
Jens Axboe68e1f292007-08-10 10:32:14 +02002339 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +02002340 .off1 = td_var_offset(do_verify),
2341 .help = "Run verification stage after write",
2342 .def = "1",
2343 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002344 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002345 .category = FIO_OPT_C_IO,
2346 .group = FIO_OPT_G_VERIFY,
Jens Axboe005c5652007-08-02 22:21:36 +02002347 },
2348 {
Jens Axboe160b9662007-03-27 10:59:49 +02002349 .name = "verifysort",
Jens Axboee8b0e952012-03-19 14:37:08 +01002350 .lname = "Verify sort",
Jens Axboe160b9662007-03-27 10:59:49 +02002351 .type = FIO_OPT_BOOL,
2352 .off1 = td_var_offset(verifysort),
2353 .help = "Sort written verify blocks for read back",
2354 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +02002355 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002356 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_VERIFY,
Jens Axboe160b9662007-03-27 10:59:49 +02002359 },
2360 {
Jens Axboe1ae83d42013-01-12 01:44:15 -07002361 .name = "verifysort_nr",
2362 .type = FIO_OPT_INT,
2363 .off1 = td_var_offset(verifysort_nr),
2364 .help = "Pre-load and sort verify blocks for a read workload",
2365 .minval = 0,
2366 .maxval = 131072,
2367 .def = "1024",
2368 .parent = "verify",
Jens Axboe836fcc02013-01-24 09:08:45 -07002369 .category = FIO_OPT_C_IO,
2370 .group = FIO_OPT_G_VERIFY,
Jens Axboe1ae83d42013-01-12 01:44:15 -07002371 },
2372 {
Jens Axboea59e1702007-07-30 08:53:27 +02002373 .name = "verify_interval",
Jens Axboee8b0e952012-03-19 14:37:08 +01002374 .lname = "Verify interval",
Jens Axboee01b22b2009-06-09 15:43:25 +02002375 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002376 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +02002377 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +02002378 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +02002379 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002380 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002381 .interval = 2 * sizeof(struct verify_header),
Jens Axboee8b0e952012-03-19 14:37:08 +01002382 .category = FIO_OPT_C_IO,
2383 .group = FIO_OPT_G_VERIFY,
Shawn Lewis3f9f4e22007-07-28 21:10:37 +02002384 },
2385 {
Jens Axboea59e1702007-07-30 08:53:27 +02002386 .name = "verify_offset",
Jens Axboee8b0e952012-03-19 14:37:08 +01002387 .lname = "Verify offset",
Jens Axboee01b22b2009-06-09 15:43:25 +02002388 .type = FIO_OPT_INT,
Jens Axboea59e1702007-07-30 08:53:27 +02002389 .help = "Offset verify header location by N bytes",
Jens Axboe203160d2012-03-29 21:17:12 +02002390 .off1 = td_var_offset(verify_offset),
2391 .minval = sizeof(struct verify_header),
Jens Axboeafdf9352007-07-31 16:14:34 +02002392 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002393 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002394 .category = FIO_OPT_C_IO,
2395 .group = FIO_OPT_G_VERIFY,
Shawn Lewis546a9142007-07-28 21:11:37 +02002396 },
2397 {
Shawn Lewise28218f2008-01-16 11:01:33 +01002398 .name = "verify_pattern",
Jens Axboee8b0e952012-03-19 14:37:08 +01002399 .lname = "Verify pattern",
Radha Ramachandran0e92f872009-10-27 20:14:27 +01002400 .type = FIO_OPT_STR,
Shawn Lewise28218f2008-01-16 11:01:33 +01002401 .cb = str_verify_pattern_cb,
2402 .help = "Fill pattern for IO buffers",
2403 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002404 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002405 .category = FIO_OPT_C_IO,
2406 .group = FIO_OPT_G_VERIFY,
Shawn Lewise28218f2008-01-16 11:01:33 +01002407 },
2408 {
Jens Axboea12a3b42007-08-09 10:20:54 +02002409 .name = "verify_fatal",
Jens Axboee8b0e952012-03-19 14:37:08 +01002410 .lname = "Verify fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +02002411 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +02002412 .off1 = td_var_offset(verify_fatal),
2413 .def = "0",
2414 .help = "Exit on a single verify failure, don't continue",
2415 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002416 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002417 .category = FIO_OPT_C_IO,
2418 .group = FIO_OPT_G_VERIFY,
Jens Axboea12a3b42007-08-09 10:20:54 +02002419 },
2420 {
Jens Axboeb463e932011-01-12 09:03:23 +01002421 .name = "verify_dump",
Jens Axboee8b0e952012-03-19 14:37:08 +01002422 .lname = "Verify dump",
Jens Axboeb463e932011-01-12 09:03:23 +01002423 .type = FIO_OPT_BOOL,
2424 .off1 = td_var_offset(verify_dump),
Jens Axboeef71e312011-10-25 22:43:36 +02002425 .def = "0",
Jens Axboeb463e932011-01-12 09:03:23 +01002426 .help = "Dump contents of good and bad blocks on failure",
2427 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002428 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002429 .category = FIO_OPT_C_IO,
2430 .group = FIO_OPT_G_VERIFY,
Jens Axboeb463e932011-01-12 09:03:23 +01002431 },
2432 {
Jens Axboee8462bd2009-07-06 12:59:04 +02002433 .name = "verify_async",
Jens Axboee8b0e952012-03-19 14:37:08 +01002434 .lname = "Verify asynchronously",
Jens Axboee8462bd2009-07-06 12:59:04 +02002435 .type = FIO_OPT_INT,
2436 .off1 = td_var_offset(verify_async),
2437 .def = "0",
2438 .help = "Number of async verifier threads to use",
2439 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002440 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002441 .category = FIO_OPT_C_IO,
2442 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002443 },
Jens Axboe9e144182010-06-15 14:25:36 +02002444 {
2445 .name = "verify_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002446 .lname = "Verify backlog",
Jens Axboe9e144182010-06-15 14:25:36 +02002447 .type = FIO_OPT_STR_VAL,
2448 .off1 = td_var_offset(verify_backlog),
2449 .help = "Verify after this number of blocks are written",
2450 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002451 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002452 .category = FIO_OPT_C_IO,
2453 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002454 },
2455 {
2456 .name = "verify_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002457 .lname = "Verify backlog batch",
Jens Axboe9e144182010-06-15 14:25:36 +02002458 .type = FIO_OPT_INT,
2459 .off1 = td_var_offset(verify_batch),
2460 .help = "Verify this number of IO blocks",
Jens Axboe0d29de82010-09-01 13:54:15 +02002461 .parent = "verify",
Jens Axboed71c1542012-03-16 20:16:59 +01002462 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002463 .category = FIO_OPT_C_IO,
2464 .group = FIO_OPT_G_VERIFY,
Jens Axboe9e144182010-06-15 14:25:36 +02002465 },
Jens Axboee8462bd2009-07-06 12:59:04 +02002466#ifdef FIO_HAVE_CPU_AFFINITY
2467 {
2468 .name = "verify_async_cpus",
Jens Axboee8b0e952012-03-19 14:37:08 +01002469 .lname = "Async verify CPUs",
Jens Axboee8462bd2009-07-06 12:59:04 +02002470 .type = FIO_OPT_STR,
2471 .cb = str_verify_cpus_allowed_cb,
2472 .help = "Set CPUs allowed for async verify threads",
2473 .parent = "verify_async",
Jens Axboed71c1542012-03-16 20:16:59 +01002474 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002475 .category = FIO_OPT_C_IO,
2476 .group = FIO_OPT_G_VERIFY,
Jens Axboee8462bd2009-07-06 12:59:04 +02002477 },
2478#endif
Jens Axboe51aa2da2013-01-21 10:55:02 -07002479 {
2480 .name = "experimental_verify",
2481 .off1 = td_var_offset(experimental_verify),
2482 .type = FIO_OPT_BOOL,
Jens Axboeb31eaac2013-01-24 15:29:58 -07002483 .help = "Enable experimental verification",
Jens Axboe836fcc02013-01-24 09:08:45 -07002484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
Jens Axboe51aa2da2013-01-21 10:55:02 -07002486 },
Jens Axboe0d29de82010-09-01 13:54:15 +02002487#ifdef FIO_HAVE_TRIM
2488 {
2489 .name = "trim_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01002490 .lname = "Trim percentage",
Jens Axboe0d29de82010-09-01 13:54:15 +02002491 .type = FIO_OPT_INT,
Jens Axboe203160d2012-03-29 21:17:12 +02002492 .off1 = td_var_offset(trim_percentage),
Jens Axboe20eb06b2012-03-16 19:57:23 +01002493 .minval = 0,
Jens Axboe0d29de82010-09-01 13:54:15 +02002494 .maxval = 100,
2495 .help = "Number of verify blocks to discard/trim",
2496 .parent = "verify",
2497 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002498 .interval = 1,
Jens Axboed71c1542012-03-16 20:16:59 +01002499 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002500 .category = FIO_OPT_C_IO,
2501 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002502 },
2503 {
2504 .name = "trim_verify_zero",
Jens Axboee8b0e952012-03-19 14:37:08 +01002505 .lname = "Verify trim zero",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002506 .type = FIO_OPT_BOOL,
Jens Axboe0d29de82010-09-01 13:54:15 +02002507 .help = "Verify that trim/discarded blocks are returned as zeroes",
2508 .off1 = td_var_offset(trim_zero),
2509 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002510 .hide = 1,
Jens Axboe0d29de82010-09-01 13:54:15 +02002511 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002512 .category = FIO_OPT_C_IO,
2513 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002514 },
2515 {
2516 .name = "trim_backlog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002517 .lname = "Trim backlog",
Jens Axboe0d29de82010-09-01 13:54:15 +02002518 .type = FIO_OPT_STR_VAL,
2519 .off1 = td_var_offset(trim_backlog),
2520 .help = "Trim after this number of blocks are written",
2521 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002522 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002523 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002526 },
2527 {
2528 .name = "trim_backlog_batch",
Jens Axboee8b0e952012-03-19 14:37:08 +01002529 .lname = "Trim backlog batch",
Jens Axboe0d29de82010-09-01 13:54:15 +02002530 .type = FIO_OPT_INT,
2531 .off1 = td_var_offset(trim_batch),
2532 .help = "Trim this number of IO blocks",
2533 .parent = "trim_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01002534 .hide = 1,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002535 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002536 .category = FIO_OPT_C_IO,
2537 .group = FIO_OPT_G_TRIM,
Jens Axboe0d29de82010-09-01 13:54:15 +02002538 },
2539#endif
Jens Axboee8462bd2009-07-06 12:59:04 +02002540 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002541 .name = "write_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002542 .lname = "Write I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002543 .type = FIO_OPT_STR_STORE,
2544 .off1 = td_var_offset(write_iolog_file),
2545 .help = "Store IO pattern to file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002546 .category = FIO_OPT_C_IO,
2547 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002548 },
2549 {
2550 .name = "read_iolog",
Jens Axboee8b0e952012-03-19 14:37:08 +01002551 .lname = "Read I/O log",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002552 .type = FIO_OPT_STR_STORE,
2553 .off1 = td_var_offset(read_iolog_file),
2554 .help = "Playback IO pattern from file",
Jens Axboee8b0e952012-03-19 14:37:08 +01002555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_IOLOG,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002557 },
2558 {
David Nellans64bbb862010-08-24 22:13:30 +02002559 .name = "replay_no_stall",
Jens Axboee8b0e952012-03-19 14:37:08 +01002560 .lname = "Don't stall on replay",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002561 .type = FIO_OPT_BOOL,
David Nellans64bbb862010-08-24 22:13:30 +02002562 .off1 = td_var_offset(no_stall),
2563 .def = "0",
Jens Axboe87e7a972010-08-25 09:01:25 +02002564 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002565 .hide = 1,
David Nellans64bbb862010-08-24 22:13:30 +02002566 .help = "Playback IO pattern file as fast as possible without stalls",
Jens Axboee8b0e952012-03-19 14:37:08 +01002567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_IOLOG,
David Nellans64bbb862010-08-24 22:13:30 +02002569 },
2570 {
David Nellansd1c46c02010-08-31 21:20:47 +02002571 .name = "replay_redirect",
Jens Axboee8b0e952012-03-19 14:37:08 +01002572 .lname = "Redirect device for replay",
David Nellansd1c46c02010-08-31 21:20:47 +02002573 .type = FIO_OPT_STR_STORE,
2574 .off1 = td_var_offset(replay_redirect),
2575 .parent = "read_iolog",
Jens Axboed71c1542012-03-16 20:16:59 +01002576 .hide = 1,
David Nellansd1c46c02010-08-31 21:20:47 +02002577 .help = "Replay all I/O onto this device, regardless of trace device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_IOLOG,
David Nellansd1c46c02010-08-31 21:20:47 +02002580 },
2581 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002582 .name = "exec_prerun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002583 .lname = "Pre-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002584 .type = FIO_OPT_STR_STORE,
2585 .off1 = td_var_offset(exec_prerun),
2586 .help = "Execute this file prior to running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002587 .category = FIO_OPT_C_GENERAL,
2588 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002589 },
2590 {
2591 .name = "exec_postrun",
Jens Axboee8b0e952012-03-19 14:37:08 +01002592 .lname = "Post-execute runnable",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002593 .type = FIO_OPT_STR_STORE,
2594 .off1 = td_var_offset(exec_postrun),
2595 .help = "Execute this file after running job",
Jens Axboee8b0e952012-03-19 14:37:08 +01002596 .category = FIO_OPT_C_GENERAL,
2597 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002598 },
2599#ifdef FIO_HAVE_IOSCHED_SWITCH
2600 {
2601 .name = "ioscheduler",
Jens Axboee8b0e952012-03-19 14:37:08 +01002602 .lname = "I/O scheduler",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002603 .type = FIO_OPT_STR_STORE,
2604 .off1 = td_var_offset(ioscheduler),
2605 .help = "Use this IO scheduler on the backing device",
Jens Axboee8b0e952012-03-19 14:37:08 +01002606 .category = FIO_OPT_C_FILE,
2607 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002608 },
2609#endif
2610 {
2611 .name = "zonesize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002612 .lname = "Zone size",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002613 .type = FIO_OPT_STR_VAL,
2614 .off1 = td_var_offset(zone_size),
Steven Noonaned335852012-01-31 13:58:00 +01002615 .help = "Amount of data to read per zone",
2616 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002617 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002618 .category = FIO_OPT_C_IO,
2619 .group = FIO_OPT_G_ZONE,
Steven Noonaned335852012-01-31 13:58:00 +01002620 },
2621 {
2622 .name = "zonerange",
Jens Axboee8b0e952012-03-19 14:37:08 +01002623 .lname = "Zone range",
Steven Noonaned335852012-01-31 13:58:00 +01002624 .type = FIO_OPT_STR_VAL,
2625 .off1 = td_var_offset(zone_range),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002626 .help = "Give size of an IO zone",
2627 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002628 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002629 .category = FIO_OPT_C_IO,
2630 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002631 },
2632 {
2633 .name = "zoneskip",
Jens Axboee8b0e952012-03-19 14:37:08 +01002634 .lname = "Zone skip",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002635 .type = FIO_OPT_STR_VAL,
2636 .off1 = td_var_offset(zone_skip),
2637 .help = "Space between IO zones",
2638 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002639 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002640 .category = FIO_OPT_C_IO,
2641 .group = FIO_OPT_G_ZONE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002642 },
2643 {
2644 .name = "lockmem",
Jens Axboee8b0e952012-03-19 14:37:08 +01002645 .lname = "Lock memory",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002646 .type = FIO_OPT_STR_VAL,
Jens Axboe1b79a072012-03-28 20:50:15 +02002647 .off1 = td_var_offset(lockmem),
Jens Axboe81c6b6c2013-04-10 19:30:50 +02002648 .help = "Lock down this amount of memory (per worker)",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002649 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002650 .interval = 1024 * 1024,
Jens Axboee8b0e952012-03-19 14:37:08 +01002651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002653 },
2654 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002655 .name = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002656 .lname = "Read/write mix read",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002657 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002658 .cb = str_rwmix_read_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002659 .maxval = 100,
2660 .help = "Percentage of mixed workload that is reads",
2661 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002662 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002663 .inverse = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002664 .category = FIO_OPT_C_IO,
2665 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002666 },
2667 {
2668 .name = "rwmixwrite",
Jens Axboee8b0e952012-03-19 14:37:08 +01002669 .lname = "Read/write mix write",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002670 .type = FIO_OPT_INT,
Jens Axboecb499fc2008-05-28 10:33:32 +02002671 .cb = str_rwmix_write_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002672 .maxval = 100,
2673 .help = "Percentage of mixed workload that is writes",
2674 .def = "50",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002675 .interval = 5,
Jens Axboe90265352012-03-19 20:29:44 +01002676 .inverse = "rwmixread",
Jens Axboee8b0e952012-03-19 14:37:08 +01002677 .category = FIO_OPT_C_IO,
2678 .group = FIO_OPT_G_RWMIX,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002679 },
2680 {
Jens Axboeafdf9352007-07-31 16:14:34 +02002681 .name = "rwmixcycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002682 .lname = "Read/write mix cycle",
Jens Axboe15ca1502008-04-07 09:26:02 +02002683 .type = FIO_OPT_DEPRECATED,
Jens Axboee8b0e952012-03-19 14:37:08 +01002684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_RWMIX,
Jens Axboeafdf9352007-07-31 16:14:34 +02002686 },
2687 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002688 .name = "nice",
Jens Axboee8b0e952012-03-19 14:37:08 +01002689 .lname = "Nice",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002690 .type = FIO_OPT_INT,
2691 .off1 = td_var_offset(nice),
2692 .help = "Set job CPU nice value",
2693 .minval = -19,
2694 .maxval = 20,
2695 .def = "0",
Jens Axboe20eb06b2012-03-16 19:57:23 +01002696 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002697 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002698 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002699 },
2700#ifdef FIO_HAVE_IOPRIO
2701 {
2702 .name = "prio",
Jens Axboee8b0e952012-03-19 14:37:08 +01002703 .lname = "I/O nice priority",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002704 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002705 .off1 = td_var_offset(ioprio),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002706 .help = "Set job IO priority value",
2707 .minval = 0,
2708 .maxval = 7,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002709 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002710 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002711 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002712 },
2713 {
2714 .name = "prioclass",
Jens Axboee8b0e952012-03-19 14:37:08 +01002715 .lname = "I/O nice priority class",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002716 .type = FIO_OPT_INT,
Jens Axboe28727df2012-03-29 08:33:15 +02002717 .off1 = td_var_offset(ioprio_class),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002718 .help = "Set job IO priority class",
2719 .minval = 0,
2720 .maxval = 3,
Jens Axboe20eb06b2012-03-16 19:57:23 +01002721 .interval = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002722 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002723 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002724 },
2725#endif
2726 {
2727 .name = "thinktime",
Jens Axboee8b0e952012-03-19 14:37:08 +01002728 .lname = "Thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002729 .type = FIO_OPT_INT,
2730 .off1 = td_var_offset(thinktime),
2731 .help = "Idle time between IO buffers (usec)",
2732 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002733 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002734 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002735 },
2736 {
2737 .name = "thinktime_spin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002738 .lname = "Thinktime spin",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002739 .type = FIO_OPT_INT,
2740 .off1 = td_var_offset(thinktime_spin),
2741 .help = "Start think time by spinning this amount (usec)",
2742 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +02002743 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002744 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002745 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002746 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002747 },
2748 {
2749 .name = "thinktime_blocks",
Jens Axboee8b0e952012-03-19 14:37:08 +01002750 .lname = "Thinktime blocks",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002751 .type = FIO_OPT_INT,
2752 .off1 = td_var_offset(thinktime_blocks),
2753 .help = "IO buffer period between 'thinktime'",
2754 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +02002755 .parent = "thinktime",
Jens Axboed71c1542012-03-16 20:16:59 +01002756 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002757 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002758 .group = FIO_OPT_G_THINKTIME,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002759 },
2760 {
2761 .name = "rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002762 .lname = "I/O rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002763 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002764 .off1 = td_var_offset(rate[DDIR_READ]),
2765 .off2 = td_var_offset(rate[DDIR_WRITE]),
2766 .off3 = td_var_offset(rate[DDIR_TRIM]),
Jens Axboe214e1ec2007-03-15 10:48:13 +01002767 .help = "Set bandwidth rate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002768 .category = FIO_OPT_C_IO,
2769 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002770 },
2771 {
2772 .name = "ratemin",
Jens Axboee8b0e952012-03-19 14:37:08 +01002773 .lname = "I/O min rate",
Jens Axboee01b22b2009-06-09 15:43:25 +02002774 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002775 .off1 = td_var_offset(ratemin[DDIR_READ]),
2776 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2777 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002778 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02002779 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002780 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002781 .category = FIO_OPT_C_IO,
2782 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002783 },
2784 {
2785 .name = "rate_iops",
Jens Axboee8b0e952012-03-19 14:37:08 +01002786 .lname = "I/O rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002787 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002788 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2789 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2790 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
Jens Axboe4e991c22007-03-15 11:41:11 +01002791 .help = "Limit IO used to this number of IO operations/sec",
Jens Axboed71c1542012-03-16 20:16:59 +01002792 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002793 .category = FIO_OPT_C_IO,
2794 .group = FIO_OPT_G_RATE,
Jens Axboe4e991c22007-03-15 11:41:11 +01002795 },
2796 {
2797 .name = "rate_iops_min",
Jens Axboee8b0e952012-03-19 14:37:08 +01002798 .lname = "I/O min rate IOPS",
Jens Axboee01b22b2009-06-09 15:43:25 +02002799 .type = FIO_OPT_INT,
Shaohua Li6eaf09d2012-09-14 08:49:43 +02002800 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2801 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2802 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
Bruce Cran03e20d62011-01-02 20:14:54 +01002803 .help = "Job must meet this rate or it will be shut down",
Jens Axboeafdf9352007-07-31 16:14:34 +02002804 .parent = "rate_iops",
Jens Axboed71c1542012-03-16 20:16:59 +01002805 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002806 .category = FIO_OPT_C_IO,
2807 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002808 },
2809 {
2810 .name = "ratecycle",
Jens Axboee8b0e952012-03-19 14:37:08 +01002811 .lname = "I/O rate cycle",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002812 .type = FIO_OPT_INT,
2813 .off1 = td_var_offset(ratecycle),
2814 .help = "Window average for rate limits (msec)",
2815 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02002816 .parent = "rate",
Jens Axboed71c1542012-03-16 20:16:59 +01002817 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002818 .category = FIO_OPT_C_IO,
2819 .group = FIO_OPT_G_RATE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002820 },
2821 {
Jens Axboe15501532012-10-24 16:37:45 +02002822 .name = "max_latency",
2823 .type = FIO_OPT_INT,
2824 .off1 = td_var_offset(max_latency),
2825 .help = "Maximum tolerated IO latency (usec)",
Jens Axboe1e5324e2012-11-14 14:25:31 -07002826 .category = FIO_OPT_C_IO,
Jens Axboe3e260a42013-12-09 12:38:53 -07002827 .group = FIO_OPT_G_LATPROF,
2828 },
2829 {
2830 .name = "latency_target",
2831 .lname = "Latency Target (usec)",
2832 .type = FIO_OPT_STR_VAL_TIME,
2833 .off1 = td_var_offset(latency_target),
2834 .help = "Ramp to max queue depth supporting this latency",
2835 .category = FIO_OPT_C_IO,
2836 .group = FIO_OPT_G_LATPROF,
2837 },
2838 {
2839 .name = "latency_window",
2840 .lname = "Latency Window (usec)",
2841 .type = FIO_OPT_STR_VAL_TIME,
2842 .off1 = td_var_offset(latency_window),
2843 .help = "Time to sustain latency_target",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_LATPROF,
2846 },
2847 {
2848 .name = "latency_percentile",
2849 .lname = "Latency Percentile",
2850 .type = FIO_OPT_FLOAT_LIST,
2851 .off1 = td_var_offset(latency_percentile),
2852 .help = "Percentile of IOs must be below latency_target",
2853 .def = "100",
2854 .maxlen = 1,
2855 .minfp = 0.0,
2856 .maxfp = 100.0,
2857 .category = FIO_OPT_C_IO,
2858 .group = FIO_OPT_G_LATPROF,
Jens Axboe15501532012-10-24 16:37:45 +02002859 },
2860 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002861 .name = "invalidate",
Jens Axboee8b0e952012-03-19 14:37:08 +01002862 .lname = "Cache invalidate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002863 .type = FIO_OPT_BOOL,
2864 .off1 = td_var_offset(invalidate_cache),
2865 .help = "Invalidate buffer/page cache prior to running job",
2866 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002867 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002868 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002869 },
2870 {
2871 .name = "sync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002872 .lname = "Synchronous I/O",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002873 .type = FIO_OPT_BOOL,
2874 .off1 = td_var_offset(sync_io),
2875 .help = "Use O_SYNC for buffered writes",
2876 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02002877 .parent = "buffered",
Jens Axboed71c1542012-03-16 20:16:59 +01002878 .hide = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01002879 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01002880 .group = FIO_OPT_G_IO_TYPE,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002881 },
2882 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01002883 .name = "create_serialize",
Jens Axboee8b0e952012-03-19 14:37:08 +01002884 .lname = "Create serialize",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002885 .type = FIO_OPT_BOOL,
2886 .off1 = td_var_offset(create_serialize),
2887 .help = "Serialize creating of job files",
2888 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002889 .category = FIO_OPT_C_FILE,
2890 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002891 },
2892 {
2893 .name = "create_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002894 .lname = "Create fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002895 .type = FIO_OPT_BOOL,
2896 .off1 = td_var_offset(create_fsync),
Bruce Cran03e20d62011-01-02 20:14:54 +01002897 .help = "fsync file after creation",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002898 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01002899 .category = FIO_OPT_C_FILE,
2900 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002901 },
2902 {
Jens Axboe814452b2009-03-04 12:53:13 +01002903 .name = "create_on_open",
Jens Axboee8b0e952012-03-19 14:37:08 +01002904 .lname = "Create on open",
Jens Axboe814452b2009-03-04 12:53:13 +01002905 .type = FIO_OPT_BOOL,
2906 .off1 = td_var_offset(create_on_open),
2907 .help = "Create files when they are opened for IO",
2908 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002909 .category = FIO_OPT_C_FILE,
2910 .group = FIO_OPT_G_INVALID,
Jens Axboe814452b2009-03-04 12:53:13 +01002911 },
Jens Axboe0b9d69e2009-09-11 22:29:54 +02002912 {
Jens Axboe25460cf2012-05-02 13:58:02 +02002913 .name = "create_only",
2914 .type = FIO_OPT_BOOL,
2915 .off1 = td_var_offset(create_only),
2916 .help = "Only perform file creation phase",
Jens Axboed17fda72012-05-07 09:56:00 +02002917 .category = FIO_OPT_C_FILE,
Jens Axboe25460cf2012-05-02 13:58:02 +02002918 .def = "0",
2919 },
2920 {
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002921 .name = "pre_read",
Jens Axboee8b0e952012-03-19 14:37:08 +01002922 .lname = "Pre-read files",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002923 .type = FIO_OPT_BOOL,
2924 .off1 = td_var_offset(pre_read),
Bruce Cran03e20d62011-01-02 20:14:54 +01002925 .help = "Pre-read files before starting official testing",
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002926 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002927 .category = FIO_OPT_C_FILE,
2928 .group = FIO_OPT_G_INVALID,
Zhang, Yanminafad68f2009-05-20 11:30:55 +02002929 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002930#ifdef FIO_HAVE_CPU_AFFINITY
2931 {
2932 .name = "cpumask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002933 .lname = "CPU mask",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002934 .type = FIO_OPT_INT,
2935 .cb = str_cpumask_cb,
2936 .help = "CPU affinity mask",
Jens Axboee8b0e952012-03-19 14:37:08 +01002937 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002938 .group = FIO_OPT_G_CRED,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002939 },
Jens Axboed2e268b2007-06-15 10:33:49 +02002940 {
2941 .name = "cpus_allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002942 .lname = "CPUs allowed",
Jens Axboed2e268b2007-06-15 10:33:49 +02002943 .type = FIO_OPT_STR,
2944 .cb = str_cpus_allowed_cb,
2945 .help = "Set CPUs allowed",
Jens Axboee8b0e952012-03-19 14:37:08 +01002946 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01002947 .group = FIO_OPT_G_CRED,
Jens Axboed2e268b2007-06-15 10:33:49 +02002948 },
Jens Axboec2acfba2014-02-27 15:52:02 -08002949 {
2950 .name = "cpus_allowed_policy",
2951 .lname = "CPUs allowed distribution policy",
2952 .type = FIO_OPT_STR,
2953 .off1 = td_var_offset(cpus_allowed_policy),
2954 .help = "Distribution policy for cpus_allowed",
2955 .parent = "cpus_allowed",
2956 .prio = 1,
2957 .posval = {
2958 { .ival = "shared",
2959 .oval = FIO_CPUS_SHARED,
2960 .help = "Mask shared between threads",
2961 },
2962 { .ival = "split",
2963 .oval = FIO_CPUS_SPLIT,
2964 .help = "Mask split between threads",
2965 },
2966 },
2967 .category = FIO_OPT_C_GENERAL,
2968 .group = FIO_OPT_G_CRED,
2969 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01002970#endif
Jens Axboe67bf9822013-01-10 11:23:19 +01002971#ifdef CONFIG_LIBNUMA
Yufei Rend0b937e2012-10-19 23:11:52 -04002972 {
2973 .name = "numa_cpu_nodes",
2974 .type = FIO_OPT_STR,
2975 .cb = str_numa_cpunodes_cb,
2976 .help = "NUMA CPU nodes bind",
Jens Axboe6be54b22013-04-10 13:08:02 +02002977 .category = FIO_OPT_C_GENERAL,
2978 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002979 },
2980 {
2981 .name = "numa_mem_policy",
2982 .type = FIO_OPT_STR,
2983 .cb = str_numa_mpol_cb,
2984 .help = "NUMA memory policy setup",
Jens Axboe6be54b22013-04-10 13:08:02 +02002985 .category = FIO_OPT_C_GENERAL,
2986 .group = FIO_OPT_G_INVALID,
Yufei Rend0b937e2012-10-19 23:11:52 -04002987 },
2988#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +01002989 {
2990 .name = "end_fsync",
Jens Axboee8b0e952012-03-19 14:37:08 +01002991 .lname = "End fsync",
Jens Axboe214e1ec2007-03-15 10:48:13 +01002992 .type = FIO_OPT_BOOL,
2993 .off1 = td_var_offset(end_fsync),
2994 .help = "Include fsync at the end of job",
2995 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01002996 .category = FIO_OPT_C_FILE,
2997 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01002998 },
2999 {
3000 .name = "fsync_on_close",
Jens Axboee8b0e952012-03-19 14:37:08 +01003001 .lname = "Fsync on close",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003002 .type = FIO_OPT_BOOL,
3003 .off1 = td_var_offset(fsync_on_close),
3004 .help = "fsync files on close",
3005 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003006 .category = FIO_OPT_C_FILE,
3007 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003008 },
3009 {
3010 .name = "unlink",
Jens Axboee8b0e952012-03-19 14:37:08 +01003011 .lname = "Unlink file",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003012 .type = FIO_OPT_BOOL,
3013 .off1 = td_var_offset(unlink),
3014 .help = "Unlink created files after job has completed",
3015 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003016 .category = FIO_OPT_C_FILE,
3017 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003018 },
3019 {
3020 .name = "exitall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003021 .lname = "Exit-all on terminate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003022 .type = FIO_OPT_STR_SET,
3023 .cb = str_exitall_cb,
3024 .help = "Terminate all jobs when one exits",
Jens Axboee8b0e952012-03-19 14:37:08 +01003025 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003026 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003027 },
3028 {
3029 .name = "stonewall",
Jens Axboee8b0e952012-03-19 14:37:08 +01003030 .lname = "Wait for previous",
Jens Axboed3923652011-08-03 12:38:39 +02003031 .alias = "wait_for_previous",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003032 .type = FIO_OPT_STR_SET,
3033 .off1 = td_var_offset(stonewall),
3034 .help = "Insert a hard barrier between this job and previous",
Jens Axboee8b0e952012-03-19 14:37:08 +01003035 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003036 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003037 },
3038 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01003039 .name = "new_group",
Jens Axboee8b0e952012-03-19 14:37:08 +01003040 .lname = "New group",
Jens Axboeb3d62a72007-03-20 14:23:26 +01003041 .type = FIO_OPT_STR_SET,
3042 .off1 = td_var_offset(new_group),
3043 .help = "Mark the start of a new group (for reporting)",
Jens Axboee8b0e952012-03-19 14:37:08 +01003044 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003045 .group = FIO_OPT_G_PROCESS,
Jens Axboeb3d62a72007-03-20 14:23:26 +01003046 },
3047 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003048 .name = "thread",
Jens Axboee8b0e952012-03-19 14:37:08 +01003049 .lname = "Thread",
Jens Axboe214e1ec2007-03-15 10:48:13 +01003050 .type = FIO_OPT_STR_SET,
3051 .off1 = td_var_offset(use_thread),
Jens Axboe20eb06b2012-03-16 19:57:23 +01003052 .help = "Use threads instead of processes",
Jens Axboeef7035a2014-06-18 15:30:09 -07003053#ifdef CONFIG_NO_SHM
3054 .def = "1",
3055 .no_warn_def = 1,
3056#endif
Jens Axboee8b0e952012-03-19 14:37:08 +01003057 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003058 .group = FIO_OPT_G_PROCESS,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003059 },
3060 {
3061 .name = "write_bw_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003062 .lname = "Write bandwidth log",
Jens Axboe203160d2012-03-29 21:17:12 +02003063 .type = FIO_OPT_STR_STORE,
3064 .off1 = td_var_offset(bw_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003065 .help = "Write log of bandwidth during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003066 .category = FIO_OPT_C_LOG,
3067 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003068 },
3069 {
3070 .name = "write_lat_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003071 .lname = "Write latency log",
Jens Axboe203160d2012-03-29 21:17:12 +02003072 .type = FIO_OPT_STR_STORE,
3073 .off1 = td_var_offset(lat_log_file),
Jens Axboe214e1ec2007-03-15 10:48:13 +01003074 .help = "Write log of latency during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003075 .category = FIO_OPT_C_LOG,
3076 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003077 },
3078 {
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003079 .name = "write_iops_log",
Jens Axboee8b0e952012-03-19 14:37:08 +01003080 .lname = "Write IOPS log",
Jens Axboe577c83b2013-05-29 10:45:16 +02003081 .type = FIO_OPT_STR_STORE,
Jens Axboe203160d2012-03-29 21:17:12 +02003082 .off1 = td_var_offset(iops_log_file),
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003083 .help = "Write log of IOPS during run",
Jens Axboee8b0e952012-03-19 14:37:08 +01003084 .category = FIO_OPT_C_LOG,
3085 .group = FIO_OPT_G_INVALID,
Jens Axboec8eeb9d2011-10-05 14:02:22 +02003086 },
3087 {
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003088 .name = "log_avg_msec",
Jens Axboee8b0e952012-03-19 14:37:08 +01003089 .lname = "Log averaging (msec)",
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003090 .type = FIO_OPT_INT,
3091 .off1 = td_var_offset(log_avg_msec),
3092 .help = "Average bw/iops/lat logs over this period of time",
3093 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003094 .category = FIO_OPT_C_LOG,
3095 .group = FIO_OPT_G_INVALID,
Jens Axboeb8bc8cb2011-12-01 09:04:31 +01003096 },
3097 {
Jens Axboeccefd5f2014-06-30 20:59:03 -06003098 .name = "log_offset",
3099 .lname = "Log offset of IO",
3100 .type = FIO_OPT_BOOL,
3101 .off1 = td_var_offset(log_offset),
3102 .help = "Include offset of IO for each log entry",
3103 .def = "0",
3104 .category = FIO_OPT_C_LOG,
3105 .group = FIO_OPT_G_INVALID,
3106 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003107#ifdef CONFIG_ZLIB
3108 {
3109 .name = "log_compression",
3110 .lname = "Log compression",
3111 .type = FIO_OPT_INT,
3112 .off1 = td_var_offset(log_gz),
3113 .help = "Log in compressed chunks of this size",
3114 .minval = 32 * 1024 * 1024ULL,
3115 .maxval = 512 * 1024 * 1024ULL,
3116 .category = FIO_OPT_C_LOG,
3117 .group = FIO_OPT_G_INVALID,
3118 },
Jens Axboebac4af12014-07-03 13:42:28 -06003119 {
3120 .name = "log_store_compressed",
3121 .lname = "Log store compressed",
3122 .type = FIO_OPT_BOOL,
3123 .off1 = td_var_offset(log_gz_store),
3124 .help = "Store logs in a compressed format",
3125 .category = FIO_OPT_C_LOG,
3126 .group = FIO_OPT_G_INVALID,
3127 },
Jens Axboe38a812d2014-07-03 09:10:39 -06003128#endif
Jens Axboeccefd5f2014-06-30 20:59:03 -06003129 {
Jens Axboec504ee52012-03-20 11:29:09 +01003130 .name = "bwavgtime",
3131 .lname = "Bandwidth average time",
3132 .type = FIO_OPT_INT,
3133 .off1 = td_var_offset(bw_avg_time),
3134 .help = "Time window over which to calculate bandwidth"
3135 " (msec)",
3136 .def = "500",
3137 .parent = "write_bw_log",
3138 .hide = 1,
3139 .interval = 100,
3140 .category = FIO_OPT_C_LOG,
3141 .group = FIO_OPT_G_INVALID,
3142 },
3143 {
3144 .name = "iopsavgtime",
3145 .lname = "IOPS average time",
3146 .type = FIO_OPT_INT,
3147 .off1 = td_var_offset(iops_avg_time),
3148 .help = "Time window over which to calculate IOPS (msec)",
3149 .def = "500",
3150 .parent = "write_iops_log",
3151 .hide = 1,
3152 .interval = 100,
3153 .category = FIO_OPT_C_LOG,
3154 .group = FIO_OPT_G_INVALID,
3155 },
3156 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003157 .name = "group_reporting",
Jens Axboee8b0e952012-03-19 14:37:08 +01003158 .lname = "Group reporting",
Jens Axboed2507042013-05-23 20:24:12 +02003159 .type = FIO_OPT_STR_SET,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003160 .off1 = td_var_offset(group_reporting),
3161 .help = "Do reporting on a per-group basis",
Jens Axboe10860052012-03-19 20:56:53 +01003162 .category = FIO_OPT_C_STAT,
Jens Axboee8b0e952012-03-19 14:37:08 +01003163 .group = FIO_OPT_G_INVALID,
Jens Axboe214e1ec2007-03-15 10:48:13 +01003164 },
3165 {
Jens Axboee9459e52007-04-17 15:46:32 +02003166 .name = "zero_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003167 .lname = "Zero I/O buffers",
Jens Axboee9459e52007-04-17 15:46:32 +02003168 .type = FIO_OPT_STR_SET,
3169 .off1 = td_var_offset(zero_buffers),
3170 .help = "Init IO buffers to all zeroes",
Jens Axboee8b0e952012-03-19 14:37:08 +01003171 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003172 .group = FIO_OPT_G_IO_BUF,
Jens Axboee9459e52007-04-17 15:46:32 +02003173 },
Jens Axboe5973caf2008-05-21 19:52:35 +02003174 {
3175 .name = "refill_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003176 .lname = "Refill I/O buffers",
Jens Axboe5973caf2008-05-21 19:52:35 +02003177 .type = FIO_OPT_STR_SET,
3178 .off1 = td_var_offset(refill_buffers),
3179 .help = "Refill IO buffers on every IO submit",
Jens Axboee8b0e952012-03-19 14:37:08 +01003180 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003181 .group = FIO_OPT_G_IO_BUF,
Jens Axboe5973caf2008-05-21 19:52:35 +02003182 },
Yu-ju Hong83349192011-08-13 00:53:44 +02003183 {
Jens Axboefd684182011-09-19 09:24:44 +02003184 .name = "scramble_buffers",
Jens Axboee8b0e952012-03-19 14:37:08 +01003185 .lname = "Scramble I/O buffers",
Jens Axboefd684182011-09-19 09:24:44 +02003186 .type = FIO_OPT_BOOL,
3187 .off1 = td_var_offset(scramble_buffers),
3188 .help = "Slightly scramble buffers on every IO submit",
3189 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003190 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003191 .group = FIO_OPT_G_IO_BUF,
Jens Axboefd684182011-09-19 09:24:44 +02003192 },
3193 {
Jens Axboece35b1e2014-01-14 15:35:58 -07003194 .name = "buffer_pattern",
3195 .lname = "Buffer pattern",
3196 .type = FIO_OPT_STR,
3197 .cb = str_buffer_pattern_cb,
3198 .help = "Fill pattern for IO buffers",
3199 .category = FIO_OPT_C_IO,
3200 .group = FIO_OPT_G_IO_BUF,
3201 },
3202 {
Jens Axboe9c426842012-03-02 21:02:12 +01003203 .name = "buffer_compress_percentage",
Jens Axboee8b0e952012-03-19 14:37:08 +01003204 .lname = "Buffer compression percentage",
Jens Axboe9c426842012-03-02 21:02:12 +01003205 .type = FIO_OPT_INT,
Jens Axboebedc9dc2014-03-17 12:51:09 -06003206 .cb = str_buffer_compress_cb,
Jens Axboe9c426842012-03-02 21:02:12 +01003207 .maxval = 100,
Peter Oberparleitere7f5de92014-02-20 14:20:07 +01003208 .minval = 0,
Jens Axboe9c426842012-03-02 21:02:12 +01003209 .help = "How compressible the buffer is (approximately)",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003210 .interval = 5,
Jens Axboee8b0e952012-03-19 14:37:08 +01003211 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003212 .group = FIO_OPT_G_IO_BUF,
Jens Axboe9c426842012-03-02 21:02:12 +01003213 },
3214 {
Jens Axboef97a43a2012-03-09 19:06:24 +01003215 .name = "buffer_compress_chunk",
Jens Axboee8b0e952012-03-19 14:37:08 +01003216 .lname = "Buffer compression chunk size",
Jens Axboef97a43a2012-03-09 19:06:24 +01003217 .type = FIO_OPT_INT,
3218 .off1 = td_var_offset(compress_chunk),
Jens Axboe207b18e2012-03-09 19:11:25 +01003219 .parent = "buffer_compress_percentage",
Jens Axboed71c1542012-03-16 20:16:59 +01003220 .hide = 1,
Jens Axboef97a43a2012-03-09 19:06:24 +01003221 .help = "Size of compressible region in buffer",
Jens Axboe20eb06b2012-03-16 19:57:23 +01003222 .interval = 256,
Jens Axboee8b0e952012-03-19 14:37:08 +01003223 .category = FIO_OPT_C_IO,
Jens Axboe3ceb4582012-03-19 21:27:02 +01003224 .group = FIO_OPT_G_IO_BUF,
Jens Axboef97a43a2012-03-09 19:06:24 +01003225 },
3226 {
Yu-ju Hong83349192011-08-13 00:53:44 +02003227 .name = "clat_percentiles",
Jens Axboee8b0e952012-03-19 14:37:08 +01003228 .lname = "Completion latency percentiles",
Yu-ju Hong83349192011-08-13 00:53:44 +02003229 .type = FIO_OPT_BOOL,
3230 .off1 = td_var_offset(clat_percentiles),
3231 .help = "Enable the reporting of completion latency percentiles",
Jens Axboe467b35e2011-10-13 08:53:24 +02003232 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003233 .category = FIO_OPT_C_STAT,
3234 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003235 },
3236 {
3237 .name = "percentile_list",
Jens Axboee8b0e952012-03-19 14:37:08 +01003238 .lname = "Completion latency percentile list",
Yu-ju Hong83349192011-08-13 00:53:44 +02003239 .type = FIO_OPT_FLOAT_LIST,
3240 .off1 = td_var_offset(percentile_list),
Vincent Kang Fu435d1952013-02-06 08:43:40 +01003241 .off2 = td_var_offset(percentile_precision),
Yu-ju Hong83349192011-08-13 00:53:44 +02003242 .help = "Specify a custom list of percentiles to report",
Vincent Kang Fufd112d32013-02-02 09:28:55 +01003243 .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 +02003244 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3245 .minfp = 0.0,
3246 .maxfp = 100.0,
Jens Axboee8b0e952012-03-19 14:37:08 +01003247 .category = FIO_OPT_C_STAT,
3248 .group = FIO_OPT_G_INVALID,
Yu-ju Hong83349192011-08-13 00:53:44 +02003249 },
3250
Jens Axboe0a839f32007-04-26 09:02:34 +02003251#ifdef FIO_HAVE_DISK_UTIL
3252 {
3253 .name = "disk_util",
Jens Axboee8b0e952012-03-19 14:37:08 +01003254 .lname = "Disk utilization",
Jens Axboe0a839f32007-04-26 09:02:34 +02003255 .type = FIO_OPT_BOOL,
3256 .off1 = td_var_offset(do_disk_util),
Jens Axboef66ab3c2008-06-05 11:48:22 +02003257 .help = "Log disk utilization statistics",
Jens Axboe0a839f32007-04-26 09:02:34 +02003258 .def = "1",
Jens Axboee8b0e952012-03-19 14:37:08 +01003259 .category = FIO_OPT_C_STAT,
3260 .group = FIO_OPT_G_INVALID,
Jens Axboe0a839f32007-04-26 09:02:34 +02003261 },
3262#endif
Jens Axboee9459e52007-04-17 15:46:32 +02003263 {
Jens Axboe993bf482008-11-14 13:04:53 +01003264 .name = "gtod_reduce",
Jens Axboee8b0e952012-03-19 14:37:08 +01003265 .lname = "Reduce gettimeofday() calls",
Jens Axboe993bf482008-11-14 13:04:53 +01003266 .type = FIO_OPT_BOOL,
3267 .help = "Greatly reduce number of gettimeofday() calls",
3268 .cb = str_gtod_reduce_cb,
3269 .def = "0",
Jens Axboea4ed77f2012-03-20 10:19:44 +01003270 .hide_on_set = 1,
Jens Axboee8b0e952012-03-19 14:37:08 +01003271 .category = FIO_OPT_C_STAT,
3272 .group = FIO_OPT_G_INVALID,
Jens Axboe993bf482008-11-14 13:04:53 +01003273 },
3274 {
Jens Axboe02af0982010-06-24 09:59:34 +02003275 .name = "disable_lat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003276 .lname = "Disable all latency stats",
Jens Axboe02af0982010-06-24 09:59:34 +02003277 .type = FIO_OPT_BOOL,
3278 .off1 = td_var_offset(disable_lat),
3279 .help = "Disable latency numbers",
3280 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003281 .hide = 1,
Jens Axboe02af0982010-06-24 09:59:34 +02003282 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003283 .category = FIO_OPT_C_STAT,
3284 .group = FIO_OPT_G_INVALID,
Jens Axboe02af0982010-06-24 09:59:34 +02003285 },
3286 {
Jens Axboe9520ebb2008-10-16 21:03:27 +02003287 .name = "disable_clat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003288 .lname = "Disable completion latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003289 .type = FIO_OPT_BOOL,
3290 .off1 = td_var_offset(disable_clat),
3291 .help = "Disable completion latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003292 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003293 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003294 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003295 .category = FIO_OPT_C_STAT,
3296 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003297 },
3298 {
3299 .name = "disable_slat",
Jens Axboee8b0e952012-03-19 14:37:08 +01003300 .lname = "Disable submission latency stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003301 .type = FIO_OPT_BOOL,
3302 .off1 = td_var_offset(disable_slat),
Bruce Cran03e20d62011-01-02 20:14:54 +01003303 .help = "Disable submission latency numbers",
Jens Axboe993bf482008-11-14 13:04:53 +01003304 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003305 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003306 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003307 .category = FIO_OPT_C_STAT,
3308 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003309 },
3310 {
3311 .name = "disable_bw_measurement",
Jens Axboee8b0e952012-03-19 14:37:08 +01003312 .lname = "Disable bandwidth stats",
Jens Axboe9520ebb2008-10-16 21:03:27 +02003313 .type = FIO_OPT_BOOL,
3314 .off1 = td_var_offset(disable_bw),
3315 .help = "Disable bandwidth logging",
Jens Axboe993bf482008-11-14 13:04:53 +01003316 .parent = "gtod_reduce",
Jens Axboed71c1542012-03-16 20:16:59 +01003317 .hide = 1,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003318 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003319 .category = FIO_OPT_C_STAT,
3320 .group = FIO_OPT_G_INVALID,
Jens Axboe9520ebb2008-10-16 21:03:27 +02003321 },
3322 {
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003323 .name = "gtod_cpu",
Jens Axboee8b0e952012-03-19 14:37:08 +01003324 .lname = "Dedicated gettimeofday() CPU",
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003325 .type = FIO_OPT_INT,
3326 .cb = str_gtod_cpu_cb,
Bruce Cran03e20d62011-01-02 20:14:54 +01003327 .help = "Set up dedicated gettimeofday() thread on this CPU",
Jens Axboe29d43ff2009-07-01 10:42:18 +02003328 .verify = gtod_cpu_verify,
Jens Axboee8b0e952012-03-19 14:37:08 +01003329 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003330 .group = FIO_OPT_G_CLOCK,
Jens Axboebe4ecfd2008-12-08 14:10:52 +01003331 },
3332 {
Jens Axboe771e58b2013-01-30 12:56:23 +01003333 .name = "unified_rw_reporting",
3334 .type = FIO_OPT_BOOL,
3335 .off1 = td_var_offset(unified_rw_rep),
3336 .help = "Unify reporting across data direction",
3337 .def = "0",
Jens Axboe90b7a962013-02-04 12:51:09 +01003338 .category = FIO_OPT_C_GENERAL,
3339 .group = FIO_OPT_G_INVALID,
Jens Axboe771e58b2013-01-30 12:56:23 +01003340 },
3341 {
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003342 .name = "continue_on_error",
Jens Axboee8b0e952012-03-19 14:37:08 +01003343 .lname = "Continue on error",
Steven Lang06842022011-11-17 09:45:17 +01003344 .type = FIO_OPT_STR,
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003345 .off1 = td_var_offset(continue_on_error),
Bruce Cran03e20d62011-01-02 20:14:54 +01003346 .help = "Continue on non-fatal errors during IO",
Steven Lang06842022011-11-17 09:45:17 +01003347 .def = "none",
Jens Axboee8b0e952012-03-19 14:37:08 +01003348 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003349 .group = FIO_OPT_G_ERR,
Steven Lang06842022011-11-17 09:45:17 +01003350 .posval = {
3351 { .ival = "none",
3352 .oval = ERROR_TYPE_NONE,
3353 .help = "Exit when an error is encountered",
3354 },
3355 { .ival = "read",
3356 .oval = ERROR_TYPE_READ,
3357 .help = "Continue on read errors only",
3358 },
3359 { .ival = "write",
3360 .oval = ERROR_TYPE_WRITE,
3361 .help = "Continue on write errors only",
3362 },
3363 { .ival = "io",
3364 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3365 .help = "Continue on any IO errors",
3366 },
3367 { .ival = "verify",
3368 .oval = ERROR_TYPE_VERIFY,
3369 .help = "Continue on verify errors only",
3370 },
3371 { .ival = "all",
3372 .oval = ERROR_TYPE_ANY,
3373 .help = "Continue on all io and verify errors",
3374 },
3375 { .ival = "0",
3376 .oval = ERROR_TYPE_NONE,
3377 .help = "Alias for 'none'",
3378 },
3379 { .ival = "1",
3380 .oval = ERROR_TYPE_ANY,
3381 .help = "Alias for 'all'",
3382 },
3383 },
Radha Ramachandranf2bba182009-06-15 08:40:16 +02003384 },
3385 {
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003386 .name = "ignore_error",
3387 .type = FIO_OPT_STR,
3388 .cb = str_ignore_error_cb,
3389 .help = "Set a specific list of errors to ignore",
3390 .parent = "rw",
Jens Axboea94eb992012-09-24 18:46:34 +02003391 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003392 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003393 },
3394 {
3395 .name = "error_dump",
3396 .type = FIO_OPT_BOOL,
3397 .off1 = td_var_offset(error_dump),
3398 .def = "0",
3399 .help = "Dump info on each error",
Jens Axboea94eb992012-09-24 18:46:34 +02003400 .category = FIO_OPT_C_GENERAL,
Jens Axboebc3f5522012-09-27 19:28:11 +02003401 .group = FIO_OPT_G_ERR,
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003402 },
Dmitry Monakhov8b28bd42012-09-23 15:46:09 +04003403 {
Jens Axboe9ac8a792009-11-13 21:23:07 +01003404 .name = "profile",
Jens Axboee8b0e952012-03-19 14:37:08 +01003405 .lname = "Profile",
Jens Axboe79d16312010-03-04 12:43:20 +01003406 .type = FIO_OPT_STR_STORE,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003407 .off1 = td_var_offset(profile),
Jens Axboe9ac8a792009-11-13 21:23:07 +01003408 .help = "Select a specific builtin performance test",
Jens Axboe13fca822012-03-31 13:55:54 +02003409 .category = FIO_OPT_C_PROFILE,
Jens Axboee8b0e952012-03-19 14:37:08 +01003410 .group = FIO_OPT_G_INVALID,
Jens Axboe9ac8a792009-11-13 21:23:07 +01003411 },
3412 {
Jens Axboea696fa22009-12-04 10:05:02 +01003413 .name = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003414 .lname = "Cgroup",
Jens Axboea696fa22009-12-04 10:05:02 +01003415 .type = FIO_OPT_STR_STORE,
3416 .off1 = td_var_offset(cgroup),
3417 .help = "Add job to cgroup of this name",
Jens Axboee8b0e952012-03-19 14:37:08 +01003418 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003419 .group = FIO_OPT_G_CGROUP,
3420 },
3421 {
3422 .name = "cgroup_nodelete",
3423 .lname = "Cgroup no-delete",
3424 .type = FIO_OPT_BOOL,
3425 .off1 = td_var_offset(cgroup_nodelete),
3426 .help = "Do not delete cgroups after job completion",
3427 .def = "0",
3428 .parent = "cgroup",
3429 .category = FIO_OPT_C_GENERAL,
3430 .group = FIO_OPT_G_CGROUP,
Jens Axboea696fa22009-12-04 10:05:02 +01003431 },
3432 {
3433 .name = "cgroup_weight",
Jens Axboee8b0e952012-03-19 14:37:08 +01003434 .lname = "Cgroup weight",
Jens Axboea696fa22009-12-04 10:05:02 +01003435 .type = FIO_OPT_INT,
3436 .off1 = td_var_offset(cgroup_weight),
3437 .help = "Use given weight for cgroup",
3438 .minval = 100,
3439 .maxval = 1000,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003440 .parent = "cgroup",
Jens Axboee8b0e952012-03-19 14:37:08 +01003441 .category = FIO_OPT_C_GENERAL,
Jens Axboea1f6afe2012-03-19 20:44:33 +01003442 .group = FIO_OPT_G_CGROUP,
Vivek Goyal7de87092010-03-31 22:55:15 +02003443 },
3444 {
Jens Axboee0b0d892009-12-08 10:10:14 +01003445 .name = "uid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003446 .lname = "User ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003447 .type = FIO_OPT_INT,
3448 .off1 = td_var_offset(uid),
3449 .help = "Run job with this user ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003450 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003451 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003452 },
3453 {
3454 .name = "gid",
Jens Axboee8b0e952012-03-19 14:37:08 +01003455 .lname = "Group ID",
Jens Axboee0b0d892009-12-08 10:10:14 +01003456 .type = FIO_OPT_INT,
3457 .off1 = td_var_offset(gid),
3458 .help = "Run job with this group ID",
Jens Axboee8b0e952012-03-19 14:37:08 +01003459 .category = FIO_OPT_C_GENERAL,
Jens Axboe10860052012-03-19 20:56:53 +01003460 .group = FIO_OPT_G_CRED,
Jens Axboee0b0d892009-12-08 10:10:14 +01003461 },
3462 {
Jens Axboea1f6afe2012-03-19 20:44:33 +01003463 .name = "kb_base",
3464 .lname = "KB Base",
3465 .type = FIO_OPT_INT,
3466 .off1 = td_var_offset(kb_base),
Jens Axboea1f6afe2012-03-19 20:44:33 +01003467 .prio = 1,
3468 .def = "1024",
Jens Axboeba9c7212013-04-10 11:12:21 +02003469 .posval = {
3470 { .ival = "1024",
3471 .oval = 1024,
3472 .help = "Use 1024 as the K base",
3473 },
3474 { .ival = "1000",
3475 .oval = 1000,
3476 .help = "Use 1000 as the K base",
3477 },
3478 },
Jens Axboea1f6afe2012-03-19 20:44:33 +01003479 .help = "How many bytes per KB for reporting (1000 or 1024)",
3480 .category = FIO_OPT_C_GENERAL,
3481 .group = FIO_OPT_G_INVALID,
3482 },
3483 {
Jens Axboecf3a0512013-04-09 20:38:32 +02003484 .name = "unit_base",
Jens Axboeba9c7212013-04-10 11:12:21 +02003485 .lname = "Base unit for reporting (Bits or Bytes)",
Jens Axboecf3a0512013-04-09 20:38:32 +02003486 .type = FIO_OPT_INT,
3487 .off1 = td_var_offset(unit_base),
Jens Axboecf3a0512013-04-09 20:38:32 +02003488 .prio = 1,
Jens Axboe71a08252013-04-09 20:49:45 +02003489 .posval = {
3490 { .ival = "0",
3491 .oval = 0,
3492 .help = "Auto-detect",
3493 },
3494 { .ival = "8",
3495 .oval = 8,
3496 .help = "Normal (byte based)",
3497 },
3498 { .ival = "1",
3499 .oval = 1,
3500 .help = "Bit based",
3501 },
3502 },
Jens Axboecf3a0512013-04-09 20:38:32 +02003503 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3504 .category = FIO_OPT_C_GENERAL,
3505 .group = FIO_OPT_G_INVALID,
3506 },
3507 {
Jens Axboe3ceb4582012-03-19 21:27:02 +01003508 .name = "hugepage-size",
3509 .lname = "Hugepage size",
3510 .type = FIO_OPT_INT,
3511 .off1 = td_var_offset(hugepage_size),
3512 .help = "When using hugepages, specify size of each page",
3513 .def = __fio_stringify(FIO_HUGE_PAGE),
3514 .interval = 1024 * 1024,
3515 .category = FIO_OPT_C_GENERAL,
3516 .group = FIO_OPT_G_INVALID,
3517 },
3518 {
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003519 .name = "flow_id",
Jens Axboee8b0e952012-03-19 14:37:08 +01003520 .lname = "I/O flow ID",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003521 .type = FIO_OPT_INT,
3522 .off1 = td_var_offset(flow_id),
3523 .help = "The flow index ID to use",
3524 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003525 .category = FIO_OPT_C_IO,
3526 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003527 },
3528 {
3529 .name = "flow",
Jens Axboee8b0e952012-03-19 14:37:08 +01003530 .lname = "I/O flow weight",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003531 .type = FIO_OPT_INT,
3532 .off1 = td_var_offset(flow),
3533 .help = "Weight for flow control of this job",
3534 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003535 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003536 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003537 .category = FIO_OPT_C_IO,
3538 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003539 },
3540 {
3541 .name = "flow_watermark",
Jens Axboee8b0e952012-03-19 14:37:08 +01003542 .lname = "I/O flow watermark",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003543 .type = FIO_OPT_INT,
3544 .off1 = td_var_offset(flow_watermark),
3545 .help = "High watermark for flow control. This option"
3546 " should be set to the same value for all threads"
3547 " with non-zero flow.",
3548 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003549 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003550 .def = "1024",
Jens Axboee8b0e952012-03-19 14:37:08 +01003551 .category = FIO_OPT_C_IO,
3552 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003553 },
3554 {
3555 .name = "flow_sleep",
Jens Axboee8b0e952012-03-19 14:37:08 +01003556 .lname = "I/O flow sleep",
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003557 .type = FIO_OPT_INT,
3558 .off1 = td_var_offset(flow_sleep),
3559 .help = "How many microseconds to sleep after being held"
3560 " back by the flow control mechanism",
3561 .parent = "flow_id",
Jens Axboed71c1542012-03-16 20:16:59 +01003562 .hide = 1,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003563 .def = "0",
Jens Axboee8b0e952012-03-19 14:37:08 +01003564 .category = FIO_OPT_C_IO,
3565 .group = FIO_OPT_G_IO_FLOW,
Dan Ehrenberg9e684a42012-02-20 11:05:14 +01003566 },
3567 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01003568 .name = NULL,
3569 },
3570};
3571
Jens Axboe17af15d2010-04-13 10:38:16 +02003572static void add_to_lopt(struct option *lopt, struct fio_option *o,
Steven Langde890a12011-11-09 14:03:34 +01003573 const char *name, int val)
Jens Axboe9f817362010-03-04 14:38:10 +01003574{
Jens Axboe17af15d2010-04-13 10:38:16 +02003575 lopt->name = (char *) name;
Steven Langde890a12011-11-09 14:03:34 +01003576 lopt->val = val;
Jens Axboe9f817362010-03-04 14:38:10 +01003577 if (o->type == FIO_OPT_STR_SET)
Jens Axboeff52be32013-11-26 20:19:59 -07003578 lopt->has_arg = optional_argument;
Jens Axboe9f817362010-03-04 14:38:10 +01003579 else
3580 lopt->has_arg = required_argument;
3581}
3582
Steven Langde890a12011-11-09 14:03:34 +01003583static void options_to_lopts(struct fio_option *opts,
3584 struct option *long_options,
3585 int i, int option_type)
3586{
3587 struct fio_option *o = &opts[0];
3588 while (o->name) {
3589 add_to_lopt(&long_options[i], o, o->name, option_type);
3590 if (o->alias) {
3591 i++;
3592 add_to_lopt(&long_options[i], o, o->alias, option_type);
3593 }
3594
3595 i++;
3596 o++;
3597 assert(i < FIO_NR_OPTIONS);
3598 }
3599}
3600
3601void fio_options_set_ioengine_opts(struct option *long_options,
3602 struct thread_data *td)
3603{
3604 unsigned int i;
3605
3606 i = 0;
3607 while (long_options[i].name) {
3608 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3609 memset(&long_options[i], 0, sizeof(*long_options));
3610 break;
3611 }
3612 i++;
3613 }
3614
3615 /*
3616 * Just clear out the prior ioengine options.
3617 */
3618 if (!td || !td->eo)
3619 return;
3620
3621 options_to_lopts(td->io_ops->options, long_options, i,
3622 FIO_GETOPT_IOENGINE);
3623}
3624
Jens Axboe214e1ec2007-03-15 10:48:13 +01003625void fio_options_dup_and_init(struct option *long_options)
3626{
Jens Axboe214e1ec2007-03-15 10:48:13 +01003627 unsigned int i;
3628
Jens Axboe9af4a242012-03-16 10:13:49 +01003629 options_init(fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003630
3631 i = 0;
3632 while (long_options[i].name)
3633 i++;
3634
Jens Axboe9af4a242012-03-16 10:13:49 +01003635 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003636}
3637
Jens Axboe74929ac2009-08-05 11:42:37 +02003638struct fio_keyword {
3639 const char *word;
3640 const char *desc;
3641 char *replace;
3642};
3643
3644static struct fio_keyword fio_keywords[] = {
3645 {
3646 .word = "$pagesize",
3647 .desc = "Page size in the system",
3648 },
3649 {
3650 .word = "$mb_memory",
3651 .desc = "Megabytes of memory online",
3652 },
3653 {
3654 .word = "$ncpus",
3655 .desc = "Number of CPUs online in the system",
3656 },
3657 {
3658 .word = NULL,
3659 },
3660};
3661
3662void fio_keywords_init(void)
3663{
Jens Axboe3b2e1462009-12-15 08:58:10 +01003664 unsigned long long mb_memory;
Jens Axboe74929ac2009-08-05 11:42:37 +02003665 char buf[128];
3666 long l;
3667
Jens Axboea4cfc472012-10-09 10:30:48 -06003668 sprintf(buf, "%lu", (unsigned long) page_size);
Jens Axboe74929ac2009-08-05 11:42:37 +02003669 fio_keywords[0].replace = strdup(buf);
3670
Jens Axboe8eb016d2011-07-11 10:24:20 +02003671 mb_memory = os_phys_mem() / (1024 * 1024);
Jens Axboe3b2e1462009-12-15 08:58:10 +01003672 sprintf(buf, "%llu", mb_memory);
Jens Axboe74929ac2009-08-05 11:42:37 +02003673 fio_keywords[1].replace = strdup(buf);
3674
Jens Axboec00a2282011-07-08 20:56:06 +02003675 l = cpus_online();
Jens Axboe74929ac2009-08-05 11:42:37 +02003676 sprintf(buf, "%lu", l);
3677 fio_keywords[2].replace = strdup(buf);
3678}
3679
Jens Axboe892a6ff2009-11-13 12:19:49 +01003680#define BC_APP "bc"
3681
3682static char *bc_calc(char *str)
3683{
Steven Langd0c814e2011-10-28 08:37:13 +02003684 char buf[128], *tmp;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003685 FILE *f;
3686 int ret;
3687
3688 /*
3689 * No math, just return string
3690 */
Steven Langd0c814e2011-10-28 08:37:13 +02003691 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3692 !strchr(str, '/')) || strchr(str, '\''))
Jens Axboe892a6ff2009-11-13 12:19:49 +01003693 return str;
3694
3695 /*
3696 * Split option from value, we only need to calculate the value
3697 */
3698 tmp = strchr(str, '=');
3699 if (!tmp)
3700 return str;
3701
3702 tmp++;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003703
Steven Langd0c814e2011-10-28 08:37:13 +02003704 /*
3705 * Prevent buffer overflows; such a case isn't reasonable anyway
3706 */
3707 if (strlen(str) >= 128 || strlen(tmp) > 100)
3708 return str;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003709
3710 sprintf(buf, "which %s > /dev/null", BC_APP);
3711 if (system(buf)) {
3712 log_err("fio: bc is needed for performing math\n");
Jens Axboe892a6ff2009-11-13 12:19:49 +01003713 return NULL;
3714 }
3715
Steven Langd0c814e2011-10-28 08:37:13 +02003716 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003717 f = popen(buf, "r");
Jens Axboe3c3ed072012-03-27 09:12:39 +02003718 if (!f)
Jens Axboe892a6ff2009-11-13 12:19:49 +01003719 return NULL;
Jens Axboe892a6ff2009-11-13 12:19:49 +01003720
Steven Langd0c814e2011-10-28 08:37:13 +02003721 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
Jens Axboe1d824f32014-04-11 11:27:34 -06003722 if (ret <= 0) {
3723 pclose(f);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003724 return NULL;
Jens Axboe1d824f32014-04-11 11:27:34 -06003725 }
Jens Axboe892a6ff2009-11-13 12:19:49 +01003726
Jens Axboe892a6ff2009-11-13 12:19:49 +01003727 pclose(f);
Steven Langd0c814e2011-10-28 08:37:13 +02003728 buf[(tmp - str) + ret - 1] = '\0';
3729 memcpy(buf, str, tmp - str);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003730 free(str);
Steven Langd0c814e2011-10-28 08:37:13 +02003731 return strdup(buf);
3732}
3733
3734/*
3735 * Return a copy of the input string with substrings of the form ${VARNAME}
3736 * substituted with the value of the environment variable VARNAME. The
3737 * substitution always occurs, even if VARNAME is empty or the corresponding
3738 * environment variable undefined.
3739 */
3740static char *option_dup_subs(const char *opt)
3741{
3742 char out[OPT_LEN_MAX+1];
3743 char in[OPT_LEN_MAX+1];
3744 char *outptr = out;
3745 char *inptr = in;
3746 char *ch1, *ch2, *env;
3747 ssize_t nchr = OPT_LEN_MAX;
3748 size_t envlen;
3749
3750 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3751 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3752 return NULL;
3753 }
3754
3755 in[OPT_LEN_MAX] = '\0';
3756 strncpy(in, opt, OPT_LEN_MAX);
3757
3758 while (*inptr && nchr > 0) {
3759 if (inptr[0] == '$' && inptr[1] == '{') {
3760 ch2 = strchr(inptr, '}');
3761 if (ch2 && inptr+1 < ch2) {
3762 ch1 = inptr+2;
3763 inptr = ch2+1;
3764 *ch2 = '\0';
3765
3766 env = getenv(ch1);
3767 if (env) {
3768 envlen = strlen(env);
3769 if (envlen <= nchr) {
3770 memcpy(outptr, env, envlen);
3771 outptr += envlen;
3772 nchr -= envlen;
3773 }
3774 }
3775
3776 continue;
3777 }
3778 }
3779
3780 *outptr++ = *inptr++;
3781 --nchr;
3782 }
3783
3784 *outptr = '\0';
3785 return strdup(out);
Jens Axboe892a6ff2009-11-13 12:19:49 +01003786}
3787
Jens Axboe74929ac2009-08-05 11:42:37 +02003788/*
3789 * Look for reserved variable names and replace them with real values
3790 */
3791static char *fio_keyword_replace(char *opt)
3792{
3793 char *s;
3794 int i;
Steven Langd0c814e2011-10-28 08:37:13 +02003795 int docalc = 0;
Jens Axboe74929ac2009-08-05 11:42:37 +02003796
3797 for (i = 0; fio_keywords[i].word != NULL; i++) {
3798 struct fio_keyword *kw = &fio_keywords[i];
3799
3800 while ((s = strstr(opt, kw->word)) != NULL) {
3801 char *new = malloc(strlen(opt) + 1);
3802 char *o_org = opt;
3803 int olen = s - opt;
3804 int len;
3805
3806 /*
3807 * Copy part of the string before the keyword and
3808 * sprintf() the replacement after it.
3809 */
3810 memcpy(new, opt, olen);
3811 len = sprintf(new + olen, "%s", kw->replace);
3812
3813 /*
3814 * If there's more in the original string, copy that
3815 * in too
3816 */
3817 opt += strlen(kw->word) + olen;
3818 if (strlen(opt))
3819 memcpy(new + olen + len, opt, opt - o_org - 1);
3820
3821 /*
3822 * replace opt and free the old opt
3823 */
3824 opt = new;
Steven Langd0c814e2011-10-28 08:37:13 +02003825 free(o_org);
Jens Axboe7a958bd2009-11-13 12:33:54 +01003826
Steven Langd0c814e2011-10-28 08:37:13 +02003827 docalc = 1;
Jens Axboe74929ac2009-08-05 11:42:37 +02003828 }
3829 }
3830
Steven Langd0c814e2011-10-28 08:37:13 +02003831 /*
3832 * Check for potential math and invoke bc, if possible
3833 */
3834 if (docalc)
3835 opt = bc_calc(opt);
3836
Jens Axboe7a958bd2009-11-13 12:33:54 +01003837 return opt;
Jens Axboe74929ac2009-08-05 11:42:37 +02003838}
3839
Steven Langd0c814e2011-10-28 08:37:13 +02003840static char **dup_and_sub_options(char **opts, int num_opts)
3841{
3842 int i;
3843 char **opts_copy = malloc(num_opts * sizeof(*opts));
3844 for (i = 0; i < num_opts; i++) {
3845 opts_copy[i] = option_dup_subs(opts[i]);
3846 if (!opts_copy[i])
3847 continue;
3848 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3849 }
3850 return opts_copy;
3851}
3852
Jens Axboe292cc472013-11-26 20:39:35 -07003853int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
3854 int dump_cmdline)
Jens Axboe214e1ec2007-03-15 10:48:13 +01003855{
Steven Langde890a12011-11-09 14:03:34 +01003856 int i, ret, unknown;
Steven Langd0c814e2011-10-28 08:37:13 +02003857 char **opts_copy;
Jens Axboe3b8b7132008-06-10 19:46:23 +02003858
Jens Axboe9af4a242012-03-16 10:13:49 +01003859 sort_options(opts, fio_options, num_opts);
Steven Langd0c814e2011-10-28 08:37:13 +02003860 opts_copy = dup_and_sub_options(opts, num_opts);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003861
Steven Langde890a12011-11-09 14:03:34 +01003862 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3863 struct fio_option *o;
Jens Axboe9af4a242012-03-16 10:13:49 +01003864 int newret = parse_option(opts_copy[i], opts[i], fio_options,
Jens Axboe292cc472013-11-26 20:39:35 -07003865 &o, td, dump_cmdline);
Steven Langd0c814e2011-10-28 08:37:13 +02003866
Steven Langde890a12011-11-09 14:03:34 +01003867 if (opts_copy[i]) {
3868 if (newret && !o) {
3869 unknown++;
3870 continue;
3871 }
Steven Langd0c814e2011-10-28 08:37:13 +02003872 free(opts_copy[i]);
Steven Langde890a12011-11-09 14:03:34 +01003873 opts_copy[i] = NULL;
3874 }
3875
3876 ret |= newret;
3877 }
3878
3879 if (unknown) {
3880 ret |= ioengine_load(td);
3881 if (td->eo) {
3882 sort_options(opts_copy, td->io_ops->options, num_opts);
3883 opts = opts_copy;
3884 }
3885 for (i = 0; i < num_opts; i++) {
3886 struct fio_option *o = NULL;
3887 int newret = 1;
3888 if (!opts_copy[i])
3889 continue;
3890
3891 if (td->eo)
3892 newret = parse_option(opts_copy[i], opts[i],
3893 td->io_ops->options, &o,
Jens Axboe292cc472013-11-26 20:39:35 -07003894 td->eo, dump_cmdline);
Steven Langde890a12011-11-09 14:03:34 +01003895
3896 ret |= newret;
3897 if (!o)
3898 log_err("Bad option <%s>\n", opts[i]);
3899
3900 free(opts_copy[i]);
3901 opts_copy[i] = NULL;
3902 }
Jens Axboe74929ac2009-08-05 11:42:37 +02003903 }
Jens Axboe3b8b7132008-06-10 19:46:23 +02003904
Steven Langd0c814e2011-10-28 08:37:13 +02003905 free(opts_copy);
Jens Axboe3b8b7132008-06-10 19:46:23 +02003906 return ret;
Jens Axboe214e1ec2007-03-15 10:48:13 +01003907}
3908
3909int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3910{
Jens Axboe9af4a242012-03-16 10:13:49 +01003911 return parse_cmd_option(opt, val, fio_options, td);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003912}
3913
Steven Langde890a12011-11-09 14:03:34 +01003914int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3915 char *val)
3916{
Akinobu Mita8a96c802013-10-09 09:32:34 -06003917 return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
Steven Langde890a12011-11-09 14:03:34 +01003918}
3919
Jens Axboe214e1ec2007-03-15 10:48:13 +01003920void fio_fill_default_options(struct thread_data *td)
3921{
Jens Axboecb1402d2014-02-25 11:35:27 -08003922 td->o.magic = OPT_MAGIC;
Jens Axboe9af4a242012-03-16 10:13:49 +01003923 fill_default_options(td, fio_options);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003924}
3925
3926int fio_show_option_help(const char *opt)
3927{
Jens Axboe9af4a242012-03-16 10:13:49 +01003928 return show_cmd_help(fio_options, opt);
Jens Axboe214e1ec2007-03-15 10:48:13 +01003929}
Jens Axboed23bb322007-03-23 15:57:56 +01003930
Steven Langde890a12011-11-09 14:03:34 +01003931void options_mem_dupe(void *data, struct fio_option *options)
3932{
3933 struct fio_option *o;
3934 char **ptr;
3935
3936 for (o = &options[0]; o->name; o++) {
3937 if (o->type != FIO_OPT_STR_STORE)
3938 continue;
3939
Jens Axboef0fdbca2014-02-11 15:44:50 -07003940 ptr = td_var(data, o, o->off1);
Steven Langde890a12011-11-09 14:03:34 +01003941 if (*ptr)
3942 *ptr = strdup(*ptr);
3943 }
3944}
3945
Jens Axboe7e356b22011-10-14 10:55:16 +02003946/*
3947 * dupe FIO_OPT_STR_STORE options
3948 */
Steven Langde890a12011-11-09 14:03:34 +01003949void fio_options_mem_dupe(struct thread_data *td)
Jens Axboed23bb322007-03-23 15:57:56 +01003950{
Jens Axboe9af4a242012-03-16 10:13:49 +01003951 options_mem_dupe(&td->o, fio_options);
Jens Axboe1647f592011-11-09 20:25:21 +01003952
3953 if (td->eo && td->io_ops) {
Steven Langde890a12011-11-09 14:03:34 +01003954 void *oldeo = td->eo;
Jens Axboe1647f592011-11-09 20:25:21 +01003955
Steven Langde890a12011-11-09 14:03:34 +01003956 td->eo = malloc(td->io_ops->option_struct_size);
3957 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3958 options_mem_dupe(td->eo, td->io_ops->options);
Jens Axboed23bb322007-03-23 15:57:56 +01003959 }
3960}
3961
Jens Axboed6978a32009-07-18 21:04:09 +02003962unsigned int fio_get_kb_base(void *data)
3963{
Jens Axboe83ea4222012-03-28 14:01:46 +02003964 struct thread_options *o = data;
Jens Axboed6978a32009-07-18 21:04:09 +02003965 unsigned int kb_base = 0;
3966
Jens Axboecb1402d2014-02-25 11:35:27 -08003967 /*
3968 * This is a hack... For private options, *data is not holding
3969 * a pointer to the thread_options, but to private data. This means
3970 * we can't safely dereference it, but magic is first so mem wise
3971 * it is valid. But this also means that if the job first sets
3972 * kb_base and expects that to be honored by private options,
3973 * it will be disappointed. We will return the global default
3974 * for this.
3975 */
3976 if (o && o->magic == OPT_MAGIC)
Jens Axboe83ea4222012-03-28 14:01:46 +02003977 kb_base = o->kb_base;
Jens Axboed6978a32009-07-18 21:04:09 +02003978 if (!kb_base)
3979 kb_base = 1024;
3980
3981 return kb_base;
3982}
Jens Axboe9f988e22010-03-04 10:42:38 +01003983
Jens Axboe07b32322010-03-05 09:48:44 +01003984int add_option(struct fio_option *o)
Jens Axboe9f988e22010-03-04 10:42:38 +01003985{
Jens Axboe07b32322010-03-05 09:48:44 +01003986 struct fio_option *__o;
3987 int opt_index = 0;
3988
Jens Axboe9af4a242012-03-16 10:13:49 +01003989 __o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01003990 while (__o->name) {
3991 opt_index++;
3992 __o++;
3993 }
3994
Jens Axboe7b504ed2014-02-11 14:19:38 -07003995 if (opt_index + 1 == FIO_MAX_OPTS) {
3996 log_err("fio: FIO_MAX_OPTS is too small\n");
3997 return 1;
3998 }
3999
Jens Axboe9af4a242012-03-16 10:13:49 +01004000 memcpy(&fio_options[opt_index], o, sizeof(*o));
Jens Axboe7b504ed2014-02-11 14:19:38 -07004001 fio_options[opt_index + 1].name = NULL;
Jens Axboe07b32322010-03-05 09:48:44 +01004002 return 0;
Jens Axboe9f988e22010-03-04 10:42:38 +01004003}
Jens Axboee2de69d2010-03-04 14:05:48 +01004004
Jens Axboe07b32322010-03-05 09:48:44 +01004005void invalidate_profile_options(const char *prof_name)
Jens Axboee2de69d2010-03-04 14:05:48 +01004006{
Jens Axboe07b32322010-03-05 09:48:44 +01004007 struct fio_option *o;
Jens Axboee2de69d2010-03-04 14:05:48 +01004008
Jens Axboe9af4a242012-03-16 10:13:49 +01004009 o = fio_options;
Jens Axboe07b32322010-03-05 09:48:44 +01004010 while (o->name) {
4011 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4012 o->type = FIO_OPT_INVALID;
4013 o->prof_name = NULL;
4014 }
4015 o++;
Jens Axboee2de69d2010-03-04 14:05:48 +01004016 }
4017}
Jens Axboef5b6bb82010-03-05 10:09:59 +01004018
4019void add_opt_posval(const char *optname, const char *ival, const char *help)
4020{
4021 struct fio_option *o;
4022 unsigned int i;
4023
Jens Axboe9af4a242012-03-16 10:13:49 +01004024 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004025 if (!o)
4026 return;
4027
4028 for (i = 0; i < PARSE_MAX_VP; i++) {
4029 if (o->posval[i].ival)
4030 continue;
4031
4032 o->posval[i].ival = ival;
4033 o->posval[i].help = help;
4034 break;
4035 }
4036}
4037
4038void del_opt_posval(const char *optname, const char *ival)
4039{
4040 struct fio_option *o;
4041 unsigned int i;
4042
Jens Axboe9af4a242012-03-16 10:13:49 +01004043 o = find_option(fio_options, optname);
Jens Axboef5b6bb82010-03-05 10:09:59 +01004044 if (!o)
4045 return;
4046
4047 for (i = 0; i < PARSE_MAX_VP; i++) {
4048 if (!o->posval[i].ival)
4049 continue;
4050 if (strcmp(o->posval[i].ival, ival))
4051 continue;
4052
4053 o->posval[i].ival = NULL;
4054 o->posval[i].help = NULL;
4055 }
4056}
Jens Axboe7e356b22011-10-14 10:55:16 +02004057
4058void fio_options_free(struct thread_data *td)
4059{
Jens Axboe9af4a242012-03-16 10:13:49 +01004060 options_free(fio_options, td);
Steven Langde890a12011-11-09 14:03:34 +01004061 if (td->eo && td->io_ops && td->io_ops->options) {
4062 options_free(td->io_ops->options, td->eo);
4063 free(td->eo);
4064 td->eo = NULL;
4065 }
Jens Axboe7e356b22011-10-14 10:55:16 +02004066}
Jens Axboec504ee52012-03-20 11:29:09 +01004067
4068struct fio_option *fio_option_find(const char *name)
4069{
4070 return find_option(fio_options, name);
4071}
4072