X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=options.c;h=74c64780a92658695217ee46859d631eb0008b14;hb=ab2cabdb2c67d8b90c94c1a95f7a2286a0f818b9;hp=f1c0ea788ddf0db28fce608ea05ec3962c92237a;hpb=c00a22894b82ff53b42c1e741a7b4828199a1388;p=fio.git diff --git a/options.c b/options.c index f1c0ea78..74c64780 100644 --- a/options.c +++ b/options.c @@ -744,6 +744,20 @@ static int str_gtod_cpu_cb(void *data, long long *il) return 0; } +static int str_size_cb(void *data, unsigned long long *__val) +{ + struct thread_data *td = data; + unsigned long long v = *__val; + + if (parse_is_percent(v)) { + td->o.size = 0; + td->o.size_percent = -1ULL - v; + } else + td->o.size = v; + + return 0; +} + static int rw_verify(struct fio_option *o, void *data) { struct thread_data *td = data; @@ -1031,8 +1045,7 @@ static struct fio_option options[FIO_MAX_OPTS] = { { .name = "size", .type = FIO_OPT_STR_VAL, - .off1 = td_var_offset(size), - .minval = 1, + .cb = str_size_cb, .help = "Total size of device or files", }, { @@ -2091,7 +2104,7 @@ void fio_keywords_init(void) sprintf(buf, "%lu", page_size); fio_keywords[0].replace = strdup(buf); - mb_memory = os_phys_mem() / page_size; + mb_memory = os_phys_mem() / (1024 * 1024); sprintf(buf, "%llu", mb_memory); fio_keywords[1].replace = strdup(buf);