From: Jens Axboe Date: Mon, 21 Dec 2015 23:03:01 +0000 (-0700) Subject: Make options mask a 64-bit type X-Git-Tag: fio-2.3~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=72f397487788fc0b542870de5cc29ea8e8134346;hp=95b03be02f39a774b55d127df4c19ffd8f983c56 Make options mask a 64-bit type We're running out of bit numbers, double it up. Signed-off-by: Jens Axboe --- diff --git a/options.c b/options.c index 45726aa9..84947139 100644 --- a/options.c +++ b/options.c @@ -1075,8 +1075,9 @@ static struct opt_group fio_opt_groups[] = { }, }; -static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask, - unsigned int inv_mask) +static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, + uint64_t *mask, + uint64_t inv_mask) { struct opt_group *og; int i; @@ -1096,7 +1097,7 @@ static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned i return NULL; } -struct opt_group *opt_group_from_mask(unsigned int *mask) +struct opt_group *opt_group_from_mask(uint64_t *mask) { return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID); } @@ -1200,7 +1201,7 @@ static struct opt_group fio_opt_cat_groups[] = { } }; -struct opt_group *opt_group_cat_from_mask(unsigned int *mask) +struct opt_group *opt_group_cat_from_mask(uint64_t *mask) { return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID); } @@ -4350,19 +4351,19 @@ static int opt_is_set(struct thread_options *o, struct fio_option *opt) return (o->set_options[index] & ((uint64_t)1 << offset)) != 0; } -int __fio_option_is_set(struct thread_options *o, unsigned int off1) +bool __fio_option_is_set(struct thread_options *o, unsigned int off1) { struct fio_option *opt, *next; next = NULL; while ((opt = find_next_opt(o, next, off1)) != NULL) { if (opt_is_set(o, opt)) - return 1; + return true; next = opt; } - return 0; + return false; } void fio_option_mark_set(struct thread_options *o, struct fio_option *opt) diff --git a/options.h b/options.h index fd6ad923..d37b162a 100644 --- a/options.h +++ b/options.h @@ -4,8 +4,10 @@ #define FIO_MAX_OPTS 512 #include +#include #include "parse.h" #include "flist.h" +#include "lib/types.h" #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) @@ -24,30 +26,25 @@ extern char client_sockaddr_str[]; /* used with --client option */ extern struct fio_option fio_options[FIO_MAX_OPTS]; -extern int __fio_option_is_set(struct thread_options *, unsigned int off); +extern bool __fio_option_is_set(struct thread_options *, unsigned int off); #define fio_option_is_set(__td, name) \ ({ \ const unsigned int off = td_var_offset(name); \ - int __r = __fio_option_is_set((__td), off); \ - if (__r == -1) { \ - dprint(FD_PARSE, "option %s/%u not found in map\n", \ - __fio_stringify(name), off); \ - __r = 0; \ - } \ + bool __r = __fio_option_is_set((__td), off); \ __r; \ }) extern void fio_option_mark_set(struct thread_options *, struct fio_option *); -static inline int o_match(struct fio_option *o, const char *opt) +static inline bool o_match(struct fio_option *o, const char *opt) { if (!strcmp(o->name, opt)) - return 1; + return true; else if (o->alias && !strcmp(o->alias, opt)) - return 1; + return true; - return 0; + return false; } static inline struct fio_option *find_option(struct fio_option *options, @@ -64,7 +61,7 @@ static inline struct fio_option *find_option(struct fio_option *options, struct opt_group { const char *name; - unsigned int mask; + uint64_t mask; }; enum opt_category { @@ -77,14 +74,14 @@ enum opt_category { __FIO_OPT_C_ENGINE, __FIO_OPT_C_NR, - FIO_OPT_C_GENERAL = (1U << __FIO_OPT_C_GENERAL), - FIO_OPT_C_IO = (1U << __FIO_OPT_C_IO), - FIO_OPT_C_FILE = (1U << __FIO_OPT_C_FILE), - FIO_OPT_C_STAT = (1U << __FIO_OPT_C_STAT), - FIO_OPT_C_LOG = (1U << __FIO_OPT_C_LOG), - FIO_OPT_C_PROFILE = (1U << __FIO_OPT_C_PROFILE), - FIO_OPT_C_ENGINE = (1U << __FIO_OPT_C_ENGINE), - FIO_OPT_C_INVALID = (1U << __FIO_OPT_C_NR), + FIO_OPT_C_GENERAL = (1ULL << __FIO_OPT_C_GENERAL), + FIO_OPT_C_IO = (1ULL << __FIO_OPT_C_IO), + FIO_OPT_C_FILE = (1ULL << __FIO_OPT_C_FILE), + FIO_OPT_C_STAT = (1ULL << __FIO_OPT_C_STAT), + FIO_OPT_C_LOG = (1ULL << __FIO_OPT_C_LOG), + FIO_OPT_C_PROFILE = (1ULL << __FIO_OPT_C_PROFILE), + FIO_OPT_C_ENGINE = (1ULL << __FIO_OPT_C_ENGINE), + FIO_OPT_C_INVALID = (1ULL << __FIO_OPT_C_NR), }; enum opt_category_group { @@ -121,42 +118,42 @@ enum opt_category_group { __FIO_OPT_G_MTD, __FIO_OPT_G_NR, - FIO_OPT_G_RATE = (1U << __FIO_OPT_G_RATE), - FIO_OPT_G_ZONE = (1U << __FIO_OPT_G_ZONE), - FIO_OPT_G_RWMIX = (1U << __FIO_OPT_G_RWMIX), - FIO_OPT_G_VERIFY = (1U << __FIO_OPT_G_VERIFY), - FIO_OPT_G_TRIM = (1U << __FIO_OPT_G_TRIM), - FIO_OPT_G_IOLOG = (1U << __FIO_OPT_G_IOLOG), - FIO_OPT_G_IO_DEPTH = (1U << __FIO_OPT_G_IO_DEPTH), - FIO_OPT_G_IO_FLOW = (1U << __FIO_OPT_G_IO_FLOW), - FIO_OPT_G_DESC = (1U << __FIO_OPT_G_DESC), - FIO_OPT_G_FILENAME = (1U << __FIO_OPT_G_FILENAME), - FIO_OPT_G_IO_BASIC = (1U << __FIO_OPT_G_IO_BASIC), - FIO_OPT_G_CGROUP = (1U << __FIO_OPT_G_CGROUP), - FIO_OPT_G_RUNTIME = (1U << __FIO_OPT_G_RUNTIME), - FIO_OPT_G_PROCESS = (1U << __FIO_OPT_G_PROCESS), - FIO_OPT_G_CRED = (1U << __FIO_OPT_G_CRED), - FIO_OPT_G_CLOCK = (1U << __FIO_OPT_G_CLOCK), - FIO_OPT_G_IO_TYPE = (1U << __FIO_OPT_G_IO_TYPE), - FIO_OPT_G_THINKTIME = (1U << __FIO_OPT_G_THINKTIME), - FIO_OPT_G_RANDOM = (1U << __FIO_OPT_G_RANDOM), - FIO_OPT_G_IO_BUF = (1U << __FIO_OPT_G_IO_BUF), - FIO_OPT_G_TIOBENCH = (1U << __FIO_OPT_G_TIOBENCH), - FIO_OPT_G_ERR = (1U << __FIO_OPT_G_ERR), - FIO_OPT_G_E4DEFRAG = (1U << __FIO_OPT_G_E4DEFRAG), - FIO_OPT_G_NETIO = (1U << __FIO_OPT_G_NETIO), - FIO_OPT_G_RDMA = (1U << __FIO_OPT_G_RDMA), - FIO_OPT_G_LIBAIO = (1U << __FIO_OPT_G_LIBAIO), - FIO_OPT_G_ACT = (1U << __FIO_OPT_G_ACT), - FIO_OPT_G_LATPROF = (1U << __FIO_OPT_G_LATPROF), - FIO_OPT_G_RBD = (1U << __FIO_OPT_G_RBD), - FIO_OPT_G_GFAPI = (1U << __FIO_OPT_G_GFAPI), - FIO_OPT_G_MTD = (1U << __FIO_OPT_G_MTD), - FIO_OPT_G_INVALID = (1U << __FIO_OPT_G_NR), + FIO_OPT_G_RATE = (1ULL << __FIO_OPT_G_RATE), + FIO_OPT_G_ZONE = (1ULL << __FIO_OPT_G_ZONE), + FIO_OPT_G_RWMIX = (1ULL << __FIO_OPT_G_RWMIX), + FIO_OPT_G_VERIFY = (1ULL << __FIO_OPT_G_VERIFY), + FIO_OPT_G_TRIM = (1ULL << __FIO_OPT_G_TRIM), + FIO_OPT_G_IOLOG = (1ULL << __FIO_OPT_G_IOLOG), + FIO_OPT_G_IO_DEPTH = (1ULL << __FIO_OPT_G_IO_DEPTH), + FIO_OPT_G_IO_FLOW = (1ULL << __FIO_OPT_G_IO_FLOW), + FIO_OPT_G_DESC = (1ULL << __FIO_OPT_G_DESC), + FIO_OPT_G_FILENAME = (1ULL << __FIO_OPT_G_FILENAME), + FIO_OPT_G_IO_BASIC = (1ULL << __FIO_OPT_G_IO_BASIC), + FIO_OPT_G_CGROUP = (1ULL << __FIO_OPT_G_CGROUP), + FIO_OPT_G_RUNTIME = (1ULL << __FIO_OPT_G_RUNTIME), + FIO_OPT_G_PROCESS = (1ULL << __FIO_OPT_G_PROCESS), + FIO_OPT_G_CRED = (1ULL << __FIO_OPT_G_CRED), + FIO_OPT_G_CLOCK = (1ULL << __FIO_OPT_G_CLOCK), + FIO_OPT_G_IO_TYPE = (1ULL << __FIO_OPT_G_IO_TYPE), + FIO_OPT_G_THINKTIME = (1ULL << __FIO_OPT_G_THINKTIME), + FIO_OPT_G_RANDOM = (1ULL << __FIO_OPT_G_RANDOM), + FIO_OPT_G_IO_BUF = (1ULL << __FIO_OPT_G_IO_BUF), + FIO_OPT_G_TIOBENCH = (1ULL << __FIO_OPT_G_TIOBENCH), + FIO_OPT_G_ERR = (1ULL << __FIO_OPT_G_ERR), + FIO_OPT_G_E4DEFRAG = (1ULL << __FIO_OPT_G_E4DEFRAG), + FIO_OPT_G_NETIO = (1ULL << __FIO_OPT_G_NETIO), + FIO_OPT_G_RDMA = (1ULL << __FIO_OPT_G_RDMA), + FIO_OPT_G_LIBAIO = (1ULL << __FIO_OPT_G_LIBAIO), + FIO_OPT_G_ACT = (1ULL << __FIO_OPT_G_ACT), + FIO_OPT_G_LATPROF = (1ULL << __FIO_OPT_G_LATPROF), + FIO_OPT_G_RBD = (1ULL << __FIO_OPT_G_RBD), + FIO_OPT_G_GFAPI = (1ULL << __FIO_OPT_G_GFAPI), + FIO_OPT_G_MTD = (1ULL << __FIO_OPT_G_MTD), + FIO_OPT_G_INVALID = (1ULL << __FIO_OPT_G_NR), }; -extern struct opt_group *opt_group_from_mask(unsigned int *mask); -extern struct opt_group *opt_group_cat_from_mask(unsigned int *mask); +extern struct opt_group *opt_group_from_mask(uint64_t *mask); +extern struct opt_group *opt_group_cat_from_mask(uint64_t *mask); extern struct fio_option *fio_option_find(const char *name); extern unsigned int fio_get_kb_base(void *);