Allow verification of random overwrites w/ba < bs
authorJustin Eno <jeno@micron.com>
Thu, 29 Jan 2015 20:59:22 +0000 (12:59 -0800)
committerJens Axboe <axboe@fb.com>
Wed, 18 Feb 2015 18:38:34 +0000 (10:38 -0800)
When blockalign is less than blocksize, random overwrite
workloads may partially overwrite blocks.  This change
evicts partially-overwritten blocks from the iolog tree
so subsequent verification targets only intact blocks.

This change also allows verification with norandommap
and bsrange, though that is left disabled.
Signed-off-by: Justin Eno <jeno@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
iolog.c

diff --git a/iolog.c b/iolog.c
index 99f8bc18d8694cca0c141c51d116aced1b4130f2..b867583a27bc1f11e649ab8d88936507affcee53 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -250,6 +250,7 @@ restart:
        p = &td->io_hist_tree.rb_node;
        parent = NULL;
        while (*p) {
+               int overlap = 0;
                parent = *p;
 
                __ipo = rb_entry(parent, struct io_piece, rb_node);
@@ -257,11 +258,18 @@ restart:
                        p = &(*p)->rb_left;
                else if (ipo->file > __ipo->file)
                        p = &(*p)->rb_right;
-               else if (ipo->offset < __ipo->offset)
+               else if (ipo->offset < __ipo->offset) {
                        p = &(*p)->rb_left;
-               else if (ipo->offset > __ipo->offset)
+                       overlap = ipo->offset + ipo->len > __ipo->offset;
+               }
+               else if (ipo->offset > __ipo->offset) {
                        p = &(*p)->rb_right;
-               else {
+                       overlap = __ipo->offset + __ipo->len > ipo->offset;
+               }
+               else
+                       overlap = 1;
+
+               if (overlap) {
                        dprint(FD_IO, "iolog: overlap %llu/%lu, %llu/%lu",
                                __ipo->offset, __ipo->len,
                                ipo->offset, ipo->len);