Merge branch 'master' of ssh://git.kernel.dk/data/git/fio
diff --git a/blktrace.c b/blktrace.c
index 107a65b..4b5567e 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -382,8 +382,7 @@
fifo = fifo_alloc(TRACE_FIFO_SIZE);
- old_state = td->runstate;
- td_set_runstate(td, TD_SETTING_UP);
+ old_state = td_bump_runstate(td, TD_SETTING_UP);
td->o.size = 0;
@@ -463,7 +462,7 @@
fifo_free(fifo);
close(fd);
- td_set_runstate(td, old_state);
+ td_restore_runstate(td, old_state);
if (!td->files_index) {
log_err("fio: did not find replay device(s)\n");
diff --git a/filesetup.c b/filesetup.c
index 2744d4f..4bfa470 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -209,8 +209,7 @@
did_open = 1;
}
- old_runstate = td->runstate;
- td_set_runstate(td, TD_PRE_READING);
+ old_runstate = td_bump_runstate(td, TD_PRE_READING);
bs = td->o.max_bs[DDIR_READ];
b = malloc(bs);
@@ -234,7 +233,7 @@
}
}
- td_set_runstate(td, old_runstate);
+ td_restore_runstate(td, old_runstate);
if (did_open)
td->io_ops->close_file(td, f);
@@ -745,8 +744,7 @@
dprint(FD_FILE, "setup files\n");
- old_state = td->runstate;
- td_set_runstate(td, TD_SETTING_UP);
+ old_state = td_bump_runstate(td, TD_SETTING_UP);
if (o->read_iolog_file)
goto done;
@@ -925,12 +923,12 @@
if (o->create_only)
td->done = 1;
- td_set_runstate(td, old_state);
+ td_restore_runstate(td, old_state);
return 0;
err_offset:
log_err("%s: you need to specify valid offset=\n", o->name);
err_out:
- td_set_runstate(td, old_state);
+ td_restore_runstate(td, old_state);
return 1;
}
@@ -980,11 +978,12 @@
if (td->o.random_distribution == FIO_RAND_DIST_RANDOM)
return 0;
- state = td->runstate;
- td_set_runstate(td, TD_SETTING_UP);
+ state = td_bump_runstate(td, TD_SETTING_UP);
+
for_each_file(td, f, i)
__init_rand_distribution(td, f);
- td_set_runstate(td, state);
+
+ td_restore_runstate(td, state);
return 1;
}
diff --git a/fio.h b/fio.h
index 6f5f29f..52f1def 100644
--- a/fio.h
+++ b/fio.h
@@ -475,6 +475,9 @@
};
extern void td_set_runstate(struct thread_data *, int);
+extern int td_bump_runstate(struct thread_data *, int);
+extern void td_restore_runstate(struct thread_data *, int);
+
#define TERMINATE_ALL (-1)
extern void fio_terminate_threads(int);
diff --git a/io_u.c b/io_u.c
index 75b23eb..8e27708 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1297,7 +1297,7 @@
struct io_u *__get_io_u(struct thread_data *td)
{
- struct io_u *io_u;
+ struct io_u *io_u = NULL;
td_io_u_lock(td);
diff --git a/libfio.c b/libfio.c
index f4aac2e..8eddab8 100644
--- a/libfio.c
+++ b/libfio.c
@@ -172,6 +172,19 @@
td->runstate = runstate;
}
+int td_bump_runstate(struct thread_data *td, int new_state)
+{
+ int old_state = td->runstate;
+
+ td_set_runstate(td, new_state);
+ return old_state;
+}
+
+void td_restore_runstate(struct thread_data *td, int old_state)
+{
+ td_set_runstate(td, old_state);
+}
+
void fio_terminate_threads(int group_id)
{
struct thread_data *td;
diff --git a/os/os-solaris.h b/os/os-solaris.h
index c8896b8..5b78cc2 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -5,6 +5,7 @@
#include <errno.h>
#include <malloc.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/pset.h>
@@ -105,7 +106,8 @@
static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
{
- const unsigned int max_cpus = cpus_online();
+ const unsigned int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ unsigned int num_cpus;
processorid_t *cpus;
int i, ret;
@@ -117,7 +119,7 @@
}
ret = 0;
- for (i = 0; i < max_cpus; i++) {
+ for (i = 0; i < num_cpus; i++) {
if (cpus[i] == cpu) {
ret = 1;
break;
@@ -128,15 +130,7 @@
return ret;
}
-static inline int fio_cpuset_init(os_cpu_mask_t *mask)
-{
- if (pset_create(mask) < 0)
- return -1;
-
- return 0;
-}
-
-static inline int fio_cpuset_count(os_cpu_mask_t *mask)
+static inline int fio_cpu_count(os_cpu_mask_t *mask)
{
unsigned int num_cpus;
@@ -146,6 +140,14 @@
return num_cpus;
}
+static inline int fio_cpuset_init(os_cpu_mask_t *mask)
+{
+ if (pset_create(mask) < 0)
+ return -1;
+
+ return 0;
+}
+
static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
{
if (pset_destroy(*mask) < 0)
diff --git a/server.c b/server.c
index b6961fd..dc70616 100644
--- a/server.c
+++ b/server.c
@@ -1138,7 +1138,7 @@
struct fio_net_cmd cmd;
struct iovec iov[2];
- iov[0].iov_base = &cmd;
+ iov[0].iov_base = (void *) &cmd;
iov[0].iov_len = sizeof(cmd);
iov[1].iov_base = (void *) buf;
iov[1].iov_len = size;