Fix a bug with multiple files in the same io_piece rbtree
[fio.git] / log.c
diff --git a/log.c b/log.c
index 6a99c6611e3ad79aa2763ee44f4656863d1ba824..5fc8f64bef4fde855d9c11e471db35f0d94778f6 100644 (file)
--- a/log.c
+++ b/log.c
@@ -219,7 +219,11 @@ restart:
                parent = *p;
 
                __ipo = rb_entry(parent, struct io_piece, rb_node);
-               if (ipo->offset < __ipo->offset)
+               if (ipo->file < __ipo->file)
+                       p = &(*p)->rb_left;
+               else if (ipo->file > __ipo->file)
+                       p = &(*p)->rb_right;
+               else if (ipo->offset < __ipo->offset)
                        p = &(*p)->rb_left;
                else if (ipo->offset > __ipo->offset)
                        p = &(*p)->rb_right;