aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-05-05 17:17:08 +0200
committerJens Axboe <axboe@fb.com>2016-05-05 09:20:18 -0600
commit1200fd07bb6f71be72749b306bd7647fe8009af5 (patch)
treebca5f763d17a8cfd2397f35df7f723f8e3a4f973
parent4019edfffaf17b72d75ed14b44105aec6eb254e2 (diff)
downloadblktrace-1200fd07bb6f71be72749b306bd7647fe8009af5.tar.gz
btt: Replace overlapping IO
Currently btt keeps the original IO in its RB-tree even if it sees new IO that is beginning at the same sector. However such IO most likely means that we have just lost the completion event for the IO that is still in the tree. So in such case replacing the IO in RB-tree makes more sense to avoid bogus IOs being reported as taking huge amount of time. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--btt/dip_rb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/btt/dip_rb.c b/btt/dip_rb.c
index 867a97b..2aa7ffc 100644
--- a/btt/dip_rb.c
+++ b/btt/dip_rb.c
@@ -37,8 +37,10 @@ int rb_insert(struct rb_root *root, struct io *iop)
p = &(*p)->rb_left;
else if (s > __s)
p = &(*p)->rb_right;
- else
- return 0;
+ else {
+ rb_replace_node(parent, &iop->rb_node, root);
+ return 1;
+ }
}
rb_link_node(&iop->rb_node, parent, p);