summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-12-09 13:17:33 -0700
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:58:07 -0800
commit94b360f41976a2bd3c4d3476b5e26a96e1ea9b12 (patch)
tree5e6678a49975e1042edb1508e8c07037ccde47a1
parent9c62acd93cd70b6bfd01892b59926c4fb2a3639b (diff)
downloadfio-94b360f41976a2bd3c4d3476b5e26a96e1ea9b12.tar.gz
Get rid of _set variables
We can just check the option set mask now. Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--backend.c12
-rw-r--r--cconv.c4
-rw-r--r--options.c22
-rw-r--r--thread_options.h8
-rw-r--r--verify.c2
5 files changed, 12 insertions, 36 deletions
diff --git a/backend.c b/backend.c
index 6816362a..e07ded86 100644
--- a/backend.c
+++ b/backend.c
@@ -1345,7 +1345,7 @@ static void *thread_main(void *data)
* Set affinity first, in case it has an impact on the memory
* allocations.
*/
- if (o->cpumask_set) {
+ if (fio_option_is_set(o, cpumask)) {
if (o->cpus_allowed_policy == FIO_CPUS_SPLIT) {
ret = fio_cpus_split(&o->cpumask, td->thread_number - 1);
if (!ret) {
@@ -1364,7 +1364,8 @@ static void *thread_main(void *data)
#ifdef CONFIG_LIBNUMA
/* numa node setup */
- if (o->numa_cpumask_set || o->numa_memmask_set) {
+ if (fio_option_is_set(o, numa_cpunodes) ||
+ fio_option_is_set(o, numa_memnodes)) {
struct bitmask *mask;
if (numa_available() < 0) {
@@ -1372,7 +1373,7 @@ static void *thread_main(void *data)
goto err;
}
- if (o->numa_cpumask_set) {
+ if (fio_option_is_set(o, numa_cpunodes)) {
mask = numa_parse_nodestring(o->numa_cpunodes);
ret = numa_run_on_node_mask(mask);
numa_free_nodemask(mask);
@@ -1383,8 +1384,7 @@ static void *thread_main(void *data)
}
}
- if (o->numa_memmask_set) {
-
+ if (fio_option_is_set(o, numa_memnodes)) {
mask = NULL;
if (o->numa_memnodes)
mask = numa_parse_nodestring(o->numa_memnodes);
@@ -1589,7 +1589,7 @@ err:
cgroup_shutdown(td, &cgroup_mnt);
verify_free_state(td);
- if (o->cpumask_set) {
+ if (fio_option_is_set(o, cpumask)) {
ret = fio_cpuset_exit(&o->cpumask);
if (ret)
td_verror(td, ret, "fio_cpuset_exit");
diff --git a/cconv.c b/cconv.c
index a4d50035..18edc0f3 100644
--- a/cconv.c
+++ b/cconv.c
@@ -195,8 +195,6 @@ void convert_thread_options_to_cpu(struct thread_options *o,
o->stonewall = le32_to_cpu(top->stonewall);
o->new_group = le32_to_cpu(top->new_group);
o->numjobs = le32_to_cpu(top->numjobs);
- o->cpumask_set = le32_to_cpu(top->cpumask_set);
- o->verify_cpumask_set = le32_to_cpu(top->verify_cpumask_set);
o->cpus_allowed_policy = le32_to_cpu(top->cpus_allowed_policy);
o->iolog = le32_to_cpu(top->iolog);
o->rwmixcycle = le32_to_cpu(top->rwmixcycle);
@@ -357,8 +355,6 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
top->stonewall = cpu_to_le32(o->stonewall);
top->new_group = cpu_to_le32(o->new_group);
top->numjobs = cpu_to_le32(o->numjobs);
- top->cpumask_set = cpu_to_le32(o->cpumask_set);
- top->verify_cpumask_set = cpu_to_le32(o->verify_cpumask_set);
top->cpus_allowed_policy = cpu_to_le32(o->cpus_allowed_policy);
top->iolog = cpu_to_le32(o->iolog);
top->rwmixcycle = cpu_to_le32(o->rwmixcycle);
diff --git a/options.c b/options.c
index ac561bc9..afca7270 100644
--- a/options.c
+++ b/options.c
@@ -453,7 +453,6 @@ static int str_cpumask_cb(void *data, unsigned long long *val)
}
}
- td->o.cpumask_set = 1;
return 0;
}
@@ -520,36 +519,24 @@ static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
}
free(p);
- if (!ret)
- td->o.cpumask_set = 1;
return ret;
}
static int str_cpus_allowed_cb(void *data, const char *input)
{
struct thread_data *td = data;
- int ret;
if (parse_dryrun())
return 0;
- ret = set_cpus_allowed(td, &td->o.cpumask, input);
- if (!ret)
- td->o.cpumask_set = 1;
-
- return ret;
+ return set_cpus_allowed(td, &td->o.cpumask, input);
}
static int str_verify_cpus_allowed_cb(void *data, const char *input)
{
struct thread_data *td = data;
- int ret;
- ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
- if (!ret)
- td->o.verify_cpumask_set = 1;
-
- return ret;
+ return set_cpus_allowed(td, &td->o.verify_cpumask, input);
}
#endif
@@ -576,7 +563,6 @@ static int str_numa_cpunodes_cb(void *data, char *input)
numa_free_nodemask(verify_bitmask);
td->o.numa_cpunodes = strdup(input);
- td->o.numa_cpumask_set = 1;
return 0;
}
@@ -683,9 +669,7 @@ static int str_numa_mpol_cb(void *data, char *input)
break;
}
- td->o.numa_memmask_set = 1;
return 0;
-
out:
return 1;
}
@@ -3052,6 +3036,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
.name = "numa_cpu_nodes",
.type = FIO_OPT_STR,
.cb = str_numa_cpunodes_cb,
+ .off1 = td_var_offset(numa_cpunodes),
.help = "NUMA CPU nodes bind",
.category = FIO_OPT_C_GENERAL,
.group = FIO_OPT_G_INVALID,
@@ -3060,6 +3045,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
.name = "numa_mem_policy",
.type = FIO_OPT_STR,
.cb = str_numa_mpol_cb,
+ .off1 = td_var_offset(numa_memnodes),
.help = "NUMA memory policy setup",
.category = FIO_OPT_C_GENERAL,
.group = FIO_OPT_G_INVALID,
diff --git a/thread_options.h b/thread_options.h
index f0c6325b..530dd9a6 100644
--- a/thread_options.h
+++ b/thread_options.h
@@ -163,16 +163,12 @@ struct thread_options {
unsigned int new_group;
unsigned int numjobs;
os_cpu_mask_t cpumask;
- unsigned int cpumask_set;
os_cpu_mask_t verify_cpumask;
- unsigned int verify_cpumask_set;
unsigned int cpus_allowed_policy;
char *numa_cpunodes;
- unsigned int numa_cpumask_set;
unsigned short numa_mem_mode;
unsigned int numa_mem_prefer_node;
char *numa_memnodes;
- unsigned int numa_memmask_set;
unsigned int iolog;
unsigned int rwmixcycle;
unsigned int rwmix[DDIR_RWDIR_CNT];
@@ -339,7 +335,6 @@ struct thread_options_pack {
uint32_t experimental_verify;
uint32_t verify_state;
uint32_t verify_state_save;
- uint32_t pad;
uint32_t use_thread;
uint32_t unlink;
uint32_t do_disk_util;
@@ -359,6 +354,7 @@ struct thread_options_pack {
uint32_t bs_is_seq_rand;
uint32_t random_distribution;
+ uint32_t pad;
fio_fp64_t zipf_theta;
fio_fp64_t pareto_h;
@@ -395,9 +391,7 @@ struct thread_options_pack {
uint32_t new_group;
uint32_t numjobs;
uint8_t cpumask[FIO_TOP_STR_MAX];
- uint32_t cpumask_set;
uint8_t verify_cpumask[FIO_TOP_STR_MAX];
- uint32_t verify_cpumask_set;
uint32_t cpus_allowed_policy;
uint32_t iolog;
uint32_t rwmixcycle;
diff --git a/verify.c b/verify.c
index d1a12665..2ae03f85 100644
--- a/verify.c
+++ b/verify.c
@@ -1151,7 +1151,7 @@ static void *verify_async_thread(void *data)
struct io_u *io_u;
int ret = 0;
- if (td->o.verify_cpumask_set &&
+ if (fio_option_is_set(&td->o, verify_cpumask) &&
fio_setaffinity(td->pid, td->o.verify_cpumask)) {
log_err("fio: failed setting verify thread affinity\n");
goto done;