projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix O_DIRECT memory alignment
[fio.git]
/
fio.c
diff --git
a/fio.c
b/fio.c
index 4927f1c6142fe078de0176f708ad57a34a8feec3..aabfee6544c2cda3c7228927500e77548d7440a6 100644
(file)
--- a/
fio.c
+++ b/
fio.c
@@
-42,7
+42,8
@@
unsigned long page_mask;
unsigned long page_size;
unsigned long page_mask;
unsigned long page_size;
-#define ALIGN(buf) \
+
+#define PAGE_ALIGN(buf) \
(char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
int groupid = 0;
(char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
int groupid = 0;
@@
-387,21
+388,29
@@
static int break_on_this_error(struct thread_data *td, int *retptr)
else
err = td->error;
else
err = td->error;
- update_error_count(td, err);
-
if (td_non_fatal_error(err)) {
/*
* Continue with the I/Os in case of
* a non fatal error.
*/
if (td_non_fatal_error(err)) {
/*
* Continue with the I/Os in case of
* a non fatal error.
*/
+ update_error_count(td, err);
td_clear_error(td);
*retptr = 0;
return 0;
td_clear_error(td);
*retptr = 0;
return 0;
+ } else if (td->o.fill_device && err == ENOSPC) {
+ /*
+ * We expect to hit this error if
+ * fill_device option is set.
+ */
+ td_clear_error(td);
+ td->terminate = 1;
+ return 1;
} else {
/*
* Stop the I/O in case of a fatal
* error.
*/
} else {
/*
* Stop the I/O in case of a fatal
* error.
*/
+ update_error_count(td, err);
return 1;
}
}
return 1;
}
}
@@
-790,8
+799,8
@@
static int init_io_u(struct thread_data *td)
if (allocate_io_mem(td))
return 1;
if (allocate_io_mem(td))
return 1;
- if (td->o.odirect)
- p =
ALIGN(td->orig_buffer)
;
+ if (td->o.odirect
|| td->o.mem_align
)
+ p =
PAGE_ALIGN(td->orig_buffer) + td->o.mem_align
;
else
p = td->orig_buffer;
else
p = td->orig_buffer;
@@
-811,9
+820,11
@@
static int init_io_u(struct thread_data *td)
io_u = ptr;
memset(io_u, 0, sizeof(*io_u));
INIT_FLIST_HEAD(&io_u->list);
io_u = ptr;
memset(io_u, 0, sizeof(*io_u));
INIT_FLIST_HEAD(&io_u->list);
+ dprint(FD_MEM, "io_u alloc %p, index %u\n", io_u, i);
if (!(td->io_ops->flags & FIO_NOIO)) {
io_u->buf = p + max_bs * i;
if (!(td->io_ops->flags & FIO_NOIO)) {
io_u->buf = p + max_bs * i;
+ dprint(FD_MEM, "io_u %p, mem %p\n", io_u, io_u->buf);
if (td_write(td) && !td->o.refill_buffers)
io_u_fill_buffer(td, io_u, max_bs);
if (td_write(td) && !td->o.refill_buffers)
io_u_fill_buffer(td, io_u, max_bs);
@@
-1489,7
+1500,13
@@
static void run_threads(void)
*fio_debug_jobp = pid;
}
dprint(FD_MUTEX, "wait on startup_mutex\n");
*fio_debug_jobp = pid;
}
dprint(FD_MUTEX, "wait on startup_mutex\n");
- fio_mutex_down(startup_mutex);
+ if (fio_mutex_down_timeout(startup_mutex, 10)) {
+ log_err("fio: job startup hung? exiting.\n");
+ terminate_threads(TERMINATE_ALL);
+ fio_abort = 1;
+ nr_started--;
+ break;
+ }
dprint(FD_MUTEX, "done waiting on startup_mutex\n");
}
dprint(FD_MUTEX, "done waiting on startup_mutex\n");
}