btree: Resurrected btree leaf caching
This is an indulgence to simplify the upcoming auxiliary btree work.
Brings back the previously-reverted per-btree leaf caches, where each
lfs3_btree_t keeps track of two rbyds: The root and the most recently
accessed leaf.
At the surface level, this optimizes repeated access to the same btree
leaf. A common pattern for a number of littlefs's operations that has
proven tricky to manually optimize:
- Btree iteration
- Pokes for our crystalization heuristic
- Checksum collision resolution for dids and (FUTURE) ddkeys
- Related rattrs attached to a single bid
But the real motivation is to drop lfs3_btree_*lookupleaf and simplify
the internal APIs. If repeated lfs3_btree_lookup*s are already
efficient, there's no reason for extra leaf-level APIs, and in theory
any logic that interacts with btrees will be simpler.
---
This comes at a cost (humorously about the same amount as the
tag-returning refactor, if you ignore the extra 28 bytes of ctx).
Unsurprisingly, increasing the size of lfs3_btree_t has the biggest
impact on stack and ctx:
code stack ctx
before: 36084 2336 656
after: 36784 (+1.9%) 2400 (+2.7%) 684 (+4.3%)
Also note from the previous commit messages: Btree leaf caching has
resulted in surprisingly little performance improvement for our current
benchmarks + implementation. It turns out if you're dominated by write
cost, optimizing btree lookups -- which already skip rbyd fetches, has
barely noticeable impact.
---
A note on reverting!
Eventually (after the auxiliary btree work) it will probably make sense
to revert this -- or at least provide a non-leaf-caching build for
code/RAM sensitive users.
I don't think this should be reverted as-is. Instead, I think we should
allow the option to just disable the leaf cache, while keeping the
simpler internal API. This would give us the best of all three worlds:
- A small code/RAM option
- Optimal btree iteration/nearby-lookup performance
- Simpler internal APIs
The only reason this isn't already implemented is because I want to
avoid fragmenting the codebase further while we're still in development
mode.
This commit is contained in:
@@ -681,8 +681,19 @@ typedef struct lfs3_rbyd {
|
||||
uint32_t cksum;
|
||||
} lfs3_rbyd_t;
|
||||
|
||||
// a btree is represented by the root rbyd
|
||||
typedef lfs3_rbyd_t lfs3_btree_t;
|
||||
// littlefs's btree representation
|
||||
//
|
||||
// technically all we need for btrees is the root rbyd, but tracking the
|
||||
// most recent leaf helps speed up iteration/subattrs/etc without
|
||||
// local rbyd allocations -- less code and stack for the same
|
||||
// performance
|
||||
typedef struct lfs3_btree {
|
||||
lfs3_rbyd_t r;
|
||||
struct {
|
||||
lfs3_bid_t bid;
|
||||
lfs3_rbyd_t rbyd;
|
||||
} leaf;
|
||||
} lfs3_btree_t;
|
||||
|
||||
// littlefs's atomic metadata log type
|
||||
typedef struct lfs3_mdir {
|
||||
@@ -712,7 +723,7 @@ typedef struct lfs3_bshrub {
|
||||
// trunk=0 => no bshrub/btree
|
||||
// sign(trunk)=1 => bshrub
|
||||
// sign(trunk)=0 => btree
|
||||
lfs3_shrub_t shrub;
|
||||
lfs3_btree_t shrub;
|
||||
#ifndef LFS3_RDONLY
|
||||
lfs3_shrub_t shrub_;
|
||||
#endif
|
||||
|
||||
+12
-12
@@ -98,10 +98,10 @@ code = '''
|
||||
}
|
||||
printf("]\n");
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
btree.weight,
|
||||
btree.blocks[0],
|
||||
btree.trunk);
|
||||
assert(btree.weight == sim_size);
|
||||
btree.r.weight,
|
||||
btree.r.blocks[0],
|
||||
btree.r.trunk);
|
||||
assert(btree.r.weight == sim_size);
|
||||
|
||||
uint8_t buffer[4];
|
||||
lfs3_bid_t bid_;
|
||||
@@ -2053,10 +2053,10 @@ code = '''
|
||||
}
|
||||
printf("]\n");
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
btree.weight,
|
||||
btree.blocks[0],
|
||||
btree.trunk);
|
||||
assert(btree.weight == sim_size);
|
||||
btree.r.weight,
|
||||
btree.r.blocks[0],
|
||||
btree.r.trunk);
|
||||
assert(btree.r.weight == sim_size);
|
||||
|
||||
uint8_t buffer[4];
|
||||
lfs3_bid_t bid_;
|
||||
@@ -4010,10 +4010,10 @@ code = '''
|
||||
}
|
||||
printf("]\n");
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
btree.weight,
|
||||
btree.blocks[0],
|
||||
btree.trunk);
|
||||
assert(btree.weight == sim_size);
|
||||
btree.r.weight,
|
||||
btree.r.blocks[0],
|
||||
btree.r.trunk);
|
||||
assert(btree.r.weight == sim_size);
|
||||
|
||||
uint8_t buffer[4];
|
||||
lfs3_bid_t bid_;
|
||||
|
||||
+312
-336
File diff suppressed because it is too large
Load Diff
@@ -1227,10 +1227,10 @@ code = '''
|
||||
|
||||
// create an empty btree
|
||||
lfs3_alloc_ckpoint(&lfs3);
|
||||
lfs3_rbyd_alloc(&lfs3, &file.b.shrub) => 0;
|
||||
lfs3_rbyd_commit(&lfs3, &file.b.shrub, 0, LFS3_RATTRS(
|
||||
lfs3_rbyd_alloc(&lfs3, &file.b.shrub.r) => 0;
|
||||
lfs3_rbyd_commit(&lfs3, &file.b.shrub.r, 0, LFS3_RATTRS(
|
||||
LFS3_RATTR_BUF(LFS3_TAG_DATA, +1, "?", 1))) => 0;
|
||||
lfs3_rbyd_commit(&lfs3, &file.b.shrub, 0, LFS3_RATTRS(
|
||||
lfs3_rbyd_commit(&lfs3, &file.b.shrub.r, 0, LFS3_RATTRS(
|
||||
LFS3_RATTR(LFS3_TAG_RM, -1))) => 0;
|
||||
lfs3_mdir_commit(&lfs3, &file.b.h.mdir, LFS3_RATTRS(
|
||||
LFS3_RATTR_BTREE(
|
||||
|
||||
+61
-61
@@ -205,7 +205,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(3), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -232,7 +232,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -296,7 +296,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -325,7 +325,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -391,7 +391,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -411,7 +411,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(2), 0, "e", 1))) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -452,7 +452,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -728,7 +728,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -741,7 +741,7 @@ code = '''
|
||||
assert(mdir.r.weight == 0);
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -763,7 +763,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -822,7 +822,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -837,7 +837,7 @@ code = '''
|
||||
assert(mdir.r.weight == 0);
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -859,7 +859,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -924,7 +924,7 @@ code = '''
|
||||
assert(mdir.r.weight == 2);
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -941,7 +941,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -995,7 +995,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1020,7 +1020,7 @@ code = '''
|
||||
assert(mdir.r.weight == 1);
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1049,7 +1049,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1115,7 +1115,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1140,7 +1140,7 @@ code = '''
|
||||
assert(mdir.r.weight == 1);
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1169,7 +1169,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert split/drop worked out
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1366,7 +1366,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(3), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1383,7 +1383,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mdir, &mdir) != 0);
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1422,7 +1422,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1500,7 +1500,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1519,7 +1519,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mdir, &mdir) != 0);
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1560,7 +1560,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1640,7 +1640,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1659,7 +1659,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mdir, &mdir) != 0);
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -1700,7 +1700,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2112,7 +2112,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2136,7 +2136,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mroot, &lfs3.mroot) != 0);
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2177,7 +2177,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2257,7 +2257,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2288,7 +2288,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mroot, &lfs3.mroot) != 0);
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2334,7 +2334,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2419,7 +2419,7 @@ code = '''
|
||||
LFS3_RATTR_BUF(LFS3_TAG_ATTR(1), 0, "c", 1))) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2443,7 +2443,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mroot, &lfs3.mroot) != 0);
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2465,7 +2465,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2526,7 +2526,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mroot, &lfs3.mroot) != 0);
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2553,7 +2553,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2627,7 +2627,7 @@ code = '''
|
||||
assert(lfs3_mdir_cmp(&old_mroot, &lfs3.mroot) != 0);
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -2656,7 +2656,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3065,7 +3065,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3156,7 +3156,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &mdir, NULL, 0) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3291,7 +3291,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3388,7 +3388,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3497,7 +3497,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &mdir, NULL, 0) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3516,7 +3516,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &mdir, NULL, 0) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (4 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (4 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3607,7 +3607,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &mdir, NULL, 0) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3617,7 +3617,7 @@ code = '''
|
||||
assert(mdir.r.weight == 0);
|
||||
|
||||
// assert mdir was dropped correctly
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3779,7 +3779,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3846,7 +3846,7 @@ code = '''
|
||||
// and the tree should still work
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3868,7 +3868,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined
|
||||
assert(lfs3.mtree.weight == (1 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (1 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3927,7 +3927,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -3994,7 +3994,7 @@ code = '''
|
||||
// and the tree should still work
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -4018,7 +4018,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -4079,7 +4079,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &lfs3.mroot, NULL, 0) => 0;
|
||||
|
||||
// assert mdirs were unininlined and split
|
||||
assert(lfs3.mtree.weight == (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (2 << lfs3.mbits));
|
||||
// assert mroot now has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -4098,7 +4098,7 @@ code = '''
|
||||
lfs3_mdir_commit(&lfs3, &mdir, NULL, 0) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -4165,7 +4165,7 @@ code = '''
|
||||
// and the tree should still work
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
@@ -4196,7 +4196,7 @@ code = '''
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR | M_FLAGS, CFG) => 0;
|
||||
|
||||
// assert mdir was split correctly
|
||||
assert(lfs3.mtree.weight == (3 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight == (3 << lfs3.mbits));
|
||||
// assert mroot still has no entries
|
||||
assert(lfs3.mroot.r.weight == 0);
|
||||
|
||||
|
||||
+45
-45
@@ -3446,7 +3446,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "uloborus%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -3566,7 +3566,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "uloborus%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -3694,7 +3694,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "uloborus%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4222,7 +4222,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4232,8 +4232,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4258,8 +4258,8 @@ code = '''
|
||||
|
||||
// create enough files for mdir to split again
|
||||
i = 0;
|
||||
orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "vulsor%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4398,7 +4398,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4408,8 +4408,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4458,8 +4458,8 @@ code = '''
|
||||
|
||||
// create enough files for mdir to split again
|
||||
i = 0;
|
||||
orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "vulsor%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4581,7 +4581,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4591,8 +4591,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4646,8 +4646,8 @@ code = '''
|
||||
|
||||
// create enough files for mdir to split again
|
||||
i = 0;
|
||||
orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "vulsor%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4758,7 +4758,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4768,8 +4768,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4932,7 +4932,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -4942,8 +4942,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -5124,7 +5124,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -5134,8 +5134,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -5304,7 +5304,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "tarantula%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -5314,8 +5314,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "xnotata%03x", i);
|
||||
lfs3_file_open(&lfs3, &file, name,
|
||||
@@ -5841,7 +5841,7 @@ code = '''
|
||||
lfs3_size_t i = 0;
|
||||
while (true) {
|
||||
// we should not have split yet
|
||||
assert(lfs3.mtree.weight == 0);
|
||||
assert(lfs3.mtree.r.weight == 0);
|
||||
// we need internals to check this
|
||||
lfs3_ssize_t estimate = lfs3_mdir_estimate__(&lfs3,
|
||||
&file1.b.h.mdir, -1, -1,
|
||||
@@ -6011,7 +6011,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "hydroid%03x", i);
|
||||
lfs3_file_t file;
|
||||
@@ -6022,8 +6022,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "medusa%03x", i);
|
||||
lfs3_file_t file;
|
||||
@@ -6246,7 +6246,7 @@ code = '''
|
||||
|
||||
// create enough files for mroot to split twice
|
||||
lfs3_size_t i = 0;
|
||||
while (lfs3.mtree.weight == 0) {
|
||||
while (lfs3.mtree.r.weight == 0) {
|
||||
char name[256];
|
||||
sprintf(name, "hydroid%03x", i);
|
||||
lfs3_file_t file;
|
||||
@@ -6257,8 +6257,8 @@ code = '''
|
||||
}
|
||||
|
||||
i = 0;
|
||||
lfs3_size_t orig = lfs3.mtree.weight;
|
||||
while (lfs3.mtree.weight == orig) {
|
||||
lfs3_size_t orig = lfs3.mtree.r.weight;
|
||||
while (lfs3.mtree.r.weight == orig) {
|
||||
char name[256];
|
||||
sprintf(name, "polyp%03x", i);
|
||||
lfs3_file_t file;
|
||||
@@ -6270,10 +6270,10 @@ code = '''
|
||||
|
||||
// create enough files to both compact and split
|
||||
i = 0;
|
||||
orig = lfs3.mtree.weight;
|
||||
orig = lfs3.mtree.r.weight;
|
||||
while (true) {
|
||||
// we should not have split yet
|
||||
assert(lfs3.mtree.weight == orig);
|
||||
assert(lfs3.mtree.r.weight == orig);
|
||||
// we need internals to check this
|
||||
lfs3_ssize_t estimate = lfs3_mdir_estimate__(&lfs3,
|
||||
&file2.b.h.mdir, -1, -1,
|
||||
@@ -6535,7 +6535,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
@@ -6844,7 +6844,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
@@ -7008,7 +7008,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
@@ -7181,7 +7181,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
@@ -7354,7 +7354,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
@@ -7523,7 +7523,7 @@ code = '''
|
||||
assert(!(lfs3.flags & LFS3_I_MKCONSISTENT));
|
||||
|
||||
// which means there shouldn't be that many files left
|
||||
assert(lfs3.mtree.weight <= (2 << lfs3.mbits));
|
||||
assert(lfs3.mtree.r.weight <= (2 << lfs3.mbits));
|
||||
assert(file1.b.h.mdir.r.weight <= 3);
|
||||
assert(file2.b.h.mdir.r.weight <= 3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user