Renamed LFS3_T_COMPACTMETA -> LFS3_T_COMPACT (and gc_compact_thresh)
This effectively reverts 1f824a0:
- LFS3_T_COMPACTMETA -> LFS3_T_COMPACT
- gc_compactmeta_thresh -> gc_compact_thresh
And friends.
After using LFS3_T_COMPACTMETA for a bit, I think it just adds noise
without much value. Especially when next to LFS3_T_LOOKAHEAD,
LFS3_GC_PREERASE, LFS3_M_SYNC, etc.
It's interesting that we already have some very distinct verbs for this
sort of thing based on data type (compact => metadata, garbage-collect
=> disk, compress => data).
This commit is contained in:
@@ -7226,10 +7226,10 @@ static inline bool lfs3_t_islookahead(uint32_t flags) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool lfs3_t_compactmeta(uint32_t flags) {
|
||||
static inline bool lfs3_t_compact(uint32_t flags) {
|
||||
(void)flags;
|
||||
#ifndef LFS3_RDONLY
|
||||
return flags & LFS3_T_COMPACTMETA;
|
||||
return flags & LFS3_T_COMPACT;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -9516,7 +9516,7 @@ static int lfs3_mdir_commit_(lfs3_t *lfs3, lfs3_mdir_t *mdir,
|
||||
|
||||
// we may have touched any number of mdirs, so assume uncompacted
|
||||
// until lfs3_fs_gc can prove otherwise
|
||||
lfs3->flags |= LFS3_I_COMPACTMETA;
|
||||
lfs3->flags |= LFS3_I_COMPACT;
|
||||
|
||||
#ifdef LFS3_DBGMDIRCOMMITS
|
||||
LFS3_DEBUG("Committed mdir %"PRId32" "
|
||||
@@ -10385,12 +10385,12 @@ again:;
|
||||
}
|
||||
|
||||
// compacting mdirs?
|
||||
if (lfs3_t_compactmeta(mgc->t.h.flags)
|
||||
if (lfs3_t_compact(mgc->t.h.flags)
|
||||
&& tag == LFS3_TAG_MDIR
|
||||
// exceed compaction threshold?
|
||||
&& lfs3_rbyd_eoff(&((lfs3_mdir_t*)bptr_->d.u.buffer)->r)
|
||||
> ((lfs3->cfg->gc_compactmeta_thresh)
|
||||
? lfs3->cfg->gc_compactmeta_thresh
|
||||
> ((lfs3->cfg->gc_compact_thresh)
|
||||
? lfs3->cfg->gc_compact_thresh
|
||||
: lfs3->cfg->block_size - lfs3->cfg->block_size/8)) {
|
||||
lfs3_mdir_t *mdir = (lfs3_mdir_t*)bptr_->d.u.buffer;
|
||||
LFS3_INFO("Compacting mdir %"PRId32" 0x{%"PRIx32",%"PRIx32"} "
|
||||
@@ -10399,8 +10399,8 @@ again:;
|
||||
mdir->r.blocks[0],
|
||||
mdir->r.blocks[1],
|
||||
lfs3_rbyd_eoff(&mdir->r),
|
||||
(lfs3->cfg->gc_compactmeta_thresh)
|
||||
? lfs3->cfg->gc_compactmeta_thresh
|
||||
(lfs3->cfg->gc_compact_thresh)
|
||||
? lfs3->cfg->gc_compact_thresh
|
||||
: lfs3->cfg->block_size - lfs3->cfg->block_size/8);
|
||||
// compact the mdir
|
||||
uint32_t dirty = mgc->t.h.flags;
|
||||
@@ -10446,9 +10446,9 @@ eot:;
|
||||
|
||||
// was compaction successful? note we may need multiple passes if
|
||||
// we want to be sure everything is compacted
|
||||
if (lfs3_t_compactmeta(mgc->t.h.flags)
|
||||
if (lfs3_t_compact(mgc->t.h.flags)
|
||||
&& !lfs3_t_isckpointed(mgc->t.h.flags)) {
|
||||
lfs3->flags &= ~LFS3_I_COMPACTMETA;
|
||||
lfs3->flags &= ~LFS3_I_COMPACT;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14855,14 +14855,14 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
|
||||
// unknown gc flags?
|
||||
LFS3_ASSERT((lfs3->cfg->gc_flags & ~LFS3_GC_ALL) == 0);
|
||||
|
||||
// check that gc_compactmeta_thresh makes sense
|
||||
// check that gc_compact_thresh makes sense
|
||||
//
|
||||
// metadata can't be compacted below block_size/2, and metadata can't
|
||||
// exceed a block
|
||||
LFS3_ASSERT(lfs3->cfg->gc_compactmeta_thresh == 0
|
||||
|| lfs3->cfg->gc_compactmeta_thresh >= lfs3->cfg->block_size/2);
|
||||
LFS3_ASSERT(lfs3->cfg->gc_compactmeta_thresh == (lfs3_size_t)-1
|
||||
|| lfs3->cfg->gc_compactmeta_thresh <= lfs3->cfg->block_size);
|
||||
LFS3_ASSERT(lfs3->cfg->gc_compact_thresh == 0
|
||||
|| lfs3->cfg->gc_compact_thresh >= lfs3->cfg->block_size/2);
|
||||
LFS3_ASSERT(lfs3->cfg->gc_compact_thresh == (lfs3_size_t)-1
|
||||
|| lfs3->cfg->gc_compact_thresh <= lfs3->cfg->block_size);
|
||||
#endif
|
||||
|
||||
#ifndef LFS3_RDONLY
|
||||
@@ -14881,7 +14881,7 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_LOOKAHEAD)
|
||||
// default to assuming we need compaction somewhere, worst case
|
||||
// this just makes lfs3_fs_gc read more than is strictly needed
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
// default to needing a ckmeta/ckdata scan
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA;
|
||||
@@ -15709,8 +15709,8 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
#ifdef LFS3_YES_LOOKAHEAD
|
||||
flags |= LFS3_M_LOOKAHEAD;
|
||||
#endif
|
||||
#ifdef LFS3_YES_COMPACTMETA
|
||||
flags |= LFS3_M_COMPACTMETA;
|
||||
#ifdef LFS3_YES_COMPACT
|
||||
flags |= LFS3_M_COMPACT;
|
||||
#endif
|
||||
#ifdef LFS3_YES_CKMETA
|
||||
flags |= LFS3_M_CKMETA;
|
||||
@@ -15733,13 +15733,13 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_MKCONSISTENT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_LOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACTMETA)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
|
||||
| LFS3_M_CKMETA
|
||||
| LFS3_M_CKDATA)) == 0);
|
||||
// these flags require a writable filesystem
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_ismkconsistent(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_islookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_compactmeta(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_compact(flags));
|
||||
|
||||
int err = lfs3_init(lfs3,
|
||||
flags & (
|
||||
@@ -16007,8 +16007,8 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
|
||||
#ifdef LFS3_YES_LOOKAHEAD
|
||||
flags |= LFS3_F_LOOKAHEAD;
|
||||
#endif
|
||||
#ifdef LFS3_YES_COMPACTMETA
|
||||
flags |= LFS3_F_COMPACTMETA;
|
||||
#ifdef LFS3_YES_COMPACT
|
||||
flags |= LFS3_F_COMPACT;
|
||||
#endif
|
||||
#ifdef LFS3_YES_CKMETA
|
||||
flags |= LFS3_F_CKMETA;
|
||||
@@ -16029,7 +16029,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, 0)
|
||||
| LFS3_F_MKCONSISTENT
|
||||
| LFS3_F_LOOKAHEAD
|
||||
| LFS3_F_COMPACTMETA
|
||||
| LFS3_F_COMPACT
|
||||
| LFS3_F_CKMETA
|
||||
| LFS3_F_CKDATA)) == 0);
|
||||
|
||||
@@ -16101,7 +16101,7 @@ int lfs3_fs_stat(lfs3_t *lfs3, struct lfs3_fsinfo *fsinfo) {
|
||||
| LFS3_IFDEF_CKDATACKSUMS(LFS3_I_CKDATACKSUMS, 0)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_MKCONSISTENT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_LOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, 0));
|
||||
@@ -16422,7 +16422,7 @@ int lfs3_fs_ck(lfs3_t *lfs3, uint32_t flags) {
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags)
|
||||
|| !lfs3_t_islookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags)
|
||||
|| !lfs3_t_compactmeta(flags));
|
||||
|| !lfs3_t_compact(flags));
|
||||
|
||||
// set needs-ck flags, this has the side-effect of signaling ck work
|
||||
// is incomplete if we encounter an error, which is probably a good
|
||||
@@ -16446,7 +16446,7 @@ int lfs3_fs_gc(lfs3_t *lfs3) {
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags)
|
||||
|| !lfs3_t_islookahead(lfs3->cfg->gc_flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags)
|
||||
|| !lfs3_t_compactmeta(lfs3->cfg->gc_flags));
|
||||
|| !lfs3_t_compact(lfs3->cfg->gc_flags));
|
||||
|
||||
// run gc a configurable number of steps
|
||||
return lfs3_fs_gc_(lfs3, &lfs3->gc,
|
||||
@@ -16696,7 +16696,7 @@ int lfs3_trv_open(lfs3_t *lfs3, lfs3_trv_t *trv, uint32_t flags) {
|
||||
| LFS3_T_EXCL
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_MKCONSISTENT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_LOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACTMETA)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACT)
|
||||
| LFS3_T_CKMETA
|
||||
| LFS3_T_CKDATA)) == 0);
|
||||
// writeable traversals require a writeable filesystem
|
||||
@@ -16704,7 +16704,7 @@ int lfs3_trv_open(lfs3_t *lfs3, lfs3_trv_t *trv, uint32_t flags) {
|
||||
// these flags require a writable traversal
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_ismkconsistent(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_islookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_compactmeta(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_compact(flags));
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_islookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_isckdata(flags));
|
||||
|
||||
@@ -209,8 +209,7 @@ enum lfs3_type {
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_F_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#define LFS3_F_COMPACT 0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_F_CKMETA 0x00010000 // Check metadata checksums
|
||||
@@ -257,8 +256,7 @@ enum lfs3_type {
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_M_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#define LFS3_M_COMPACT 0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_M_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_M_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
@@ -300,8 +298,7 @@ enum lfs3_type {
|
||||
0x00001000 // Lookahead/gbmap is not full
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_I_COMPACTMETA \
|
||||
0x00008000 // Filesystem may have uncompacted metadata
|
||||
#define LFS3_I_COMPACT 0x00008000 // Filesystem may have uncompacted metadata
|
||||
#endif
|
||||
#define LFS3_I_CKMETA 0x00010000 // Metadata checksums not checked recently
|
||||
#define LFS3_I_CKDATA 0x00020000 // Data checksums not checked recently
|
||||
@@ -331,8 +328,7 @@ enum lfs3_btype {
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_T_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#define LFS3_T_COMPACT 0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_T_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_T_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
@@ -356,8 +352,7 @@ enum lfs3_btype {
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_CK_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#define LFS3_CK_COMPACT 0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_CK_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_CK_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
@@ -372,8 +367,7 @@ enum lfs3_btype {
|
||||
0x00001000 // Repopulate lookahead/gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_GC_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#define LFS3_GC_COMPACT 0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_GC_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_GC_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
@@ -382,7 +376,7 @@ enum lfs3_btype {
|
||||
#define LFS3_GC_ALL ( \
|
||||
LFS3_IFDEF_RDONLY(0, LFS3_GC_MKCONSISTENT) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_GC_LOOKAHEAD) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_GC_COMPACTMETA) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_GC_COMPACT) \
|
||||
| LFS3_GC_CKMETA \
|
||||
| LFS3_GC_CKDATA)
|
||||
|
||||
@@ -544,7 +538,7 @@ struct lfs3_cfg {
|
||||
//
|
||||
// Set to -1 to disable metadata compaction during gc.
|
||||
#ifndef LFS3_RDONLY
|
||||
lfs3_size_t gc_compactmeta_thresh;
|
||||
lfs3_size_t gc_compact_thresh;
|
||||
#endif
|
||||
|
||||
// Optional statically allocated rcache buffer. Must be rcache_size. By
|
||||
|
||||
@@ -118,7 +118,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||
BENCH_DEFINE(GC_LOOKAHEAD_THRESH, -1 ) \
|
||||
BENCH_DEFINE(GC_LOOKGBMAP_THRESH, -1 ) \
|
||||
BENCH_DEFINE(GC_COMPACTMETA_THRESH, 0 ) \
|
||||
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||
BENCH_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
|
||||
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
@@ -150,7 +150,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
BENCH_GBMAP_CFG \
|
||||
BENCH_GC_CFG \
|
||||
.gc_lookahead_thresh = GC_LOOKAHEAD_THRESH, \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
@@ -109,7 +109,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
TEST_DEFINE(GC_STEPS, 0 ) \
|
||||
TEST_DEFINE(GC_LOOKAHEAD_THRESH, -1 ) \
|
||||
TEST_DEFINE(GC_LOOKGBMAP_THRESH, -1 ) \
|
||||
TEST_DEFINE(GC_COMPACTMETA_THRESH, 0 ) \
|
||||
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||
TEST_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
|
||||
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
|
||||
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
|
||||
@@ -141,7 +141,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
TEST_GBMAP_CFG \
|
||||
TEST_GC_CFG \
|
||||
.gc_lookahead_thresh = GC_LOOKAHEAD_THRESH, \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
+6
-6
@@ -83,7 +83,7 @@ F_CKDATACKSUMS = 0x01000000 # y- Check data checksums on reads
|
||||
|
||||
F_MKCONSISTENT = 0x00000800 # y- Make the filesystem consistent
|
||||
F_LOOKAHEAD = 0x00001000 # y- Repopulate lookahead buffer
|
||||
F_COMPACTMETA = 0x00008000 # y- Compact metadata logs
|
||||
F_COMPACT = 0x00008000 # y- Compact metadata logs
|
||||
F_CKMETA = 0x00010000 # y- Check metadata checksums
|
||||
F_CKDATA = 0x00020000 # y- Check metadata + data checksums
|
||||
|
||||
@@ -102,21 +102,21 @@ M_CKDATACKSUMS = 0x01000000 # y- Check data checksums on reads
|
||||
|
||||
M_MKCONSISTENT = 0x00000800 # y- Make the filesystem consistent
|
||||
M_LOOKAHEAD = 0x00001000 # y- Repopulate lookahead buffer
|
||||
M_COMPACTMETA = 0x00008000 # y- Compact metadata logs
|
||||
M_COMPACT = 0x00008000 # y- Compact metadata logs
|
||||
M_CKMETA = 0x00010000 # y- Check metadata checksums
|
||||
M_CKDATA = 0x00020000 # y- Check metadata + data checksums
|
||||
|
||||
# File/filesystem check flags
|
||||
CK_MKCONSISTENT = 0x00000800 # -- Make the filesystem consistent
|
||||
CK_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer
|
||||
CK_COMPACTMETA = 0x00008000 # -- Compact metadata logs
|
||||
CK_COMPACT = 0x00008000 # -- Compact metadata logs
|
||||
CK_CKMETA = 0x00010000 # -- Check metadata checksums
|
||||
CK_CKDATA = 0x00020000 # -- Check metadata + data checksums
|
||||
|
||||
# GC flags
|
||||
GC_MKCONSISTENT = 0x00000800 # -- Make the filesystem consistent
|
||||
GC_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer
|
||||
GC_COMPACTMETA = 0x00008000 # -- Compact metadata logs
|
||||
GC_COMPACT = 0x00008000 # -- Compact metadata logs
|
||||
GC_CKMETA = 0x00010000 # -- Check metadata checksums
|
||||
GC_CKDATA = 0x00020000 # -- Check metadata + data checksums
|
||||
|
||||
@@ -135,7 +135,7 @@ I_CKDATACKSUMS = 0x01000000 # -- Mounted with LFS3_M_CKDATACKSUMS
|
||||
|
||||
I_MKCONSISTENT = 0x00000800 # -- Filesystem needs mkconsistent to write
|
||||
I_LOOKAHEAD = 0x00001000 # -- Lookahead buffer is not full
|
||||
I_COMPACTMETA = 0x00008000 # -- Filesystem may have uncompacted metadata
|
||||
I_COMPACT = 0x00008000 # -- Filesystem may have uncompacted metadata
|
||||
I_CKMETA = 0x00010000 # -- Metadata checksums not checked recently
|
||||
I_CKDATA = 0x00020000 # -- Data checksums not checked recently
|
||||
|
||||
@@ -147,7 +147,7 @@ T_MTREEONLY = 0x00000002 # -- Only traverse the mtree
|
||||
T_EXCL = 0x00000008 # -- Error if filesystem modified
|
||||
T_MKCONSISTENT = 0x00000800 # -- Make the filesystem consistent
|
||||
T_LOOKAHEAD = 0x00001000 # -- Repopulate lookahead buffer
|
||||
T_COMPACTMETA = 0x00008000 # -- Compact metadata logs
|
||||
T_COMPACT = 0x00008000 # -- Compact metadata logs
|
||||
T_CKMETA = 0x00010000 # -- Check metadata checksums
|
||||
T_CKDATA = 0x00020000 # -- Check metadata + data checksums
|
||||
|
||||
|
||||
+15
-15
@@ -910,11 +910,11 @@ code = '''
|
||||
defines.FILETYPE = [0, 1, 2, 3]
|
||||
defines.M = 40
|
||||
defines.SIZE = 4
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@@ -958,7 +958,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACTMETA) {
|
||||
if (COMPACT) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
@@ -1004,11 +1004,11 @@ defines.FILETYPE = [0, 1, 2]
|
||||
defines.N = 64
|
||||
defines.M = 4
|
||||
defines.SIZE = 4
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@@ -1055,7 +1055,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACTMETA) {
|
||||
if (COMPACT) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
@@ -5041,11 +5041,11 @@ code = '''
|
||||
defines.N = 64
|
||||
defines.M = 4
|
||||
defines.SIZE = 4
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@@ -5083,7 +5083,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACTMETA) {
|
||||
if (COMPACT) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+86
-86
@@ -538,20 +538,20 @@ code = '''
|
||||
'''
|
||||
|
||||
|
||||
# test that compactmeta can make progress in isolation
|
||||
[cases.test_gc_compactmeta_progress]
|
||||
# test that compact can make progress in isolation
|
||||
[cases.test_gc_compact_progress]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_COMPACTMETA
|
||||
LFS3_GC_COMPACT
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FCACHE_SIZE/2',
|
||||
'2*FCACHE_SIZE',
|
||||
@@ -571,14 +571,14 @@ code = '''
|
||||
|
||||
uint32_t prng = 42;
|
||||
|
||||
// write to our mdir until >gc_compactmeta_thresh full
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
lfs3_file_t file;
|
||||
lfs3_file_open(&lfs3, &file, "jellyfish",
|
||||
LFS3_O_RDWR | LFS3_O_CREAT | LFS3_O_EXCL) => 0;
|
||||
|
||||
// hack, don't use the internals like this
|
||||
uint8_t wbuf[SIZE];
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@@ -590,7 +590,7 @@ code = '''
|
||||
// expect dirty initial state or else our test doesn't work
|
||||
struct lfs3_fsinfo fsinfo;
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACT);
|
||||
assert(lfs3.handles != &lfs3.gc.t.h);
|
||||
|
||||
// run GC until we make progress
|
||||
@@ -601,13 +601,13 @@ code = '''
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
if (!(fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
if (!(fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// mdir should have been compacted
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH);
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH);
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -629,19 +629,19 @@ code = '''
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
'''
|
||||
|
||||
# test that compactmeta dirtying still works with the GC API
|
||||
[cases.test_gc_compactmeta_mutation]
|
||||
# test that compact dirtying still works with the GC API
|
||||
[cases.test_gc_compact_mutation]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_COMPACTMETA
|
||||
LFS3_GC_COMPACT
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FCACHE_SIZE/2',
|
||||
'2*FCACHE_SIZE',
|
||||
@@ -663,14 +663,14 @@ code = '''
|
||||
|
||||
uint32_t prng = 42;
|
||||
|
||||
// write to our mdir until >gc_compactmeta_thresh full
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
lfs3_file_t file;
|
||||
lfs3_file_open(&lfs3, &file, "jellyfish",
|
||||
LFS3_O_RDWR | LFS3_O_CREAT | LFS3_O_EXCL) => 0;
|
||||
|
||||
// hack, don't use the internals like this
|
||||
uint8_t wbuf[SIZE];
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@@ -682,7 +682,7 @@ code = '''
|
||||
// expect dirty initial state or else our test doesn't work
|
||||
struct lfs3_fsinfo fsinfo;
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACT);
|
||||
assert(lfs3.handles != &lfs3.gc.t.h);
|
||||
|
||||
// run GC one traversal + one step
|
||||
@@ -705,14 +705,14 @@ code = '''
|
||||
lfs3_file_write(&lfs3, &file, wbuf, SIZE) => SIZE;
|
||||
lfs3_file_sync(&lfs3, &file) => 0;
|
||||
|
||||
// run GC until our traversal is done (twice for compactmeta)
|
||||
// run GC until our traversal is done (twice for compact)
|
||||
while (lfs3.handles == &lfs3.gc.t.h) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
|
||||
// we should _not_ make progress
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACT);
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -738,13 +738,13 @@ code = '''
|
||||
# test that mkconsistent can make progress in isolation
|
||||
[cases.test_gc_mkconsistent_progress]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_MKCONSISTENT
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@@ -956,13 +956,13 @@ code = '''
|
||||
# test that mkconsistent dirtying still works with the GC API
|
||||
[cases.test_gc_mkconsistent_mutation]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_MKCONSISTENT
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@@ -1822,13 +1822,13 @@ done:;
|
||||
defines.AFTER = [0, 1, 2, 3]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@@ -1887,7 +1887,7 @@ code = '''
|
||||
| ((!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -1908,7 +1908,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -1937,7 +1937,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -1963,11 +1963,11 @@ code = '''
|
||||
lfs3_trv_close(&lfs3, &trv) => 0;
|
||||
}
|
||||
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@@ -2007,7 +2007,7 @@ code = '''
|
||||
&& (!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD)))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -2025,13 +2025,13 @@ code = '''
|
||||
defines.AFTER = [0, 1, 2, 3]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@@ -2090,7 +2090,7 @@ code = '''
|
||||
| ((!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -2111,7 +2111,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -2140,7 +2140,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -2166,11 +2166,11 @@ code = '''
|
||||
lfs3_trv_close(&lfs3, &trv) => 0;
|
||||
}
|
||||
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@@ -2210,7 +2210,7 @@ code = '''
|
||||
&& (!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD)))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -2228,7 +2228,7 @@ code = '''
|
||||
| ((!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
// note ckdata implies ckmeta, but uncking ckdata does
|
||||
// _not_ imply uncking ckmeta
|
||||
| ((!(CKDATA && !CKMETA)) ? LFS3_I_CKMETA : 0)
|
||||
@@ -2251,7 +2251,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -2280,7 +2280,7 @@ code = '''
|
||||
if (!(fsinfo.flags & (
|
||||
((MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@@ -2306,11 +2306,11 @@ code = '''
|
||||
lfs3_trv_close(&lfs3, &trv) => 0;
|
||||
}
|
||||
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@@ -2350,7 +2350,7 @@ code = '''
|
||||
&& (!GBMAP || (fsinfo.flags & LFS3_I_LOOKAHEAD)))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -2365,19 +2365,19 @@ code = '''
|
||||
defines.N = 100
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FCACHE_SIZE/2',
|
||||
'2*FCACHE_SIZE',
|
||||
@@ -2437,19 +2437,19 @@ code = '''
|
||||
defines.N = 100
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FCACHE_SIZE/2',
|
||||
'2*FCACHE_SIZE',
|
||||
@@ -2512,20 +2512,20 @@ code = '''
|
||||
[cases.test_gc_nospc]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
# DON'T test with GC_STEPS=-1, it may never terminate!
|
||||
defines.GC_STEPS = [1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = 'BLOCK_SIZE'
|
||||
ifdef = 'LFS3_GC'
|
||||
code = '''
|
||||
@@ -2617,20 +2617,20 @@ code = '''
|
||||
[cases.test_gc_spam_dir_many]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
ifdef = 'LFS3_GC'
|
||||
code = '''
|
||||
@@ -2724,20 +2724,20 @@ code = '''
|
||||
[cases.test_gc_spam_dir_fuzz]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
defines.OPS = '2*N'
|
||||
defines.SEED = 42
|
||||
@@ -2902,20 +2902,20 @@ code = '''
|
||||
[cases.test_gc_spam_file_many]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
@@ -3003,20 +3003,20 @@ code = '''
|
||||
[cases.test_gc_spam_file_fuzz]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.OPS = '2*N'
|
||||
defines.SIZE = [
|
||||
@@ -3243,20 +3243,20 @@ code = '''
|
||||
[cases.test_gc_spam_fwrite_fuzz]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.OPS = 20
|
||||
defines.SIZE = [
|
||||
'FCACHE_SIZE/2',
|
||||
@@ -3403,20 +3403,20 @@ code = '''
|
||||
[cases.test_gc_spam_uz_fuzz]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# you probably need to flush if you expect errors
|
||||
defines.FLUSH = false
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
@@ -3854,20 +3854,20 @@ code = '''
|
||||
[cases.test_gc_spam_uzd_fuzz]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# you probably need to flush if you expect errors
|
||||
defines.FLUSH = false
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
|
||||
+10
-10
@@ -463,11 +463,11 @@ code = '''
|
||||
[cases.test_kv_many]
|
||||
defines.N = [40, 400]
|
||||
defines.SIZE = 4
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@@ -489,7 +489,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACTMETA) {
|
||||
if (COMPACT) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
@@ -633,11 +633,11 @@ code = '''
|
||||
defines.N = 40
|
||||
# size is more an upper limit here
|
||||
defines.SIZE = 40000
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@@ -664,7 +664,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACTMETA) {
|
||||
if (COMPACT) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+25
-25
@@ -36,7 +36,7 @@ defines.CKMETAPARITY = [false, true]
|
||||
defines.CKDATACKSUMS = [false, true]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
if = [
|
||||
@@ -48,7 +48,7 @@ if = [
|
||||
'LFS3_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
|
||||
'!RDONLY || !MKCONSISTENT',
|
||||
'!RDONLY || !LOOKAHEAD',
|
||||
'!RDONLY || !COMPACTMETA',
|
||||
'!RDONLY || !COMPACT',
|
||||
]
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
@@ -72,7 +72,7 @@ code = '''
|
||||
: 0)
|
||||
| ((MKCONSISTENT) ? LFS3_M_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_M_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_M_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_M_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
CFG) => 0;
|
||||
@@ -96,7 +96,7 @@ code = '''
|
||||
: 0)
|
||||
| ((!MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((!LOOKAHEAD && !GBMAP) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -117,7 +117,7 @@ defines.CKMETAPARITY = [false, true]
|
||||
defines.CKDATACKSUMS = [false, true]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
if = [
|
||||
@@ -144,7 +144,7 @@ code = '''
|
||||
: 0)
|
||||
| ((MKCONSISTENT) ? LFS3_F_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS3_F_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_F_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_F_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_F_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_F_CKDATA : 0)
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_F_GBMAP, -1) : 0),
|
||||
@@ -159,7 +159,7 @@ code = '''
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| ((!GBMAP) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -192,7 +192,7 @@ code = '''
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| ((!GBMAP) ? LFS3_I_LOOKAHEAD : 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -210,7 +210,7 @@ code = '''
|
||||
LFS3_IFDEF_YES_REVDBG(LFS3_I_REVDBG, 0)
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -246,7 +246,7 @@ code = '''
|
||||
LFS3_IFDEF_YES_REVDBG(LFS3_I_REVDBG, 0)
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -270,7 +270,7 @@ code = '''
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_LOOKAHEAD
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -288,7 +288,7 @@ code = '''
|
||||
LFS3_IFDEF_YES_REVDBG(LFS3_I_REVDBG, 0)
|
||||
| LFS3_IFDEF_YES_REVNOISE(LFS3_I_REVNOISE, 0)
|
||||
| LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@@ -296,7 +296,7 @@ code = '''
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
'''
|
||||
|
||||
[cases.test_mount_t_compactmeta]
|
||||
[cases.test_mount_t_compact]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
@@ -308,8 +308,8 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3,
|
||||
@@ -322,14 +322,14 @@ code = '''
|
||||
// first lets create a compactable filesystem
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR, CFG) => 0;
|
||||
|
||||
// write to our mdir until >gc_compactmeta_thresh full
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
lfs3_file_t file;
|
||||
lfs3_file_open(&lfs3, &file, "jellyfish",
|
||||
LFS3_O_WRONLY | LFS3_O_CREAT | LFS3_O_EXCL) => 0;
|
||||
|
||||
// hack, don't use the internals like this
|
||||
uint8_t wbuf[SIZE];
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@@ -352,16 +352,16 @@ code = '''
|
||||
| ((!GBMAP || SIZE >= BLOCK_SIZE/4)
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
|
||||
// with LFS3_M_COMPACTMETA, mount compacts any uncompacted blocks
|
||||
// with LFS3_M_COMPACT, mount compacts any uncompacted blocks
|
||||
lfs3_mount(&lfs3,
|
||||
LFS3_M_RDWR
|
||||
| LFS3_M_COMPACTMETA
|
||||
| LFS3_M_COMPACT
|
||||
| ((LOOKAHEAD) ? LFS3_M_LOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
@@ -381,7 +381,7 @@ code = '''
|
||||
|
||||
// mdir should have been compacted
|
||||
lfs3_file_open(&lfs3, &file, "jellyfish", LFS3_O_RDONLY) => 0;
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH);
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH);
|
||||
|
||||
// check we can still read the file
|
||||
uint8_t rbuf[SIZE];
|
||||
@@ -394,7 +394,7 @@ code = '''
|
||||
|
||||
[cases.test_mount_t_mkconsistent]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.SIZE = 'FCACHE_SIZE/2'
|
||||
@@ -467,7 +467,7 @@ code = '''
|
||||
| ((!GBMAP || ORPHANS >= 100)
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@@ -478,7 +478,7 @@ code = '''
|
||||
LFS3_M_RDWR
|
||||
| LFS3_M_MKCONSISTENT
|
||||
| ((LOOKAHEAD) ? LFS3_M_LOOKAHEAD : 0)
|
||||
| ((COMPACTMETA) ? LFS3_M_COMPACTMETA : 0)
|
||||
| ((COMPACT) ? LFS3_M_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
CFG) => 0;
|
||||
@@ -489,7 +489,7 @@ code = '''
|
||||
| ((!LOOKAHEAD && (!GBMAP || ORPHANS >= 100))
|
||||
? LFS3_I_LOOKAHEAD
|
||||
: 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
|
||||
+180
-180
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user