projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sync engine: cleanup psync/sync seperation
[fio.git]
/
fio.c
diff --git
a/fio.c
b/fio.c
index 0ec4f5a0e347f975078cb9628e5c81641ad592f4..04a06bac1bee010b82866de1ade9ffd5178f3d7f 100644
(file)
--- a/
fio.c
+++ b/
fio.c
@@
-60,6
+60,8
@@
struct io_log *agg_io_log[2];
static inline void td_set_runstate(struct thread_data *td, int runstate)
{
static inline void td_set_runstate(struct thread_data *td, int runstate)
{
+ dprint(FD_PROCESS, "pid=%d: runstate %d -> %d\n", td->pid, td->runstate,
+ runstate);
td->runstate = runstate;
}
td->runstate = runstate;
}
@@
-70,6
+72,7
@@
static void terminate_threads(int group_id)
for_each_td(td, i) {
if (group_id == TERMINATE_ALL || groupid == td->groupid) {
for_each_td(td, i) {
if (group_id == TERMINATE_ALL || groupid == td->groupid) {
+ dprint(FD_PROCESS, "setting terminate on %d\n",td->pid);
/*
* if the thread is running, just let it exit
*/
/*
* if the thread is running, just let it exit
*/
@@
-568,6
+571,10
@@
sync_done:
}
}
}
}
+ if (td->o.fill_device && td->error == ENOSPC) {
+ td->error = 0;
+ td->terminate = 1;
+ }
if (!td->error) {
struct fio_file *f;
if (!td->error) {
struct fio_file *f;
@@
-586,6
+593,12
@@
sync_done:
}
} else
cleanup_pending_aio(td);
}
} else
cleanup_pending_aio(td);
+
+ /*
+ * stop job if we failed doing any IO
+ */
+ if ((td->this_io_bytes[0] + td->this_io_bytes[1]) == 0)
+ td->done = 1;
}
static void cleanup_io_u(struct thread_data *td)
}
static void cleanup_io_u(struct thread_data *td)
@@
-657,10
+670,12
@@
static int init_io_u(struct thread_data *td)
memset(io_u, 0, sizeof(*io_u));
INIT_LIST_HEAD(&io_u->list);
memset(io_u, 0, sizeof(*io_u));
INIT_LIST_HEAD(&io_u->list);
- io_u->buf = p + max_bs * i;
+ if (!(td->io_ops->flags & FIO_NOIO)) {
+ io_u->buf = p + max_bs * i;
- if (td_write(td))
- fill_io_buf(td, io_u, max_bs);
+ if (td_write(td))
+ fill_io_buf(td, io_u, max_bs);
+ }
io_u->index = i;
io_u->flags = IO_U_F_FREE;
io_u->index = i;
io_u->flags = IO_U_F_FREE;
@@
-762,7
+777,10
@@
static int clear_io_state(struct thread_data *td)
td->last_was_sync = 0;
td->last_was_sync = 0;
- if (td->o.time_based)
+ /*
+ * reset file done count if we are to start over
+ */
+ if (td->o.time_based || td->o.loops)
td->nr_done_files = 0;
for_each_file(td, f, i)
td->nr_done_files = 0;
for_each_file(td, f, i)
@@
-785,9
+803,8
@@
static int clear_io_state(struct thread_data *td)
*/
static void *thread_main(void *data)
{
*/
static void *thread_main(void *data)
{
- unsigned long long runtime[2];
+ unsigned long long runtime[2]
, elapsed
;
struct thread_data *td = data;
struct thread_data *td = data;
- unsigned long elapsed;
int clear_state;
if (!td->o.use_thread)
int clear_state;
if (!td->o.use_thread)
@@
-795,6
+812,8
@@
static void *thread_main(void *data)
td->pid = getpid();
td->pid = getpid();
+ dprint(FD_PROCESS, "jobs pid=%d started\n", td->pid);
+
INIT_LIST_HEAD(&td->io_u_freelist);
INIT_LIST_HEAD(&td->io_u_busylist);
INIT_LIST_HEAD(&td->io_u_requeues);
INIT_LIST_HEAD(&td->io_u_freelist);
INIT_LIST_HEAD(&td->io_u_busylist);
INIT_LIST_HEAD(&td->io_u_requeues);
@@
-827,7
+846,7
@@
static void *thread_main(void *data)
goto err;
}
goto err;
}
- if (td->ioprio) {
+ if (td->ioprio
_set
) {
if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) {
td_verror(td, errno, "ioprio_set");
goto err;
if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) {
td_verror(td, errno, "ioprio_set");
goto err;
@@
-1057,8
+1076,11
@@
reaped:
if (td->o.use_thread) {
long ret;
if (td->o.use_thread) {
long ret;
- if (pthread_join(td->thread, (void *) &ret))
+ dprint(FD_PROCESS, "joining tread %d\n", td->pid);
+ if (pthread_join(td->thread, (void *) &ret)) {
+ dprint(FD_PROCESS, "join failed %ld\n", ret);
perror("pthread_join");
perror("pthread_join");
+ }
}
(*nr_running)--;
}
(*nr_running)--;
@@
-1173,12
+1195,14
@@
static void run_threads(void)
nr_started++;
if (td->o.use_thread) {
nr_started++;
if (td->o.use_thread) {
+ dprint(FD_PROCESS, "will pthread_create\n");
if (pthread_create(&td->thread, NULL, thread_main, td)) {
perror("thread_create");
nr_started--;
break;
}
} else {
if (pthread_create(&td->thread, NULL, thread_main, td)) {
perror("thread_create");
nr_started--;
break;
}
} else {
+ dprint(FD_PROCESS, "will fork\n");
if (!fork()) {
int ret = fork_main(shm_id, i);
if (!fork()) {
int ret = fork_main(shm_id, i);