mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
Renamed LFS3_T_COMPACT -> LFS3_T_COMPACTMETA (and gc_compactmeta_thresh)
- LFS3_T_COMPACT -> LFS3_T_COMPACTMETA - gc_compact_thresh -> gc_compactmeta_thresh And friends: LFS3_M_COMPACTMETA 0x00000800 Compact metadata logs LFS3_GC_COMPACTMETA 0x00000800 Compact metadata logs LFS3_I_COMPACTMETA 0x00000800 Filesystem may have uncompacted metadata LFS3_T_COMPACTMETA 0x00000800 Compact metadata logs --- This does two things: 1. Highlights that LFS3_T_COMPACTMETA only interacts with metadata logs, and has no effect on data blocks. 2. Better matches the verb+noun names used for other gc/traversal flags (REPOPGBMAP, CKMETA, etc). It is a bit more of a mouthful, but I'm not sure that's entirely a bad thing. These are pretty low-level flags.
This commit is contained in:
64
lfs3.c
64
lfs3.c
@ -7408,10 +7408,10 @@ static inline bool lfs3_t_isrepopgbmap(uint32_t flags) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool lfs3_t_iscompact(uint32_t flags) {
|
||||
static inline bool lfs3_t_compactmeta(uint32_t flags) {
|
||||
(void)flags;
|
||||
#ifndef LFS3_RDONLY
|
||||
return flags & LFS3_T_COMPACT;
|
||||
return flags & LFS3_T_COMPACTMETA;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -9776,7 +9776,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_COMPACT;
|
||||
lfs3->flags |= LFS3_I_COMPACTMETA;
|
||||
|
||||
#ifdef LFS3_DBGMDIRCOMMITS
|
||||
LFS3_DEBUG("Committed mdir %"PRId32" "
|
||||
@ -10733,12 +10733,12 @@ dropped:;
|
||||
}
|
||||
|
||||
// compacting mdirs?
|
||||
if (lfs3_t_iscompact(mgc->t.b.h.flags)
|
||||
if (lfs3_t_compactmeta(mgc->t.b.h.flags)
|
||||
&& tag == LFS3_TAG_MDIR
|
||||
// exceed compaction threshold?
|
||||
&& lfs3_rbyd_eoff(&((lfs3_mdir_t*)bptr_->d.u.buffer)->r)
|
||||
> ((lfs3->cfg->gc_compact_thresh)
|
||||
? lfs3->cfg->gc_compact_thresh
|
||||
> ((lfs3->cfg->gc_compactmeta_thresh)
|
||||
? lfs3->cfg->gc_compactmeta_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"} "
|
||||
@ -10747,8 +10747,8 @@ dropped:;
|
||||
mdir->r.blocks[0],
|
||||
mdir->r.blocks[1],
|
||||
lfs3_rbyd_eoff(&mdir->r),
|
||||
(lfs3->cfg->gc_compact_thresh)
|
||||
? lfs3->cfg->gc_compact_thresh
|
||||
(lfs3->cfg->gc_compactmeta_thresh)
|
||||
? lfs3->cfg->gc_compactmeta_thresh
|
||||
: lfs3->cfg->block_size - lfs3->cfg->block_size/8);
|
||||
// compact the mdir
|
||||
uint32_t dirty = mgc->t.b.h.flags;
|
||||
@ -10792,9 +10792,9 @@ eot:;
|
||||
|
||||
// was compaction successful? note we may need multiple passes if
|
||||
// we want to be sure everything is compacted
|
||||
if (lfs3_t_iscompact(mgc->t.b.h.flags)
|
||||
if (lfs3_t_compactmeta(mgc->t.b.h.flags)
|
||||
&& !lfs3_t_ismutated(mgc->t.b.h.flags)) {
|
||||
lfs3->flags &= ~LFS3_I_COMPACT;
|
||||
lfs3->flags &= ~LFS3_I_COMPACTMETA;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -15446,18 +15446,18 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
|
||||
LFS3_GC_MKCONSISTENT
|
||||
| LFS3_GC_REPOPLOOKAHEAD
|
||||
| LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, 0)
|
||||
| LFS3_GC_COMPACT
|
||||
| LFS3_GC_COMPACTMETA
|
||||
| LFS3_GC_CKMETA
|
||||
| LFS3_GC_CKDATA)) == 0);
|
||||
|
||||
// check that gc_compact_thresh makes sense
|
||||
// check that gc_compactmeta_thresh makes sense
|
||||
//
|
||||
// metadata can't be compacted below block_size/2, and metadata can't
|
||||
// exceed a block
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
|
||||
#ifndef LFS3_RDONLY
|
||||
@ -15476,7 +15476,7 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_REPOPLOOKAHEAD)
|
||||
// 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_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
// default to needing a ckmeta/ckdata scan
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA;
|
||||
@ -16349,8 +16349,8 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
#ifdef LFS3_YES_REPOPGBMAP
|
||||
flags |= LFS3_YES_REPOPGBMAP;
|
||||
#endif
|
||||
#ifdef LFS3_YES_COMPACT
|
||||
flags |= LFS3_M_COMPACT;
|
||||
#ifdef LFS3_YES_COMPACTMETA
|
||||
flags |= LFS3_M_COMPACTMETA;
|
||||
#endif
|
||||
#ifdef LFS3_YES_CKMETA
|
||||
flags |= LFS3_M_CKMETA;
|
||||
@ -16375,14 +16375,14 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_M_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACTMETA)
|
||||
| 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_isrepoplookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_isrepopgbmap(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_iscompact(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_compactmeta(flags));
|
||||
|
||||
int err = lfs3_init(lfs3,
|
||||
flags & (
|
||||
@ -16412,7 +16412,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_M_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACTMETA)
|
||||
| LFS3_M_CKMETA
|
||||
| LFS3_M_CKDATA)) {
|
||||
lfs3_mgc_t mgc;
|
||||
@ -16422,7 +16422,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_M_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACTMETA)
|
||||
| LFS3_M_CKMETA
|
||||
| LFS3_M_CKDATA),
|
||||
-1);
|
||||
@ -16766,7 +16766,7 @@ int lfs3_fs_stat(lfs3_t *lfs3, struct lfs3_fsinfo *fsinfo) {
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, 0));
|
||||
@ -17035,7 +17035,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_mgc_t *mgc,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_T_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACTMETA)
|
||||
| LFS3_T_CKMETA
|
||||
| LFS3_T_CKDATA)) == 0);
|
||||
// these flags require a writable filesystem
|
||||
@ -17043,7 +17043,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_mgc_t *mgc,
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags)
|
||||
|| !lfs3_t_isrepoplookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags) || !lfs3_t_isrepopgbmap(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags) || !lfs3_t_iscompact(flags));
|
||||
LFS3_ASSERT(!lfs3_m_isrdonly(lfs3->flags) || !lfs3_t_compactmeta(flags));
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_isrepoplookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_isrepopgbmap(flags));
|
||||
@ -17067,7 +17067,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_mgc_t *mgc,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA)));
|
||||
|
||||
@ -17094,7 +17094,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_mgc_t *mgc,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_T_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACTMETA)
|
||||
| LFS3_T_CKMETA
|
||||
| LFS3_T_CKDATA))) {
|
||||
lfs3_handle_close(lfs3, &mgc->t.b.h);
|
||||
@ -17129,7 +17129,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_mgc_t *mgc,
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA);
|
||||
}
|
||||
@ -17164,7 +17164,7 @@ int lfs3_fs_unck(lfs3_t *lfs3, uint32_t flags) {
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACTMETA)
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA)) == 0);
|
||||
|
||||
@ -17396,7 +17396,7 @@ int lfs3_trv_open(lfs3_t *lfs3, lfs3_trv_t *trv, uint32_t flags) {
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_REPOPLOOKAHEAD)
|
||||
| LFS3_IFDEF_RDONLY(0,
|
||||
LFS3_IFDEF_GBMAP(LFS3_T_REPOPGBMAP, 0))
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACT)
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_T_COMPACTMETA)
|
||||
| LFS3_T_CKMETA
|
||||
| LFS3_T_CKDATA)) == 0);
|
||||
// writeable traversals require a writeable filesystem
|
||||
@ -17405,7 +17405,7 @@ int lfs3_trv_open(lfs3_t *lfs3, lfs3_trv_t *trv, uint32_t flags) {
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_ismkconsistent(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_isrepoplookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_isrepopgbmap(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_iscompact(flags));
|
||||
LFS3_ASSERT(!lfs3_t_isrdonly(flags) || !lfs3_t_compactmeta(flags));
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_isrepoplookahead(flags));
|
||||
LFS3_ASSERT(!lfs3_t_ismtreeonly(flags) || !lfs3_t_isrepopgbmap(flags));
|
||||
|
||||
14
lfs3.h
14
lfs3.h
@ -241,7 +241,8 @@ enum lfs3_type {
|
||||
0x00000400 // Repopulate the gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_M_COMPACT 0x00000800 // Compact metadata logs
|
||||
#define LFS3_M_COMPACTMETA \
|
||||
0x00000800 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_M_CKMETA 0x00001000 // Check metadata checksums
|
||||
#define LFS3_M_CKDATA 0x00002000 // Check metadata + data checksums
|
||||
@ -286,7 +287,8 @@ enum lfs3_type {
|
||||
0x00000400 // The gbmap is not full
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_I_COMPACT 0x00000800 // Filesystem may have uncompacted metadata
|
||||
#define LFS3_I_COMPACTMETA \
|
||||
0x00000800 // Filesystem may have uncompacted metadata
|
||||
#endif
|
||||
#define LFS3_I_CKMETA 0x00001000 // Metadata checksums not checked recently
|
||||
#define LFS3_I_CKDATA 0x00002000 // Data checksums not checked recently
|
||||
@ -331,7 +333,8 @@ enum lfs3_btype {
|
||||
0x00000400 // Repopulate the gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_T_COMPACT 0x00000800 // Compact metadata logs
|
||||
#define LFS3_T_COMPACTMETA \
|
||||
0x00000800 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_T_CKMETA 0x00001000 // Check metadata checksums
|
||||
#define LFS3_T_CKDATA 0x00002000 // Check metadata + data checksums
|
||||
@ -360,7 +363,8 @@ enum lfs3_btype {
|
||||
0x00000400 // Repopulate the gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_GC_COMPACT 0x00000800 // Compact metadata logs
|
||||
#define LFS3_GC_COMPACTMETA \
|
||||
0x00000800 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_GC_CKMETA 0x00001000 // Check metadata checksums
|
||||
#define LFS3_GC_CKDATA 0x00002000 // Check metadata + data checksums
|
||||
@ -493,7 +497,7 @@ struct lfs3_cfg {
|
||||
//
|
||||
// Set to -1 to disable metadata compaction during gc.
|
||||
#ifndef LFS3_RDONLY
|
||||
lfs3_size_t gc_compact_thresh;
|
||||
lfs3_size_t gc_compactmeta_thresh;
|
||||
#endif
|
||||
|
||||
// Optional statically allocated rcache buffer. Must be rcache_size. By
|
||||
|
||||
@ -116,7 +116,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||
BENCH_DEFINE(GC_FLAGS, 0 ) \
|
||||
BENCH_DEFINE(GC_STEPS, 0 ) \
|
||||
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||
BENCH_DEFINE(GC_COMPACTMETA_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 ) \
|
||||
@ -136,20 +136,20 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
// map defines to cfg struct fields
|
||||
#define BENCH_CFG \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
BENCH_GBMAP_CFG \
|
||||
BENCH_GC_CFG \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
BENCH_GBMAP_CFG \
|
||||
BENCH_GC_CFG \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
#ifdef LFS3_GBMAP
|
||||
@ -161,17 +161,17 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
#ifdef LFS3_GC
|
||||
#define BENCH_GC_CFG \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
#else
|
||||
#define BENCH_GC_CFG
|
||||
#endif
|
||||
|
||||
#define BENCH_BDCFG \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.seed = EMUBD_SEED,
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
|
||||
TEST_DEFINE(GC_FLAGS, 0 ) \
|
||||
TEST_DEFINE(GC_STEPS, 0 ) \
|
||||
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
|
||||
TEST_DEFINE(GC_COMPACTMETA_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 ) \
|
||||
@ -127,20 +127,20 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
// map defines to cfg struct fields
|
||||
#define TEST_CFG \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
TEST_GBMAP_CFG \
|
||||
TEST_GC_CFG \
|
||||
.gc_compact_thresh = GC_COMPACT_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.read_size = READ_SIZE, \
|
||||
.prog_size = PROG_SIZE, \
|
||||
.block_size = BLOCK_SIZE, \
|
||||
.block_count = BLOCK_COUNT, \
|
||||
.block_recycles = BLOCK_RECYCLES, \
|
||||
.rcache_size = RCACHE_SIZE, \
|
||||
.pcache_size = PCACHE_SIZE, \
|
||||
.file_cache_size = FILE_CACHE_SIZE, \
|
||||
.lookahead_size = LOOKAHEAD_SIZE, \
|
||||
TEST_GBMAP_CFG \
|
||||
TEST_GC_CFG \
|
||||
.gc_compactmeta_thresh = GC_COMPACTMETA_THRESH, \
|
||||
.shrub_size = SHRUB_SIZE, \
|
||||
.fragment_size = FRAGMENT_SIZE, \
|
||||
.crystal_thresh = CRYSTAL_THRESH,
|
||||
|
||||
#ifdef LFS3_GBMAP
|
||||
@ -152,17 +152,17 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
|
||||
|
||||
#ifdef LFS3_GC
|
||||
#define TEST_GC_CFG \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_flags = GC_FLAGS, \
|
||||
.gc_steps = GC_STEPS,
|
||||
#else
|
||||
#define TEST_GC_CFG
|
||||
#endif
|
||||
|
||||
#define TEST_BDCFG \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.erase_value = ERASE_VALUE, \
|
||||
.erase_cycles = ERASE_CYCLES, \
|
||||
.badblock_behavior = BADBLOCK_BEHAVIOR, \
|
||||
.powerloss_behavior = POWERLOSS_BEHAVIOR, \
|
||||
.seed = EMUBD_SEED,
|
||||
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ FLAGS = [
|
||||
('M_REPOPLOOKAHEAD',
|
||||
0x00000200, "Repopulate lookahead buffer" ),
|
||||
('M_REPOPGBMAP', 0x00000400, "Repopulate the gbmap" ),
|
||||
('M_COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('M_COMPACTMETA', 0x00000800, "Compact metadata logs" ),
|
||||
('M_CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('M_CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
@ -101,7 +101,7 @@ FLAGS = [
|
||||
('GC_REPOPLOOKAHEAD',
|
||||
0x00000200, "Repopulate lookahead buffer" ),
|
||||
('GC_REPOPGBMAP', 0x00000400, "Repopulate the gbmap" ),
|
||||
('GC_COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('GC_COMPACTMETA', 0x00000800, "Compact metadata logs" ),
|
||||
('GC_CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('GC_CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
@ -120,7 +120,7 @@ FLAGS = [
|
||||
('I_REPOPLOOKAHEAD',
|
||||
0x00000200, "Lookahead buffer is not full" ),
|
||||
('I_REPOPGBMAP', 0x00000400, "The gbmap is not full" ),
|
||||
('I_COMPACT', 0x00000800, "Filesystem may have uncompacted metadata" ),
|
||||
('I_COMPACTMETA', 0x00000800, "Filesystem may have uncompacted metadata" ),
|
||||
('I_CKMETA', 0x00001000, "Metadata checksums not checked recently" ),
|
||||
('I_CKDATA', 0x00002000, "Data checksums not checked recently" ),
|
||||
|
||||
@ -140,7 +140,7 @@ FLAGS = [
|
||||
('T_REPOPLOOKAHEAD',
|
||||
0x00000200, "Repopulate lookahead buffer" ),
|
||||
('T_REPOPGBMAP', 0x00000400, "Repopulate the gbmap" ),
|
||||
('T_COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('T_COMPACTMETA', 0x00000800, "Compact metadata logs" ),
|
||||
('T_CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('T_CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
|
||||
@ -910,11 +910,11 @@ code = '''
|
||||
defines.FILETYPE = [0, 1, 2, 3]
|
||||
defines.M = 40
|
||||
defines.SIZE = 4
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -958,7 +958,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACT) {
|
||||
if (COMPACTMETA) {
|
||||
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.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -1055,7 +1055,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACT) {
|
||||
if (COMPACTMETA) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
@ -5041,11 +5041,11 @@ code = '''
|
||||
defines.N = 64
|
||||
defines.M = 4
|
||||
defines.SIZE = 4
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -5083,7 +5083,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACT) {
|
||||
if (COMPACTMETA) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -315,20 +315,20 @@ code = '''
|
||||
'''
|
||||
|
||||
|
||||
# test that compact can make progress in isolation
|
||||
[cases.test_gc_compact_progress]
|
||||
# test that compactmeta can make progress in isolation
|
||||
[cases.test_gc_compactmeta_progress]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_COMPACT
|
||||
LFS3_GC_COMPACTMETA
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FILE_CACHE_SIZE/2',
|
||||
'2*FILE_CACHE_SIZE',
|
||||
@ -348,14 +348,14 @@ code = '''
|
||||
|
||||
uint32_t prng = 42;
|
||||
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
// write to our mdir until >gc_compactmeta_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_COMPACT_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@ -367,7 +367,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_COMPACT);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
assert(lfs3.handles != &lfs3.gc.gc.t.b.h);
|
||||
|
||||
// run GC until we make progress
|
||||
@ -378,13 +378,13 @@ code = '''
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
if (!(fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
if (!(fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// mdir should have been compacted
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACT_THRESH);
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH);
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@ -406,19 +406,19 @@ code = '''
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
'''
|
||||
|
||||
# test that compact dirtying still works with the GC API
|
||||
[cases.test_gc_compact_mutation]
|
||||
# test that compactmeta dirtying still works with the GC API
|
||||
[cases.test_gc_compactmeta_mutation]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_COMPACT
|
||||
LFS3_GC_COMPACTMETA
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FILE_CACHE_SIZE/2',
|
||||
'2*FILE_CACHE_SIZE',
|
||||
@ -440,14 +440,14 @@ code = '''
|
||||
|
||||
uint32_t prng = 42;
|
||||
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
// write to our mdir until >gc_compactmeta_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_COMPACT_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@ -459,7 +459,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_COMPACT);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
assert(lfs3.handles != &lfs3.gc.gc.t.b.h);
|
||||
|
||||
// run GC one traversal + one step
|
||||
@ -482,14 +482,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 compact)
|
||||
// run GC until our traversal is done (twice for compactmeta)
|
||||
while (lfs3.handles == &lfs3.gc.gc.t.b.h) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
|
||||
// we should _not_ make progress
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags & LFS3_I_COMPACT);
|
||||
assert(fsinfo.flags & LFS3_I_COMPACTMETA);
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@ -515,13 +515,13 @@ code = '''
|
||||
# test that mkconsistent can make progress in isolation
|
||||
[cases.test_gc_mkconsistent_progress]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_MKCONSISTENT
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@ -733,13 +733,13 @@ code = '''
|
||||
# test that mkconsistent dirtying still works with the GC API
|
||||
[cases.test_gc_mkconsistent_mutation]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
LFS3_GC_MKCONSISTENT
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@ -1600,14 +1600,14 @@ defines.AFTER = [0, 1, 2, 3]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@ -1667,7 +1667,7 @@ code = '''
|
||||
? (LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@ -1691,7 +1691,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -1723,7 +1723,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -1767,11 +1767,11 @@ code = '''
|
||||
}
|
||||
#endif
|
||||
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@ -1812,7 +1812,7 @@ code = '''
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
: 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -1831,14 +1831,14 @@ defines.AFTER = [0, 1, 2, 3]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
@ -1898,7 +1898,7 @@ code = '''
|
||||
? (LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| ((GBMAP) ? LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, -1) : 0)));
|
||||
@ -1922,7 +1922,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -1954,7 +1954,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -1998,11 +1998,11 @@ code = '''
|
||||
}
|
||||
#endif
|
||||
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@ -2043,7 +2043,7 @@ code = '''
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
: 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -2063,7 +2063,7 @@ code = '''
|
||||
? (LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
// note ckdata implies ckmeta, but uncking ckdata does
|
||||
// _not_ imply uncking ckmeta
|
||||
| ((!(CKDATA && !CKMETA)) ? LFS3_I_CKMETA : 0)
|
||||
@ -2089,7 +2089,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -2121,7 +2121,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_I_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_I_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_I_CKDATA : 0)))) {
|
||||
break;
|
||||
@ -2165,11 +2165,11 @@ code = '''
|
||||
}
|
||||
#endif
|
||||
|
||||
if (COMPACT && (fsinfo.flags & LFS3_I_COMPACT)) {
|
||||
if (COMPACTMETA && (fsinfo.flags & LFS3_I_COMPACTMETA)) {
|
||||
// we need an explicit traversal for this
|
||||
lfs3_trv_t trv;
|
||||
lfs3_trv_open(&lfs3, &trv,
|
||||
LFS3_T_RDWR | LFS3_T_COMPACT) => 0;
|
||||
LFS3_T_RDWR | LFS3_T_COMPACTMETA) => 0;
|
||||
while (true) {
|
||||
struct lfs3_tinfo tinfo;
|
||||
int err = lfs3_trv_read(&lfs3, &trv, &tinfo);
|
||||
@ -2210,7 +2210,7 @@ code = '''
|
||||
& fsinfo.flags)
|
||||
: 0)
|
||||
: 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -2226,20 +2226,20 @@ defines.N = 100
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FILE_CACHE_SIZE/2',
|
||||
'2*FILE_CACHE_SIZE',
|
||||
@ -2301,20 +2301,20 @@ defines.N = 100
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FILE_CACHE_SIZE/2',
|
||||
'2*FILE_CACHE_SIZE',
|
||||
@ -2383,7 +2383,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -2391,13 +2391,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
if = 'GBMAP || !REPOPGBMAP'
|
||||
ifdef = 'LFS3_GC'
|
||||
@ -2493,7 +2493,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -2501,13 +2501,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
defines.OPS = '2*N'
|
||||
defines.SEED = 42
|
||||
@ -2674,7 +2674,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -2682,13 +2682,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
@ -2780,7 +2780,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -2788,13 +2788,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.OPS = '2*N'
|
||||
defines.SIZE = [
|
||||
@ -3025,7 +3025,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -3033,13 +3033,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.OPS = 20
|
||||
defines.SIZE = [
|
||||
'FILE_CACHE_SIZE/2',
|
||||
@ -3188,7 +3188,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -3196,13 +3196,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.OPS = '2*N'
|
||||
defines.SIZE = [
|
||||
@ -3640,7 +3640,7 @@ code = '''
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
@ -3648,13 +3648,13 @@ defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS3_GC_MKCONSISTENT : 0)
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_GC_REPOPLOOKAHEAD : 0)
|
||||
| ((REPOPGBMAP) ? LFS3_IFDEF_GBMAP(LFS3_GC_REPOPGBMAP, -1) : 0)
|
||||
| ((COMPACT) ? LFS3_GC_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_GC_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.OPS = '2*N'
|
||||
defines.SIZE = [
|
||||
|
||||
@ -463,11 +463,11 @@ code = '''
|
||||
[cases.test_kv_many]
|
||||
defines.N = [40, 400]
|
||||
defines.SIZE = 4
|
||||
defines.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -489,7 +489,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACT) {
|
||||
if (COMPACTMETA) {
|
||||
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.COMPACT = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACT'
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.GC_FLAGS = 'LFS3_GC_COMPACTMETA'
|
||||
defines.GC_STEPS = -1
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACT)'
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
if = 'LFS3_IFDEF_GC(true, !COMPACTMETA)'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -664,7 +664,7 @@ code = '''
|
||||
|
||||
// try compacting?
|
||||
#ifdef LFS3_GC
|
||||
if (COMPACT) {
|
||||
if (COMPACTMETA) {
|
||||
lfs3_fs_gc(&lfs3) => 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -26,7 +26,7 @@ defines.CKDATACKSUMS = [false, true]
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.REPOPGBMAP = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
if = [
|
||||
@ -41,7 +41,7 @@ if = [
|
||||
'!RDONLY || !REPOPLOOKAHEAD',
|
||||
'LFS3_IFDEF_YES_GBMAP(true, !REPOPGBMAP)',
|
||||
'!RDONLY || !REPOPGBMAP',
|
||||
'!RDONLY || !COMPACT',
|
||||
'!RDONLY || !COMPACTMETA',
|
||||
]
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
@ -65,7 +65,7 @@ code = '''
|
||||
| ((REPOPGBMAP)
|
||||
? LFS3_IFDEF_GBMAP(LFS3_M_REPOPGBMAP, -1)
|
||||
: 0)
|
||||
| ((COMPACT) ? LFS3_M_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_M_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
CFG) => 0;
|
||||
@ -89,7 +89,7 @@ code = '''
|
||||
: 0)
|
||||
| ((!MKCONSISTENT) ? LFS3_I_MKCONSISTENT : 0)
|
||||
| ((!REPOPLOOKAHEAD) ? LFS3_I_REPOPLOOKAHEAD : 0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -147,7 +147,7 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_REPOPLOOKAHEAD
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_YES_GBMAP(
|
||||
@ -174,7 +174,7 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_REPOPLOOKAHEAD
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_YES_GBMAP(LFS3_I_GBMAP, 0)));
|
||||
@ -190,7 +190,7 @@ code = '''
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -221,7 +221,7 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_REPOPLOOKAHEAD
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, 0)));
|
||||
@ -244,7 +244,7 @@ code = '''
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_REPOPLOOKAHEAD
|
||||
| LFS3_I_REPOPGBMAP
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_GBMAP(LFS3_I_GBMAP, 0)));
|
||||
@ -261,7 +261,7 @@ code = '''
|
||||
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS3_I_MKCONSISTENT
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
@ -269,7 +269,7 @@ code = '''
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
'''
|
||||
|
||||
[cases.test_mount_t_compact]
|
||||
[cases.test_mount_t_compactmeta]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
@ -281,8 +281,8 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
# set compactmeta thresh to minimum
|
||||
defines.GC_COMPACTMETA_THRESH = 'BLOCK_SIZE/2'
|
||||
code = '''
|
||||
lfs3_t lfs3;
|
||||
lfs3_format(&lfs3, LFS3_F_RDWR, CFG) => 0;
|
||||
@ -292,14 +292,14 @@ code = '''
|
||||
// first lets create a compactable filesystem
|
||||
lfs3_mount(&lfs3, LFS3_M_RDWR, CFG) => 0;
|
||||
|
||||
// write to our mdir until >gc_compact_thresh full
|
||||
// write to our mdir until >gc_compactmeta_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_COMPACT_THRESH) {
|
||||
while ((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH) {
|
||||
lfs3_file_rewind(&lfs3, &file) => 0;
|
||||
for (lfs3_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
@ -321,16 +321,16 @@ code = '''
|
||||
| LFS3_IFDEF_YES_GBMAP(
|
||||
(SIZE >= BLOCK_SIZE/4) ? LFS3_I_REPOPGBMAP : 0,
|
||||
0)
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_YES_GBMAP(LFS3_I_GBMAP, 0)));
|
||||
lfs3_unmount(&lfs3) => 0;
|
||||
|
||||
// with LFS3_M_COMPACT, mount compact any uncompacted blocks
|
||||
// with LFS3_M_COMPACTMETA, mount compacts any uncompacted blocks
|
||||
lfs3_mount(&lfs3,
|
||||
LFS3_M_RDWR
|
||||
| LFS3_M_COMPACT
|
||||
| LFS3_M_COMPACTMETA
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_M_REPOPLOOKAHEAD : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
@ -349,7 +349,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_COMPACT_THRESH);
|
||||
assert((file.b.h.mdir.r.eoff & 0x7fffffff) <= GC_COMPACTMETA_THRESH);
|
||||
|
||||
// check we can still read the file
|
||||
uint8_t rbuf[SIZE];
|
||||
@ -362,7 +362,7 @@ code = '''
|
||||
|
||||
[cases.test_mount_t_mkconsistent]
|
||||
defines.REPOPLOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.COMPACTMETA = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.SIZE = 'FILE_CACHE_SIZE/2'
|
||||
@ -431,7 +431,7 @@ code = '''
|
||||
| LFS3_IFDEF_YES_GBMAP(
|
||||
(ORPHANS >= 100) ? LFS3_I_REPOPGBMAP : 0,
|
||||
0)
|
||||
| LFS3_I_COMPACT
|
||||
| LFS3_I_COMPACTMETA
|
||||
| LFS3_I_CKMETA
|
||||
| LFS3_I_CKDATA
|
||||
| LFS3_IFDEF_YES_GBMAP(LFS3_I_GBMAP, 0)));
|
||||
@ -442,7 +442,7 @@ code = '''
|
||||
LFS3_M_RDWR
|
||||
| LFS3_M_MKCONSISTENT
|
||||
| ((REPOPLOOKAHEAD) ? LFS3_M_REPOPLOOKAHEAD : 0)
|
||||
| ((COMPACT) ? LFS3_M_COMPACT : 0)
|
||||
| ((COMPACTMETA) ? LFS3_M_COMPACTMETA : 0)
|
||||
| ((CKMETA) ? LFS3_M_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS3_M_CKDATA : 0),
|
||||
CFG) => 0;
|
||||
@ -452,7 +452,7 @@ code = '''
|
||||
| LFS3_IFDEF_YES_GBMAP(
|
||||
(ORPHANS >= 100) ? LFS3_I_REPOPGBMAP : 0,
|
||||
0)
|
||||
| ((!COMPACT) ? LFS3_I_COMPACT : 0)
|
||||
| ((!COMPACTMETA) ? LFS3_I_COMPACTMETA : 0)
|
||||
// note ckdata implies ckmeta
|
||||
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
|
||||
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user