Small cleanup/tweaks of btree commit attr-lists
The goal here was to just be a bit more consistent/readable with how we instantiate these attr-lists.
This commit is contained in:
@@ -4136,18 +4136,19 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
// note that since we defer merges to compaction time, we can
|
// note that since we defer merges to compaction time, we can
|
||||||
// end up removing an rbyd here
|
// end up removing an rbyd here
|
||||||
bid -= rid - (rbyd.weight-1);
|
bid -= rid - (rbyd.weight-1);
|
||||||
scratch_attrs[0] = LFSR_ATTR(
|
if (rbyd_.weight == 0) {
|
||||||
bid+rid, BRANCH, 0,
|
scratch_attrs[0] = LFSR_ATTR(
|
||||||
BUF(scratch_buf, scratch_dsize));
|
bid+rid, RM, -rbyd.weight, NULL);
|
||||||
scratch_attrs[1] = (rbyd_.weight == 0
|
attrs = scratch_attrs;
|
||||||
? LFSR_ATTR(
|
attr_count = 1;
|
||||||
bid+rid, RM, -rbyd.weight,
|
} else {
|
||||||
NULL)
|
scratch_attrs[0] = LFSR_ATTR(
|
||||||
: LFSR_ATTR(
|
bid+rid, BRANCH, 0, BUF(scratch_buf, scratch_dsize));
|
||||||
bid+rid, GROW(RM), +rbyd_.weight-rbyd.weight,
|
scratch_attrs[1] = LFSR_ATTR(
|
||||||
NULL));
|
bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, NULL);
|
||||||
attrs = scratch_attrs;
|
attrs = scratch_attrs;
|
||||||
attr_count = 2;
|
attr_count = 2;
|
||||||
|
}
|
||||||
|
|
||||||
rbyd = parent;
|
rbyd = parent;
|
||||||
continue;
|
continue;
|
||||||
@@ -4272,21 +4273,22 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
LFS_ASSERT(rbyd_.weight > 0);
|
LFS_ASSERT(rbyd_.weight > 0);
|
||||||
LFS_ASSERT(sibling.weight > 0);
|
LFS_ASSERT(sibling.weight > 0);
|
||||||
scratch_attrs[0] = LFSR_ATTR(
|
scratch_attrs[0] = LFSR_ATTR(
|
||||||
bid+rid, BRANCH, 0,
|
bid+rid, BRANCH, 0, BUF(scratch1_buf, scratch1_dsize));
|
||||||
BUF(scratch1_buf, scratch1_dsize));
|
|
||||||
scratch_attrs[1] = LFSR_ATTR(
|
scratch_attrs[1] = LFSR_ATTR(
|
||||||
bid+rid, GROW(RM), +rbyd_.weight-rbyd.weight,
|
bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, NULL);
|
||||||
NULL);
|
|
||||||
scratch_attrs[2] = LFSR_ATTR(
|
scratch_attrs[2] = LFSR_ATTR(
|
||||||
bid+rid+rbyd_.weight-(rbyd.weight-1), BRANCH, +sibling.weight,
|
bid+rid - rbyd.weight + rbyd_.weight + 1,
|
||||||
BUF(scratch2_buf, scratch2_dsize));
|
BRANCH, +sibling.weight, BUF(scratch2_buf, scratch2_dsize));
|
||||||
scratch_attrs[3] = (lfsr_tag_suptype(split_tag) == LFSR_TAG_NAME
|
if (lfsr_tag_suptype(split_tag) == LFSR_TAG_NAME) {
|
||||||
? LFSR_ATTR(
|
scratch_attrs[3] = LFSR_ATTR(
|
||||||
bid+rid+rbyd_.weight-(rbyd.weight-1)+sibling.weight-1,
|
bid+rid - rbyd.weight + rbyd_.weight + sibling.weight,
|
||||||
BNAME, 0, DATA(split_data))
|
BNAME, 0, DATA(split_data));
|
||||||
: LFSR_ATTR_NOOP);
|
attrs = scratch_attrs;
|
||||||
attrs = scratch_attrs;
|
attr_count = 4;
|
||||||
attr_count = 4;
|
} else {
|
||||||
|
attrs = scratch_attrs;
|
||||||
|
attr_count = 3;
|
||||||
|
}
|
||||||
|
|
||||||
rbyd = parent;
|
rbyd = parent;
|
||||||
continue;
|
continue;
|
||||||
@@ -4369,10 +4371,9 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
scratch_attrs[0] = LFSR_ATTR(
|
scratch_attrs[0] = LFSR_ATTR(
|
||||||
bid+rid+sibling.weight, RM, -sibling.weight, NULL);
|
bid+rid+sibling.weight, RM, -sibling.weight, NULL);
|
||||||
scratch_attrs[1] = LFSR_ATTR(
|
scratch_attrs[1] = LFSR_ATTR(
|
||||||
bid+rid, BRANCH, 0,
|
bid+rid, BRANCH, 0, BUF(scratch_buf, scratch_dsize));
|
||||||
BUF(scratch_buf, scratch_dsize));
|
|
||||||
scratch_attrs[2] = LFSR_ATTR(
|
scratch_attrs[2] = LFSR_ATTR(
|
||||||
bid+rid, GROW(RM), +rbyd_.weight-rbyd.weight, NULL);
|
bid+rid, GROW(RM), -rbyd.weight + rbyd_.weight, NULL);
|
||||||
attrs = scratch_attrs;
|
attrs = scratch_attrs;
|
||||||
attr_count = 3;
|
attr_count = 3;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user