projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix assert
[fio.git]
/
fio.c
diff --git
a/fio.c
b/fio.c
index 03dc6cc8871319b786a66d854371320be4208728..7b03250bd22ddce7b01c6a3e8e306ca108ef447e 100644
(file)
--- a/
fio.c
+++ b/
fio.c
@@
-38,6
+38,7
@@
#include "hash.h"
#include "smalloc.h"
#include "verify.h"
#include "hash.h"
#include "smalloc.h"
#include "verify.h"
+#include "trim.h"
#include "diskutil.h"
#include "cgroup.h"
#include "profile.h"
#include "diskutil.h"
#include "cgroup.h"
#include "profile.h"
@@
-142,17
+143,6
@@
static void sig_int(int sig)
}
}
}
}
-static void sig_ill(int fio_unused sig)
-{
- if (!threads)
- return;
-
- log_err("fio: illegal instruction. your cpu does not support "
- "the sse4.2 instruction for crc32c\n");
- terminate_threads(TERMINATE_ALL);
- exit(4);
-}
-
static void set_sig_handlers(void)
{
struct sigaction act;
static void set_sig_handlers(void)
{
struct sigaction act;
@@
-167,11
+157,6
@@
static void set_sig_handlers(void)
act.sa_flags = SA_RESTART;
sigaction(SIGINT, &act, NULL);
act.sa_flags = SA_RESTART;
sigaction(SIGINT, &act, NULL);
- memset(&act, 0, sizeof(act));
- act.sa_handler = sig_ill;
- act.sa_flags = SA_RESTART;
- sigaction(SIGILL, &act, NULL);
-
memset(&act, 0, sizeof(act));
act.sa_handler = sig_quit;
act.sa_flags = SA_RESTART;
memset(&act, 0, sizeof(act));
act.sa_handler = sig_quit;
act.sa_flags = SA_RESTART;
@@
-192,6
+177,8
@@
static int __check_min_rate(struct thread_data *td, struct timeval *now,
unsigned int rate_iops = 0;
unsigned int rate_iops_min = 0;
unsigned int rate_iops = 0;
unsigned int rate_iops_min = 0;
+ assert(ddir_rw(ddir));
+
if (!td->o.ratemin[ddir] && !td->o.rate_iops_min[ddir])
return 0;
if (!td->o.ratemin[ddir] && !td->o.rate_iops_min[ddir])
return 0;
@@
-507,7
+494,8
@@
static void do_verify(struct thread_data *td)
io_u->xfer_buf += bytes;
io_u->offset += bytes;
io_u->xfer_buf += bytes;
io_u->offset += bytes;
- td->ts.short_io_u[io_u->ddir]++;
+ if (ddir_rw(io_u->ddir))
+ td->ts.short_io_u[io_u->ddir]++;
if (io_u->offset == f->real_file_size)
goto sync_done;
if (io_u->offset == f->real_file_size)
goto sync_done;
@@
-592,6
+580,7
@@
static void do_io(struct thread_data *td)
td_set_runstate(td, TD_RUNNING);
while ( (td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
td_set_runstate(td, TD_RUNNING);
while ( (td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
+ (!flist_empty(&td->trim_list)) ||
((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->o.size) ) {
struct timeval comp_time;
unsigned long bytes_done[2] = { 0, 0 };
((td->this_io_bytes[0] + td->this_io_bytes[1]) < td->o.size) ) {
struct timeval comp_time;
unsigned long bytes_done[2] = { 0, 0 };
@@
-652,7
+641,8
@@
static void do_io(struct thread_data *td)
io_u->xfer_buf += bytes;
io_u->offset += bytes;
io_u->xfer_buf += bytes;
io_u->offset += bytes;
- td->ts.short_io_u[io_u->ddir]++;
+ if (ddir_rw(io_u->ddir))
+ td->ts.short_io_u[io_u->ddir]++;
if (io_u->offset == f->real_file_size)
goto sync_done;
if (io_u->offset == f->real_file_size)
goto sync_done;
@@
-746,6
+736,9
@@
sync_done:
}
}
}
}
+ if (td->trim_entries)
+ printf("trim entries %ld\n", td->trim_entries);
+
if (td->o.fill_device && td->error == ENOSPC) {
td->error = 0;
td->terminate = 1;
if (td->o.fill_device && td->error == ENOSPC) {
td->error = 0;
td->terminate = 1;
@@
-847,6
+840,13
@@
static int init_io_u(struct thread_data *td)
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);
+ else if (td_write(td) && td->o.verify_pattern_bytes) {
+ /*
+ * Fill the buffer with the pattern if we are
+ * going to be doing writes.
+ */
+ fill_pattern(td, io_u->buf, max_bs, io_u);
+ }
}
io_u->index = i;
}
io_u->index = i;
@@
-1027,6
+1027,7
@@
static void *thread_main(void *data)
INIT_FLIST_HEAD(&td->io_log_list);
INIT_FLIST_HEAD(&td->io_hist_list);
INIT_FLIST_HEAD(&td->verify_list);
INIT_FLIST_HEAD(&td->io_log_list);
INIT_FLIST_HEAD(&td->io_hist_list);
INIT_FLIST_HEAD(&td->verify_list);
+ INIT_FLIST_HEAD(&td->trim_list);
pthread_mutex_init(&td->io_u_lock, NULL);
td->io_hist_tree = RB_ROOT;
pthread_mutex_init(&td->io_u_lock, NULL);
td->io_hist_tree = RB_ROOT;
@@
-1193,6
+1194,13
@@
static void *thread_main(void *data)
} else
finish_log(td, td->ts.bw_log, "bw");
}
} else
finish_log(td, td->ts.bw_log, "bw");
}
+ if (td->ts.lat_log) {
+ if (td->o.lat_log_file) {
+ finish_log_named(td, td->ts.lat_log,
+ td->o.lat_log_file, "lat");
+ } else
+ finish_log(td, td->ts.lat_log, "lat");
+ }
if (td->ts.slat_log) {
if (td->o.lat_log_file) {
finish_log_named(td, td->ts.slat_log,
if (td->ts.slat_log) {
if (td->o.lat_log_file) {
finish_log_named(td, td->ts.slat_log,
@@
-1382,9
+1390,13
@@
static void *gtod_thread_main(void *data)
static int fio_start_gtod_thread(void)
{
static int fio_start_gtod_thread(void)
{
+ pthread_attr_t attr;
int ret;
int ret;
- ret = pthread_create(>od_thread, NULL, gtod_thread_main, NULL);
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+ ret = pthread_create(>od_thread, &attr, gtod_thread_main, NULL);
+ pthread_attr_destroy(&attr);
if (ret) {
log_err("Can't create gtod thread: %s\n", strerror(ret));
return 1;
if (ret) {
log_err("Can't create gtod thread: %s\n", strerror(ret));
return 1;
@@
-1694,8
+1706,7
@@
int main(int argc, char *argv[])
cgroup_kill(cgroup_list);
sfree(cgroup_list);
cgroup_kill(cgroup_list);
sfree(cgroup_list);
- if (cgroup_mnt)
- sfree(cgroup_mnt);
+ sfree(cgroup_mnt);
fio_mutex_remove(startup_mutex);
fio_mutex_remove(writeout_mutex);
fio_mutex_remove(startup_mutex);
fio_mutex_remove(writeout_mutex);