projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow IO logging even for diskless engines
[fio.git]
/
log.c
diff --git
a/log.c
b/log.c
index 611aa9f9aa11e68bfe80c8f00d3b2c245de67636..6fe4961255c710a0ccc82a3e2c66478eb0f334d9 100644
(file)
--- a/
log.c
+++ b/
log.c
@@
-183,28
+183,40
@@
void log_io_piece(struct thread_data *td, struct io_u *io_u)
*
* For both these cases, just reading back data in the order we
* wrote it out is the fastest.
*
* For both these cases, just reading back data in the order we
* wrote it out is the fastest.
+ *
+ * One exception is if we don't have a random map AND we are doing
+ * verifies, in that case we need to check for duplicate blocks and
+ * drop the old one, which we rely on the rb insert/lookup for
+ * handling.
*/
*/
- if (!td_random(td) || !td->o.overwrite) {
+ if ((!td_random(td) || !td->o.overwrite) &&
+ (file_randommap(td, ipo->file) || td->o.verify == VERIFY_NONE)) {
INIT_FLIST_HEAD(&ipo->list);
flist_add_tail(&ipo->list, &td->io_hist_list);
return;
}
RB_CLEAR_NODE(&ipo->rb_node);
INIT_FLIST_HEAD(&ipo->list);
flist_add_tail(&ipo->list, &td->io_hist_list);
return;
}
RB_CLEAR_NODE(&ipo->rb_node);
- p = &td->io_hist_tree.rb_node;
- parent = NULL;
/*
* Sort the entry into the verification list
*/
/*
* Sort the entry into the verification list
*/
+restart:
+ p = &td->io_hist_tree.rb_node;
+ parent = NULL;
while (*p) {
parent = *p;
__ipo = rb_entry(parent, struct io_piece, rb_node);
while (*p) {
parent = *p;
__ipo = rb_entry(parent, struct io_piece, rb_node);
- if (ipo->offset <
=
__ipo->offset)
+ if (ipo->offset < __ipo->offset)
p = &(*p)->rb_left;
p = &(*p)->rb_left;
- else
+ else
if (ipo->offset > __ipo->offset)
p = &(*p)->rb_right;
p = &(*p)->rb_right;
+ else {
+ assert(ipo->len == __ipo->len);
+ rb_erase(parent, &td->io_hist_tree);
+ goto restart;
+ }
}
rb_link_node(&ipo->rb_node, parent, p);
}
rb_link_node(&ipo->rb_node, parent, p);
@@
-388,12
+400,14
@@
static int init_iolog_write(struct thread_data *td)
FILE *f;
unsigned int i;
FILE *f;
unsigned int i;
- f = fopen(td->o.write_iolog_file, "
w+
");
+ f = fopen(td->o.write_iolog_file, "
a
");
if (!f) {
perror("fopen write iolog");
return 1;
}
if (!f) {
perror("fopen write iolog");
return 1;
}
+ printf("log opened\n");
+
/*
* That's it for writing, setup a log buffer and we're done.
*/
/*
* That's it for writing, setup a log buffer and we're done.
*/
@@
-422,9
+436,6
@@
int init_iolog(struct thread_data *td)
{
int ret = 0;
{
int ret = 0;
- if (td->io_ops->flags & FIO_DISKLESSIO)
- return 0;
-
if (td->o.read_iolog_file) {
/*
* Check if it's a blktrace file and load that if possible.
if (td->o.read_iolog_file) {
/*
* Check if it's a blktrace file and load that if possible.
@@
-455,7
+466,7
@@
void __finish_log(struct io_log *log, const char *name)
unsigned int i;
FILE *f;
unsigned int i;
FILE *f;
- f = fopen(name, "
w
");
+ f = fopen(name, "
a
");
if (!f) {
perror("fopen log");
return;
if (!f) {
perror("fopen log");
return;