From be497f3fcf1b1f80c1cb3946aab8087ea800e37c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 2 Jan 2017 10:33:02 -0800 Subject: [PATCH] Make sure to bubble the node aug bits up the treap We forgot to or in a node's children's augmentation bits when setting the augmentation bits up in the parent's ref. This stopped ring dirtying from finding all the dirty nodes in the treap. Signed-off-by: Zach Brown --- kmod/src/treap.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kmod/src/treap.c b/kmod/src/treap.c index 81cfe343..3e241298 100644 --- a/kmod/src/treap.c +++ b/kmod/src/treap.c @@ -168,17 +168,19 @@ static u8 old_aug_bit(struct scoutfs_treap *treap) return off_aug_bit(treap, tinf->dirty_off) ^ SCOUTFS_TREAP_AUG_HALVES; } - -/* Return the aug bits that'll be used to refer to the given node. */ +/* + * Return the aug bits that'll be used to refer to the given node. + * We calculate the bits for the node itself and then or those with the + * bits in its references to its children. + */ static u8 node_aug_bits(struct scoutfs_treap *treap, struct treap_node *node) { DECLARE_TREAP_INFO(treap->sb, tinf); - u8 aug_bits = 0; - if (node->off == tinf->dirty_off) - aug_bits |= SCOUTFS_TREAP_AUG_DIRTY; - - return aug_bits | off_aug_bit(treap, node->off); + return (node->off == tinf->dirty_off ? SCOUTFS_TREAP_AUG_DIRTY : 0) | + off_aug_bit(treap, node->off) | + node->left.aug_bits | + node->right.aug_bits; } /*