diff --git a/lfs.c b/lfs.c index 09f61c4f..97c78257 100644 --- a/lfs.c +++ b/lfs.c @@ -619,7 +619,7 @@ enum lfsr_tag_type { // some tag modifiers // in-device only LFSR_TAG_WIDE = 0x4000, - LFSR_TAG_GROW = 0x2000, + LFSR_TAG_GROW = 0x3000, // note generic grows need the rm-bit LFSR_TAG_RM = 0x1000, // in-device only @@ -632,8 +632,9 @@ enum lfsr_tag_type { // some tag modifiers #define LFSR_TAG_WIDE(tag) (LFSR_TAG_WIDE | LFSR_TAG_##tag) -#define LFSR_TAG_GROW(tag) (LFSR_TAG_GROW | LFSR_TAG_##tag) -#define LFSR_TAG_RM(tag) (LFSR_TAG_RM | LFSR_TAG_##tag) +// if we're growing an explict tag, we don't need the rm-bit +#define LFSR_TAG_GROW(tag) ((LFSR_TAG_GROW & ~LFSR_TAG_RM) | LFSR_TAG_##tag) +#define LFSR_TAG_RM(tag) (LFSR_TAG_RM | LFSR_TAG_##tag) // some other tag encodings with their own subfields #define LFSR_TAG_ALT(d, c, key) \ @@ -4090,7 +4091,7 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree, bid+rid, BRANCH, 0, BUF(scratch_buf, scratch_dsize)); scratch_attrs[1] = LFSR_ATTR( - bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, + bid+rid, GROW, -rbyd.weight + rbyd_.weight, NULL); attrs = scratch_attrs; attr_count = 2; @@ -4228,7 +4229,7 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree, bid+rid, BRANCH, 0, BUF(scratch1_buf, scratch1_dsize)); scratch_attrs[1] = LFSR_ATTR( - bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, + bid+rid, GROW, -rbyd.weight + rbyd_.weight, NULL); } scratch_attrs[2] = LFSR_ATTR( @@ -4333,7 +4334,7 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree, bid+rid, BRANCH, 0, BUF(scratch_buf, scratch_dsize)); scratch_attrs[2] = LFSR_ATTR( - bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, + bid+rid, GROW, -rbyd.weight + rbyd_.weight, NULL); attrs = scratch_attrs; attr_count = 3; diff --git a/tests/test_btree.toml b/tests/test_btree.toml index 08e02aca..748d7d06 100644 --- a/tests/test_btree.toml +++ b/tests/test_btree.toml @@ -49,7 +49,7 @@ code = ''' // the struct tag return lfsr_btree_commit(lfs, btree, LFSR_ATTRS( LFSR_ATTR(bid, WIDE(TAG(tag)), 0, DATA(data)), - LFSR_ATTR(bid, GROW(RM), weight - weight_, NULL))); + LFSR_ATTR(bid, GROW, weight - weight_, NULL))); } static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) { @@ -84,7 +84,7 @@ code = ''' } return lfsr_btree_commit(lfs, btree, LFSR_ATTRS( - LFSR_ATTR(bid, GROW(RM), +weight1-weight_, NULL), + LFSR_ATTR(bid, GROW, +weight1-weight_, NULL), LFSR_ATTR(bid-(weight_-1)+weight1-1, TAG(tag1), 0, DATA(data1)), (lfsr_data_size(&name) > 0 ? LFSR_ATTR(bid-(weight_-1)+weight1, diff --git a/tests/test_rbyd.toml b/tests/test_rbyd.toml index e3c86582..423d9ed4 100644 --- a/tests/test_rbyd.toml +++ b/tests/test_rbyd.toml @@ -10542,7 +10542,7 @@ code = ''' lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( - LFSR_ATTR(j*W+W-1, GROW(RM), -D, NULL))) => 0; + LFSR_ATTR(j*W+W-1, GROW, -D, NULL))) => 0; assert(rbyd.weight == N*W-D); lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0; @@ -11460,7 +11460,7 @@ code = ''' sim_weights[rid] += weight; // update our rbyd lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( - LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), +weight, + LFSR_ATTR(weighted_rid+weight_-1, GROW, +weight, NULL))) => 0; } else if (op == 3) { // get the correct weight from the sim @@ -11472,7 +11472,7 @@ code = ''' sim_weights[rid] -= weight; // update our rbyd lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( - LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), -weight, + LFSR_ATTR(weighted_rid+weight_-1, GROW, -weight, NULL))) => 0; } }