summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-02-19 21:32:12 +0100
committerJens Axboe <jens.axboe@oracle.com>2009-02-19 21:32:12 +0100
commit8347239af0a361e160293100bfc053f88bbbf737 (patch)
tree79640f7bbcdecc1b27bf5a5eb411e80be4cdd6f0 /log.c
parent112b52d9033015ce46506fd05c67c6a537024c59 (diff)
downloadfio-8347239af0a361e160293100bfc053f88bbbf737.tar.gz
fio-8347239af0a361e160293100bfc053f88bbbf737.tar.bz2
Allow 'norandommap' with verify
We used to turn off verify completely if norandommap was given, since fio does not track block rewrites. But we can easily track rewrites, as long as we don't have to track various extent sizes. So relax the restriction to only cover norandommap with differing block sizes and adapt log_io_piece() to always use rbtree inserts for cases where we do need to check for potential overwrites. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'log.c')
-rw-r--r--log.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/log.c b/log.c
index 01e4ad0b..6604c1c8 100644
--- 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.
+ *
+ * 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);
- p = &td->io_hist_tree.rb_node;
- parent = NULL;
/*
* 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);
- if (ipo->offset <= __ipo->offset)
+ if (ipo->offset < __ipo->offset)
p = &(*p)->rb_left;
- else
+ else if (ipo->offset > __ipo->offset)
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);