[DragonFlyBSD - Submit #2801] (New) sys/vfs/hammer: Properly set mirror_tid on root node split

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Sun Mar 8 08:59:11 PDT 2015


Issue #2801 has been reported by tkusumi.

----------------------------------------
Submit #2801: sys/vfs/hammer: Properly set mirror_tid on root node split
http://bugs.dragonflybsd.org/issues/2801

* Author: tkusumi
* Status: New
* Priority: Normal
* Assignee: 
* Category: VFS subsystem
* Target version: 
----------------------------------------
Matt,
Please review following diff.
I think this is the way it should be unless you made it that way
for some technical reason.

diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c
index 49c5b48..8794536 100644
--- a/sys/vfs/hammer/hammer_btree.c
+++ b/sys/vfs/hammer/hammer_btree.c
@@ -1586,6 +1586,8 @@ btree_split_internal(hammer_cursor_t cursor)
                ondisk->elms[0].base = hmp->root_btree_beg;
                ondisk->elms[0].base.btype = node->ondisk->type;
                ondisk->elms[0].internal.subtree_offset = node->node_offset;
+               ondisk->elms[0].internal.mirror_tid = ondisk->mirror_tid;
+               /* the element at &elms[1] is updated later as parent_elm */
                ondisk->elms[1].base = hmp->root_btree_end;
                hammer_modify_node_done(parent);
                /* ondisk->elms[1].base.btype - not used */
@@ -1834,6 +1836,8 @@ btree_split_leaf(hammer_cursor_t cursor)
                ondisk->elms[0].base = hmp->root_btree_beg;
                ondisk->elms[0].base.btype = leaf->ondisk->type;
                ondisk->elms[0].internal.subtree_offset = leaf->node_offset;
+               ondisk->elms[0].internal.mirror_tid = ondisk->mirror_tid;
+               /* the element at &elms[1] is updated later as parent_elm */
                ondisk->elms[1].base = hmp->root_btree_end;
                /* ondisk->elms[1].base.btype = not used */
                hammer_modify_node_done(parent);


Without above diff, root node split creates a new root whose
elms[0] has 0 for mirror_tid. Mirroring still works because
elms[1] and the node itself have the right mirror_tid from its children,
however hammer show command reports "BM" for the child node
because the root node's elms[0].internal.mirror_tid (==0) is
smaller than that of child node.

Following
(A) is existing behavior right after root split, reporting "BM".
(B) is hammer with this diff applied, not reporting "BM".

(B) writes out different mirror_tid to storage compared to
the existing hammer (A), but I don't see (B) breaks anything in
existing storage, but is rather better in the sense that (B)
does not violate hammer's general design.


-------------
(A) - elms[1] has 00000001000087a0 for mirror_tid, but elms[0] has 0

     NODE 8000000020801000 cnt=02 p=0000000000000000 type=I depth=0 mirror 00000001000087a0 fill=z8:65=1% {
G------ ELM  0 L lo=00000000 obj=8000000000000000 rt=00 key=8000000000000000 ot=00
               d tids 0000000000000001:0000000000000001 suboff=8000000020800000 mirror 0000000000000000
G------ ELM  1 L lo=00000001 obj=0000000080000209 rt=01 key=0000000000000000 ot=00
                 tids 0000000100008420:0000000000000000 suboff=8000000020802000 mirror 00000001000087a0
G------ RBN  2 ? lo=ffffffff obj=7fffffffffffffff rt=ffff key=7fffffffffffffff ot=00
                 tids ffffffffffffffff:0000000000000000 suboff=0000000000000000 mirror 0000000000000000
     }
BM   NODE 8000000020800000 cnt=32 p=8000000020801000 type=L depth=1 mirror 00000001000087a0 fill=z8:65=1%
...


-------------
(B) - both elms[0] and elms[1] has 00000001000087a0 for mirror_tid

     NODE 8000000020801000 cnt=02 p=0000000000000000 type=I depth=0 mirror 00000001000087a0 fill=z8:65=1% {
G------ ELM  0 L lo=00000000 obj=8000000000000000 rt=00 key=8000000000000000 ot=00
               d tids 0000000000000001:0000000000000001 suboff=8000000020800000 mirror 00000001000087a0
G------ ELM  1 L lo=00000001 obj=0000000080000209 rt=01 key=0000000000000000 ot=00
                 tids 0000000100008420:0000000000000000 suboff=8000000020802000 mirror 00000001000087a0
G------ RBN  2 ? lo=ffffffff obj=7fffffffffffffff rt=ffff key=7fffffffffffffff ot=00
                 tids ffffffffffffffff:0000000000000000 suboff=0000000000000000 mirror 0000000000000000
     }
     NODE 8000000020800000 cnt=32 p=8000000020801000 type=L depth=1 mirror 00000001000087a0 fill=z8:65=1% {
...




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Submit mailing list