Inverted mk-bit logic, renamed to grow-bit

This only affects the in-device tags, not the on-disk tags.

The mk variant of tags was seeing much more use than the grow variant,
since the grow variant is really only used by the btree internals. But
since the default encoding of tags cleared the mk-bit, this led to a
bunch of extra lfsr_tag_setmk calls just to reserialize things correctly
during compact, split, etc.

Flipping the logic so the bit needs to be set to grow tags simplified
things quite a bit.

Note that mk tags do nothing when their delta is zero, so zero-delta
tags are the same in both mk/grow mode.
This commit is contained in:
Christopher Haster
2023-06-18 01:32:43 -05:00
parent 7180b70c9c
commit f2c36efdb3
3 changed files with 406 additions and 410 deletions
+78 -86
View File
@@ -586,7 +586,7 @@ static int lfsr_bd_erase(lfs_t *lfs, lfs_block_t block) {
enum lfsr_tag_type {
LFSR_TAG_NULL = 0x0000,
LFSR_TAG_UNR = 0x1000, // in-device only
LFSR_TAG_MKUNR = 0x3000, // in-device only
LFSR_TAG_GROW = 0x3000, // in-device only
LFSR_TAG_SUPERMAGIC = 0x0003,
LFSR_TAG_SUPERCONFIG = 0x0004,
@@ -594,24 +594,20 @@ enum lfsr_tag_type {
LFSR_TAG_NAME = 0x0100,
LFSR_TAG_BRANCH = 0x0100,
LFSR_TAG_MKBRANCH = 0x2100, // in-device only
LFSR_TAG_REG = 0x0101,
LFSR_TAG_MKREG = 0x2101, // in-device only
LFSR_TAG_GROWREG = 0x2101, // test only? TODO
LFSR_TAG_DIR = 0x0102,
LFSR_TAG_MKDIR = 0x2102, // in-device only
LFSR_TAG_STRUCT = 0x0300,
LFSR_TAG_INLINED = 0x0300,
LFSR_TAG_MKINLINED = 0x2300, // test only?
LFSR_TAG_BLOCK = 0x0302,
LFSR_TAG_BTREE = 0x0303,
LFSR_TAG_MKBTREE = 0x2303, // in-device only
LFSR_TAG_RMBTREE = 0x1303,
LFSR_TAG_MDIR = 0x0305,
LFSR_TAG_RMMDIR = 0x1305,
LFSR_TAG_UATTR = 0x0400,
LFSR_TAG_MKUATTR = 0x2400, // in-device only
LFSR_TAG_GROWUATTR = 0x2400, // test only? TODO
LFSR_TAG_RMUATTR = 0x1400,
LFSR_TAG_ALT = 0x4000,
@@ -623,11 +619,6 @@ enum lfsr_tag_type {
LFSR_TAG_CRC = 0x2000,
LFSR_TAG_FCRC = 0x2100,
// in-device only
LFSR_TAG_GROW = 0x0f00,
LFSR_TAG_SHRINK = 0x0f01,
LFSR_TAG_FROM = 0x0f02,
};
#define LFSR_TAG_ALT_(color, dir, key) \
@@ -644,10 +635,16 @@ enum lfsr_tag_type {
(LFSR_TAG_UATTR \
| (0xff & (lfsr_tag_t)(attr)))
// TODO test only?
#define LFSR_TAG_MKUATTR(attr) \
(LFSR_TAG_MKUATTR \
| (0xff & (lfsr_tag_t)(attr)))
// TODO test only?
#define LFSR_TAG_GROWUATTR(attr) \
(LFSR_TAG_GROWUATTR \
| (0xff & (lfsr_tag_t)(attr)))
#define LFSR_TAG_RMUATTR(attr) \
(LFSR_TAG_RMUATTR \
| (0xff & (lfsr_tag_t)(attr)))
@@ -673,15 +670,15 @@ static inline lfsr_tag_t lfsr_tag_setinvalid(lfsr_tag_t tag) {
return tag | 0x8000;
}
static inline bool lfsr_tag_ismk(lfsr_tag_t tag) {
static inline bool lfsr_tag_isgrow(lfsr_tag_t tag) {
return tag & 0x2000;
}
static inline lfsr_tag_t lfsr_tag_setmk(lfsr_tag_t tag) {
static inline lfsr_tag_t lfsr_tag_setgrow(lfsr_tag_t tag) {
return tag | 0x2000;
}
static inline lfsr_tag_t lfsr_tag_setnomk(lfsr_tag_t tag) {
static inline lfsr_tag_t lfsr_tag_cleargrow(lfsr_tag_t tag) {
return tag & ~0x2000;
}
@@ -709,7 +706,7 @@ static inline lfsr_tag_t lfsr_tag_next(lfsr_tag_t tag) {
return tag + 0x1;
}
// lfsr_rbyd_append specific flags
// lfsr_rbyd_append diverged specific flags
static inline bool lfsr_tag_hasdiverged(lfsr_tag_t tag) {
return tag & 0x2000;
}
@@ -1234,20 +1231,20 @@ typedef struct lfsr_attr {
// find state when looking up by name
typedef struct lfsr_find {
// what to search for
const char *name;
lfs_size_t name_size;
// if found, the tag/id will be placed in found_tag/found_id,
// otherwise found_tag will be zero and found_id will be set to
// the largest, smaller id (a good place to insert)
lfs_ssize_t predicted_id;
lfs_ssize_t found_id;
lfsr_tag_t predicted_tag;
lfsr_tag_t found_tag;
} lfsr_find_t;
//// find state when looking up by name
//typedef struct lfsr_find {
// // what to search for
// const char *name;
// lfs_size_t name_size;
//
// // if found, the tag/id will be placed in found_tag/found_id,
// // otherwise found_tag will be zero and found_id will be set to
// // the largest, smaller id (a good place to insert)
// lfs_ssize_t predicted_id;
// lfs_ssize_t found_id;
// lfsr_tag_t predicted_tag;
// lfsr_tag_t found_tag;
//} lfsr_find_t;
@@ -1299,24 +1296,24 @@ typedef struct lfsr_find {
// a->pair[1] = lfs_tole32(a->pair[1]);
//}
//#endif
// operations on forward-CRCs used to track erased state
struct lfs_fcrc {
lfs_size_t size;
uint32_t crc;
};
static void lfs_fcrc_fromle32(struct lfs_fcrc *fcrc) {
fcrc->size = lfs_fromle32(fcrc->size);
fcrc->crc = lfs_fromle32(fcrc->crc);
}
#ifndef LFS_READONLY
static void lfs_fcrc_tole32(struct lfs_fcrc *fcrc) {
fcrc->size = lfs_tole32(fcrc->size);
fcrc->crc = lfs_tole32(fcrc->crc);
}
#endif
//
//// operations on forward-CRCs used to track erased state
//struct lfs_fcrc {
// lfs_size_t size;
// uint32_t crc;
//};
//
//static void lfs_fcrc_fromle32(struct lfs_fcrc *fcrc) {
// fcrc->size = lfs_fromle32(fcrc->size);
// fcrc->crc = lfs_fromle32(fcrc->crc);
//}
//
//#ifndef LFS_READONLY
//static void lfs_fcrc_tole32(struct lfs_fcrc *fcrc) {
// fcrc->size = lfs_tole32(fcrc->size);
// fcrc->crc = lfs_tole32(fcrc->crc);
//}
//#endif
// fcrc on-disk encoding
typedef struct lfsr_fcrc {
@@ -1990,7 +1987,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
}
// ignore noops
if (lfsr_tag_setnomk(tag) == LFSR_TAG_UNR && delta == 0) {
if (lfsr_tag_cleargrow(tag) == LFSR_TAG_UNR && delta == 0) {
return 0;
}
@@ -2014,7 +2011,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
lfs_ssize_t other_id_;
lfsr_tag_t tag_;
lfsr_tag_t other_tag_;
if (lfsr_tag_ismk(tag) && delta > 0) {
if (delta > 0 && !lfsr_tag_isgrow(tag)) {
LFS_ASSERT(id <= (lfs_ssize_t)rbyd->weight);
// it's a bit ugly, but adjusting the id here makes the following
@@ -2025,7 +2022,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
// also note these tags MUST NOT be zero, due to unreachable tag holes
tag_ = 0x1;
other_tag_ = 0x1;
} else if (lfsr_tag_ismk(tag) && delta < 0) {
} else if (delta < 0 && !lfsr_tag_isgrow(tag)) {
LFS_ASSERT(id < (lfs_ssize_t)rbyd->weight);
// it's a bit ugly, but adjusting the id here makes the following
@@ -2363,7 +2360,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
// note if tag_ is null, we found a removed tag that we should just prune
if (tag_ && (id_ < id-lfs_smax32(-delta, 0)
|| (id_ == id-lfs_smax32(-delta, 0)
&& ((lfsr_tag_ismk(tag) && delta > 0)
&& ((delta > 0 && !lfsr_tag_isgrow(tag))
|| lfsr_tag_key(tag_) < lfsr_tag_key(tag))))) {
if (lfsr_tag_isrm(tag)) {
// if removed, make our tag unreachable
@@ -2379,7 +2376,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
} else if (tag_ && (id_ > id
|| (id_ == id
&& ((lfsr_tag_ismk(tag) && delta > 0)
&& ((delta > 0 && !lfsr_tag_isgrow(tag))
|| lfsr_tag_key(tag_) > lfsr_tag_key(tag))))) {
if (lfsr_tag_isrm(tag)) {
// if removed, make our tag unreachable
@@ -2425,7 +2422,7 @@ leaf:;
if (!lfsr_tag_isrm(tag)) {
// write the actual tag
lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off,
lfsr_tag_setnomk(tag), upper_id - lower_id - 1 + delta,
lfsr_tag_cleargrow(tag), upper_id - lower_id - 1 + delta,
lfsr_data_size(data),
&rbyd->crc);
if (d < 0) {
@@ -2507,7 +2504,7 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd,
// append the attr
err = lfsr_rbyd_append(lfs, rbyd,
id-lfs_smax32(w-1, 0)-lfs_smax32(start_id, 0),
lfsr_tag_setmk(tag), +w, data);
tag, +w, data);
if (err) {
return err;
}
@@ -3475,11 +3472,11 @@ static int lfsr_btree_commit(lfs_t *lfs,
// note that since we defer merges to compaction time, we can
// end up removing an rbyd here
if (rbyd->weight == 0) {
attrs[0] = LFSR_ATTR(pid, MKUNR, +rbyd->weight-pweight,
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight,
scratch_buf, d);
attr_count = 1;
} else {
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight, NULL, 0);
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd->weight-pweight, NULL, 0);
attrs[1] = LFSR_ATTR(pid+rbyd->weight-pweight, BTREE, 0,
scratch_buf, d);
attr_count = 2;
@@ -3599,11 +3596,11 @@ static int lfsr_btree_commit(lfs_t *lfs,
// note that since we defer merges to compaction time, we can
// end up removing an rbyd here
if (rbyd->weight == 0) {
attrs[0] = LFSR_ATTR(pid, MKUNR, +rbyd->weight-pweight,
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight,
scratch_buf, d);
attr_count = 1;
} else {
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight, NULL, 0);
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd->weight-pweight, NULL, 0);
attrs[1] = LFSR_ATTR(pid+rbyd->weight-pweight, BTREE, 0,
scratch_buf, d);
attr_count = 2;
@@ -3722,28 +3719,28 @@ static int lfsr_btree_commit(lfs_t *lfs,
}
// prepare commit to parent, tail recursing upwards
attrs[0] = LFSR_ATTR(0, MKBTREE, +rbyd_.weight,
attrs[0] = LFSR_ATTR(0, BTREE, +rbyd_.weight,
scratch_buf1, d1);
attrs[1] = (lfsr_tag_suptype(stag) == LFSR_TAG_NAME
? LFSR_ATTR_DATA(rbyd_.weight, MKBRANCH, +sibling.weight,
? LFSR_ATTR_DATA(rbyd_.weight, BRANCH, +sibling.weight,
sdata)
: LFSR_ATTR_NOOP);
attrs[2] = (lfsr_tag_suptype(stag) == LFSR_TAG_NAME
? LFSR_ATTR(0+rbyd_.weight+sibling.weight-1, BTREE, 0,
scratch_buf2, d2)
: LFSR_ATTR(0+rbyd_.weight, MKBTREE, +sibling.weight,
: LFSR_ATTR(0+rbyd_.weight, BTREE, +sibling.weight,
scratch_buf2, d2));
attr_count = 3;
// yes parent? push up split
} else {
// prepare commit to parent, tail recursing upwards
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd_.weight-pweight, NULL, 0);
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd_.weight-pweight, NULL, 0);
attrs[1] = LFSR_ATTR(pid-(pweight-1)+rbyd_.weight-1, BTREE, 0,
scratch_buf1, d1);
attrs[2] = (lfsr_tag_suptype(stag) == LFSR_TAG_NAME
? LFSR_ATTR_DATA(pid-(pweight-1)+rbyd_.weight,
MKBRANCH, +sibling.weight,
BRANCH, +sibling.weight,
sdata)
: LFSR_ATTR_NOOP);
attrs[3] = (lfsr_tag_suptype(stag) == LFSR_TAG_NAME
@@ -3751,7 +3748,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
BTREE, 0,
scratch_buf2, d2)
: LFSR_ATTR(pid-(pweight-1)+rbyd_.weight,
MKBTREE, +sibling.weight,
BTREE, +sibling.weight,
scratch_buf2, d2));
attr_count = 4;
}
@@ -3873,7 +3870,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
// append the attr
err = lfsr_rbyd_append(lfs, &rbyd_,
sdelta+id-lfs_smax32(w-1, 0), lfsr_tag_setmk(tag), +w,
sdelta+id-lfs_smax32(w-1, 0), tag, +w,
data);
if (err) {
return err;
@@ -3884,7 +3881,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
if (rbyd_.off > lfs->cfg->block_size/2) {
err = lfsr_rbyd_append(lfs, &rbyd_,
sdelta+(rbyd_.weight-rweight_)-1,
LFSR_TAG_MKUNR, -(rbyd_.weight-rweight_),
LFSR_TAG_UNR, -(rbyd_.weight-rweight_),
LFSR_DATA_NULL);
if (err) {
return err;
@@ -3955,8 +3952,8 @@ static int lfsr_btree_commit(lfs_t *lfs,
}
// prepare commit to parent, tail recursing upwards
attrs[0] = LFSR_ATTR(sid, MKUNR, -sweight, NULL, 0);
attrs[1] = LFSR_ATTR(pid, UNR, +rbyd_.weight-pweight, NULL, 0);
attrs[0] = LFSR_ATTR(sid, UNR, -sweight, NULL, 0);
attrs[1] = LFSR_ATTR(pid, GROW, +rbyd_.weight-pweight, NULL, 0);
attrs[2] = LFSR_ATTR(pid+rbyd_.weight-pweight, BTREE, 0,
scratch_buf, d);
attr_count = 3;
@@ -4002,12 +3999,9 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
// commit our entries
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
LFSR_ATTR_(
0, lfsr_tag_setmk(btree->inlined.tag),
+lfsr_btree_weight(btree),
LFSR_ATTR_(0, btree->inlined.tag, +lfsr_btree_weight(btree),
btree->inlined.buffer, btree->inlined.size),
LFSR_ATTR_DATA_(
bid, lfsr_tag_setmk(tag), +weight, data)));
LFSR_ATTR_DATA_(bid, tag, +weight, data)));
if (err) {
return err;
}
@@ -4047,7 +4041,7 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
// of the rest
int degenerate = lfsr_btree_commit(lfs, btree, bid_, 0, &rbyd,
LFSR_BTREE_ATTRS(
LFSR_ATTR_DATA_(rid, lfsr_tag_setmk(tag), +weight, data)));
LFSR_ATTR_DATA_(rid, tag, +weight, data)));
if (degenerate < 0) {
return degenerate;
}
@@ -4112,7 +4106,7 @@ static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
? LFSR_ATTR_(rid, lfsr_tag_setrm(rtag), 0, NULL, 0)
: LFSR_ATTR_NOOP),
LFSR_ATTR_DATA_(rid, tag, 0, data),
LFSR_ATTR(rid, UNR, +weight-rweight, NULL, 0)));
LFSR_ATTR(rid, GROW, +weight-rweight, NULL, 0)));
if (degenerate < 0) {
return degenerate;
}
@@ -4166,7 +4160,7 @@ static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) {
// revert to an inlined btree
int degenerate = lfsr_btree_commit(lfs, btree, bid, 2, &rbyd,
LFSR_BTREE_ATTRS(
LFSR_ATTR(rid, MKUNR, -rweight, NULL, 0)));
LFSR_ATTR(rid, UNR, -rweight, NULL, 0)));
if (degenerate < 0) {
return degenerate;
}
@@ -4245,15 +4239,13 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
// commit our entries
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
LFSR_ATTR_DATA_(0, lfsr_tag_setmk(tag1), +weight1, data1),
LFSR_ATTR_DATA_(0, tag1, +weight1, data1),
(lfsr_data_size(name) > 0
? LFSR_ATTR_DATA(weight1, MKBRANCH, +weight2, name)
? LFSR_ATTR_DATA(weight1, BRANCH, +weight2, name)
: LFSR_ATTR_NOOP),
(lfsr_data_size(name) > 0
? LFSR_ATTR_DATA_(weight1+weight2-1,
tag2, 0, data2)
: LFSR_ATTR_DATA_(weight1,
lfsr_tag_setmk(tag2), +weight2, data2))));
? LFSR_ATTR_DATA_(weight1+weight2-1, tag2, 0, data2)
: LFSR_ATTR_DATA_(weight1, tag2, +weight2, data2))));
if (err) {
return err;
}
@@ -4277,18 +4269,18 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
// of the rest
int degenerate = lfsr_btree_commit(lfs, btree, bid, -1, &rbyd,
LFSR_BTREE_ATTRS(
LFSR_ATTR(rid, UNR, +weight1-rweight, NULL, 0),
LFSR_ATTR(rid, GROW, +weight1-rweight, NULL, 0),
LFSR_ATTR_DATA_(rid-(rweight-1)+weight1-1, tag1, 0, data1),
(lfsr_data_size(name) > 0
? LFSR_ATTR_DATA(
rid-(rweight-1)+weight1, MKBRANCH, +weight2,
rid-(rweight-1)+weight1, BRANCH, +weight2,
name)
: LFSR_ATTR_NOOP),
(lfsr_data_size(name) > 0
? LFSR_ATTR_DATA_(rid-(rweight-1)+weight1+weight2-1,
tag2, 0, data2)
: LFSR_ATTR_DATA_(rid-(rweight-1)+weight1,
lfsr_tag_setmk(tag2), +weight2, data2))));
tag2, +weight2, data2))));
if (degenerate < 0) {
return degenerate;
}
+85 -85
View File
@@ -101,7 +101,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -167,11 +167,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -241,7 +241,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -259,7 +259,7 @@ code = '''
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
@@ -344,7 +344,7 @@ code = '''
}
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
@@ -447,7 +447,7 @@ code = '''
// add to rbyd, potentially splitting the mdir
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
// make sure we can look up the new entry
uint8_t buffer[4];
@@ -536,7 +536,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -553,7 +553,7 @@ code = '''
assert(mdir.rbyd.weight == 1);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -602,7 +602,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -622,7 +622,7 @@ code = '''
mdir.rbyd.off = BLOCK_SIZE;
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -671,14 +671,14 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
// remove the entry as we compact, forcing the mdir to be dropped
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -723,11 +723,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -735,7 +735,7 @@ code = '''
// remove the left entry as we compact, forcing the left
// mdir to be dropped
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 1);
@@ -787,11 +787,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -799,7 +799,7 @@ code = '''
// remove the right entry as we compact, forcing the right mdir
// to be dropped
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(1, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 1);
@@ -851,19 +851,19 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
// remove both entries as we compact, forcing both mdirs to be dropped
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0),
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0),
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -902,7 +902,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -920,7 +920,7 @@ code = '''
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
@@ -928,7 +928,7 @@ code = '''
// remove the left entry as we compact, forcing the left
// mdir to be dropped
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){0}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 1);
@@ -993,7 +993,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1011,7 +1011,7 @@ code = '''
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
@@ -1019,7 +1019,7 @@ code = '''
// remove the right entry as we compact, forcing the right
// mdir to be dropped
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(1, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 1);
@@ -1084,7 +1084,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1102,15 +1102,15 @@ code = '''
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
// remove both entries as we compact, forcing both mdirs to be dropped
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0),
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0),
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -1161,7 +1161,7 @@ code = '''
lfs_ssize_t rid = 0;
for (lfs_size_t i = 0; i < N; i++) {
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
@@ -1187,7 +1187,7 @@ code = '''
}
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){0}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
}
// try looking up each entry
@@ -1257,7 +1257,7 @@ code = '''
lfs_ssize_t rid = 0;
for (lfs_size_t i = 0; i < N; i++) {
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
@@ -1302,7 +1302,7 @@ code = '''
}
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){0}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
}
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -1372,7 +1372,7 @@ code = '''
if (op == 0) {
// add to rbyd, potentially splitting the mdir
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1,
LFSR_ATTR(rid, INLINED, +1,
&alphas[i % 26], 1))) => 0;
// make sure we can look up the new entry
@@ -1386,7 +1386,7 @@ code = '''
// delete
} else {
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(rid, UNR, -1, NULL, 0))) => 0;
count -= 1;
}
@@ -1481,7 +1481,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1568,11 +1568,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1659,11 +1659,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1872,7 +1872,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1974,7 +1974,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -1997,7 +1997,7 @@ code = '''
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
@@ -2084,7 +2084,7 @@ code = '''
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -2106,7 +2106,7 @@ code = '''
assert(mdir.rbyd.weight == 1);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){0}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert mdir was dropped
assert(lfsr_mtree_weight(&lfs) == 0);
@@ -2169,7 +2169,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact, this should trigger a relocation
lfsr_mdir_t old_mroot = lfs.mroot;
@@ -2249,11 +2249,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact, this should trigger a relocation
lfsr_mdir_t old_mroot = lfs.mroot;
@@ -2365,7 +2365,7 @@ code = '''
if (op == 0) {
// add to rbyd
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1,
LFSR_ATTR(rid, INLINED, +1,
&alphas[i % 26], 1))) => 0;
// make sure we can look up the new entry
@@ -2392,7 +2392,7 @@ code = '''
// delete
} else {
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(rid, UNR, -1, NULL, 0))) => 0;
count -= 1;
}
@@ -2475,8 +2475,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2487,7 +2487,7 @@ code = '''
// insert a new entry, this should update our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, &alphas[2 % 26], 1))) => 0;
LFSR_ATTR(1, INLINED, +1, &alphas[2 % 26], 1))) => 0;
// assert that our entry is still in the mtree
assert(lfs.mroot.rbyd.weight == 3);
@@ -2520,8 +2520,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2532,7 +2532,7 @@ code = '''
// try removing our left entry
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0;
// assert that an entry was removed
assert(lfs.mroot.rbyd.weight == 1);
@@ -2559,8 +2559,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2571,7 +2571,7 @@ code = '''
// try removing our left entry
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKUNR, -1, NULL, 0))) => 0;
LFSR_ATTR(1, UNR, -1, NULL, 0))) => 0;
// assert that an entry was removed
assert(lfs.mroot.rbyd.weight == 1);
@@ -2600,8 +2600,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2619,7 +2619,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[3 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -2669,8 +2669,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2683,11 +2683,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[2 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[3 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(2, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(2, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -2738,8 +2738,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2756,7 +2756,7 @@ code = '''
memset(buffer, alphas[3 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -2774,7 +2774,7 @@ code = '''
memset(buffer, alphas[4 % 26], SIZE);
lfsr_mdir_commit(&lfs, &mdir, &(lfs_ssize_t){2}, LFSR_ATTRS(
LFSR_ATTR(2, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(2, INLINED, +1, buffer, SIZE))) => 0;
// force mdir to compact
mdir.rbyd.off = BLOCK_SIZE;
@@ -2831,8 +2831,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2892,8 +2892,8 @@ code = '''
// setup our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, MKINLINED, +1, &alphas[1 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1),
LFSR_ATTR(1, INLINED, +1, &alphas[1 % 26], 1))) => 0;
// this test only works if these all fit in the mroot
assert(lfsr_mtree_isinlined(&lfs));
@@ -2911,7 +2911,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[3 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -2980,7 +2980,7 @@ code = '''
// insert a new entry, this should update our neighbors
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, &alphas[0 % 26], 1))) => 0;
LFSR_ATTR(0, INLINED, +1, &alphas[0 % 26], 1))) => 0;
// assert that our entry is still in the mtree
assert(lfs.mroot.rbyd.weight == 1);
@@ -3083,7 +3083,7 @@ code = '''
// create a large entry that needs to be uninlined (but not split!)
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -3207,11 +3207,11 @@ code = '''
uint8_t buffer[SIZE];
memset(buffer, alphas[0 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(0, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0;
memset(buffer, alphas[1 % 26], SIZE);
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
LFSR_ATTR(1, MKINLINED, +1, buffer, SIZE))) => 0;
LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0;
// force mroot to compact
lfs.mroot.rbyd.off = BLOCK_SIZE;
@@ -3457,7 +3457,7 @@ code = '''
}
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
@@ -3617,7 +3617,7 @@ code = '''
// add to rbyd, potentially splitting the mdir
lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
LFSR_ATTR(rid, MKINLINED, +1, &alphas[i % 26], 1))) => 0;
LFSR_ATTR(rid, INLINED, +1, &alphas[i % 26], 1))) => 0;
// make sure we can look up the new entry
uint8_t buffer[4];
+243 -239
View File
File diff suppressed because it is too large Load Diff