Fix problems with rb code

If the offset match, we must not break. Instead follow the left branch
and things will work as expected.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 504b78d..6a3a87b 100644
--- a/fio.c
+++ b/fio.c
@@ -736,6 +736,7 @@
 	INIT_LIST_HEAD(&td->io_u_busylist);
 	INIT_LIST_HEAD(&td->io_u_requeues);
 	INIT_LIST_HEAD(&td->io_log_list);
+	td->io_hist_tree = RB_ROOT;
 
 	if (init_io_u(td))
 		goto err_sem;
diff --git a/log.c b/log.c
index d59c38f..0614b27 100644
--- a/log.c
+++ b/log.c
@@ -48,7 +48,7 @@
 	struct io_piece *ipo, *__ipo;
 
 	ipo = malloc(sizeof(struct io_piece));
-	memset(&ipo->rb_node, 0, sizeof(ipo->rb_node));
+	RB_CLEAR_NODE(&ipo->rb_node);
 	ipo->file = io_u->file;
 	ipo->offset = io_u->offset;
 	ipo->len = io_u->buflen;
@@ -60,12 +60,10 @@
 		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 if (ipo->offset > __ipo->offset)
-			p = &(*p)->rb_right;
 		else
-			break;
+			p = &(*p)->rb_right;
 	}
 
 	rb_link_node(&ipo->rb_node, parent, p);