gc: Made CKMETA/CKDATA progressable, added lfsr_gc_unck
LFS_GC_CKMETA and LFS_GC_CKDATA are a bit unique in that their work is
never really done.
Where LFS_GC_MKCONSISTENT/COMPACT can prove things about the system,
LFS_GC_CKMETA/CKDATA can't, because it's always possible for new
bit-errors to develop. Even _during_ an LFS_GC_CKMETA/CKDATA traversal.
But while this is technically true, it's not a very useful state of
things for our lfsr_gc API...
---
What we really want is some way to know if ckmeta/ckdata has completed
"recently" (for some definition of recently), and to let users indicate
when they need another ckmeta/ckdata scan.
To try to solve this:
1. Added LFS_I_CANCKMETA and LFS_I_CANCKDATA to indicate when lfsr_gc
has not checked metadata/data.
These are set during mount (unless mounting with
LFS_M_CKMETA/CKDATA), and cleared when either lfsr_gc completes or
lfsr_fs_ckmeta/data is called. Once cleared, littlefs will not reset
them on its own.
2. Added lfsr_gc_unck to allow users to explicitly reset LFS_I_CKMETA
and/or LFS_I_CKDATA, which will tell lfsr_gc to check metadata/data
again on the next call.
There is some subtlety around clobbering ongoing traversals, but a
mask and some tests should prevent this from being a problem.
Currently, lfsr_gc_unck also allows clearing of other gc flags, but
I'm not sure there's any real use-case for this...
Note that you can still get the previous behavior if you just call
lfsr_gc_unck after every lfsr_gc call.
This also changes info flag behavior slightly in default mode, with
LFS_I_CANCKMETA/CANCKDATA telling you if metadata/data has been checked
since mount. Which does seem useful? Maybe these flags deserve a better
name?
Code changes:
code stack ctx
default before: 37796 (+0.0%) 2608 (+0.0%) 620 (+0.0%)
default after: 37792 (+0.0%) 2608 (+0.0%) 620 (+0.0%)
gc before: 37896 2608 768
gc after: 37938 (+0.1%) 2608 (+0.0%) 768 (+0.0.%)
This commit is contained in:
@@ -6728,6 +6728,14 @@ static inline bool lfsr_i_isuncompacted(uint32_t flags) {
|
||||
return flags & LFS_I_UNCOMPACTED;
|
||||
}
|
||||
|
||||
static inline bool lfsr_i_canckmeta(uint32_t flags) {
|
||||
return flags & LFS_I_CANCKMETA;
|
||||
}
|
||||
|
||||
static inline bool lfsr_i_canckdata(uint32_t flags) {
|
||||
return flags & LFS_I_CANCKDATA;
|
||||
}
|
||||
|
||||
// on-demand flags
|
||||
|
||||
// needed in lfsr_fs_isinconsistent
|
||||
@@ -9621,6 +9629,7 @@ failed:;
|
||||
eot:;
|
||||
// was lookahead scan successful?
|
||||
if (lfsr_t_islookahead(t->o.o.flags)
|
||||
&& !lfsr_t_ismtreeonly(t->o.o.flags)
|
||||
&& !lfsr_t_isdirty(t->o.o.flags)
|
||||
&& !lfsr_t_ismutated(t->o.o.flags)) {
|
||||
lfs_alloc_markfree(lfs);
|
||||
@@ -9640,6 +9649,21 @@ eot:;
|
||||
lfs->flags &= ~LFS_I_UNCOMPACTED;
|
||||
}
|
||||
|
||||
// was ckmeta/ckdata successful? we only consider our filesystem
|
||||
// checked if we weren't mutated
|
||||
if (lfsr_t_isckmeta(t->o.o.flags)
|
||||
&& !lfsr_t_ismtreeonly(t->o.o.flags)
|
||||
&& !lfsr_t_isdirty(t->o.o.flags)
|
||||
&& !lfsr_t_ismutated(t->o.o.flags)) {
|
||||
lfs->flags &= ~LFS_I_CANCKMETA;
|
||||
}
|
||||
if (lfsr_t_isckdata(t->o.o.flags)
|
||||
&& !lfsr_t_ismtreeonly(t->o.o.flags)
|
||||
&& !lfsr_t_isdirty(t->o.o.flags)
|
||||
&& !lfsr_t_ismutated(t->o.o.flags)) {
|
||||
lfs->flags &= ~LFS_I_CANCKDATA;
|
||||
}
|
||||
|
||||
return LFS_ERR_NOENT;
|
||||
}
|
||||
|
||||
@@ -13188,7 +13212,10 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
|
||||
| LFS_I_UNTIDY
|
||||
// default to assuming we need compaction somewhere, worst case
|
||||
// this just makes lfsr_gc read more than is strictly needed
|
||||
| LFS_I_UNCOMPACTED;
|
||||
| LFS_I_UNCOMPACTED
|
||||
// default to needing a ckmeta/ckdata scan
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA;
|
||||
|
||||
// copy block_count so we can mutate it
|
||||
lfs->block_count = lfs->cfg->block_count;
|
||||
@@ -14196,7 +14223,9 @@ int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
|
||||
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
|
||||
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
|
||||
| LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0)
|
||||
| LFS_I_UNCOMPACTED);
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA);
|
||||
// some flags we calculate on demand
|
||||
fsinfo->flags |= (lfsr_fs_isinconsistent(lfs)) ? LFS_I_INCONSISTENT : 0;
|
||||
fsinfo->flags |= (lfsr_fs_canlookahead(lfs)) ? LFS_I_CANLOOKAHEAD : 0;
|
||||
@@ -14403,6 +14432,8 @@ static int lfsr_fs_ck(lfs_t *lfs, uint32_t flags) {
|
||||
}
|
||||
}
|
||||
|
||||
// clear relevant ck flags
|
||||
lfs->flags &= ~flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14452,10 +14483,10 @@ static int lfsr_fs_gc(lfs_t *lfs, lfsr_traversal_t *t,
|
||||
uint32_t pending = flags & (
|
||||
(lfs->flags & (
|
||||
LFS_I_UNTIDY
|
||||
| LFS_I_UNCOMPACTED))
|
||||
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0)
|
||||
| LFS_GC_CKMETA
|
||||
| LFS_GC_CKDATA);
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA))
|
||||
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0));
|
||||
|
||||
while (pending && (lfs_off_t)steps > 0) {
|
||||
// checkpoint the allocator to maximize any lookahead scans
|
||||
@@ -14507,13 +14538,11 @@ static int lfsr_fs_gc(lfs_t *lfs, lfsr_traversal_t *t,
|
||||
pending &= (
|
||||
(lfs->flags & (
|
||||
LFS_I_UNTIDY
|
||||
| LFS_I_UNCOMPACTED))
|
||||
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0)
|
||||
// only consider our filesystem checked if we
|
||||
// weren't mutated
|
||||
| ((lfsr_t_isdirty(t->o.o.flags)
|
||||
|| lfsr_t_ismutated(t->o.o.flags))
|
||||
? LFS_GC_CKMETA | LFS_GC_CKDATA
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA))
|
||||
| ((lfsr_fs_canlookahead(lfs))
|
||||
? LFS_GC_LOOKAHEAD
|
||||
: 0));
|
||||
}
|
||||
|
||||
@@ -14767,6 +14796,30 @@ int lfsr_gc(lfs_t *lfs) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LFS_GC
|
||||
// unperform janitorial work
|
||||
int lfsr_gc_unck(lfs_t *lfs, uint32_t flags) {
|
||||
// unknown flags?
|
||||
LFS_ASSERT((flags & ~(
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA)) == 0);
|
||||
|
||||
// reset the requested flags
|
||||
lfs->flags |= flags;
|
||||
|
||||
// and clear from any ongoing traversals
|
||||
//
|
||||
// lfsr_fs_gc will terminate early if it discovers it can no longer
|
||||
// make progress
|
||||
lfs->gc.t.o.o.flags &= ~flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -229,6 +229,8 @@ enum lfs_type {
|
||||
0x00002000 // Lookahead buffer is not full
|
||||
#define LFS_I_UNCOMPACTED \
|
||||
0x00008000 // Filesystem may have uncompacted metadata
|
||||
#define LFS_I_CANCKMETA 0x00010000 // Metadata checksums not checked recently
|
||||
#define LFS_I_CANCKDATA 0x00020000 // Data checksums not checked recently
|
||||
|
||||
// internally used flags, don't use these
|
||||
#define LFS_I_UNTIDY 0x00001000 // Filesystem may have orphaned stickynotes
|
||||
@@ -1270,6 +1272,20 @@ int lfsr_traversal_rewind(lfs_t *lfs, lfsr_traversal_t *t);
|
||||
int lfsr_gc(lfs_t *lfs);
|
||||
#endif
|
||||
|
||||
#ifdef LFS_GC
|
||||
// Mark janitorial work as incomplete.
|
||||
//
|
||||
// Any info flags passed to lfsr_gc_unck will be reset internally,
|
||||
// forcing the work to be redone.
|
||||
//
|
||||
// This is most useful for triggering new ckmeta/ckdata scans with
|
||||
// LFS_I_CANCKMETA and LFS_I_CANCKDATA. Otherwise littlefs will perform
|
||||
// only one scan after mount.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfsr_gc_unck(lfs_t *lfs, uint32_t flags);
|
||||
#endif
|
||||
|
||||
|
||||
/// Filesystem-level filesystem operations
|
||||
|
||||
|
||||
@@ -1045,6 +1045,305 @@ code = '''
|
||||
done:;
|
||||
'''
|
||||
|
||||
# test we can detect fully clobbered blocks after a ck pass, if we call
|
||||
# lfsr_gc_unck
|
||||
[cases.test_gc_ckmeta_unck]
|
||||
# AFTER=0 => after running lfsr_gc once
|
||||
# AFTER=1 => after running lfsr_gc to completion
|
||||
# AFTER=2 => after lfsr_fs_ckmeta
|
||||
# AFTER=3 => after remounting with LFS_M_CKMETA
|
||||
defines.AFTER = [0, 1, 2, 3]
|
||||
defines.GC_FLAGS = 'LFS_GC_CKMETA'
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
'FILE_BUFFER_SIZE/2',
|
||||
'2*FILE_BUFFER_SIZE',
|
||||
'BLOCK_SIZE/2',
|
||||
'BLOCK_SIZE',
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 32'
|
||||
ifdef = 'LFS_GC'
|
||||
code = '''
|
||||
lfs_block_t i = 0;
|
||||
while (true) {
|
||||
// a bit hacky, but this catches infinite loops
|
||||
assert(i < 2*BLOCK_COUNT);
|
||||
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
|
||||
// create an interesting filesystem
|
||||
uint32_t prng = 42;
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
char name[256];
|
||||
sprintf(name, "squid%03x", i);
|
||||
|
||||
uint8_t wbuf[SIZE];
|
||||
for (lfs_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
}
|
||||
|
||||
lfsr_file_t file;
|
||||
lfsr_file_open(&lfs, &file, name,
|
||||
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
|
||||
lfsr_file_write(&lfs, &file, wbuf, SIZE) => SIZE;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
// run lfsr_gc before clobbering, this should not find anything
|
||||
|
||||
// run lfsr_gc once
|
||||
if (AFTER == 0) {
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// run lfsr_gc to completion
|
||||
} else if (AFTER == 1) {
|
||||
while (true) {
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
if (!(fsinfo.flags & LFS_I_CANCKMETA)) {
|
||||
break;
|
||||
}
|
||||
|
||||
lfsr_gc(&lfs) => 0;
|
||||
}
|
||||
|
||||
// run lfsr_fs_ckmeta
|
||||
} else if (AFTER == 2) {
|
||||
lfsr_fs_ckmeta(&lfs) => 0;
|
||||
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(!(fsinfo.flags & LFS_I_CANCKMETA));
|
||||
|
||||
// remount with LFS_M_CKMETA
|
||||
} else if (AFTER == 3) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKMETA, CFG) => 0;
|
||||
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(!(fsinfo.flags & LFS_I_CANCKMETA));
|
||||
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
// traverse to find blocks
|
||||
lfsr_traversal_t t;
|
||||
lfsr_traversal_open(&lfs, &t, 0) => 0;
|
||||
lfs_block_t k = 0;
|
||||
for (lfs_block_t j = 0;; j++) {
|
||||
assert(j < 2*BLOCK_COUNT);
|
||||
|
||||
struct lfs_tinfo tinfo;
|
||||
int err = lfsr_traversal_read(&lfs, &t, &tinfo);
|
||||
assert(!err || err == LFS_ERR_NOENT);
|
||||
if (err == LFS_ERR_NOENT) {
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
// this gets a bit tricky be cause we need to clobber both
|
||||
// blocks in mdir pairs
|
||||
if (tinfo.btype == LFS_BTYPE_MDIR
|
||||
|| tinfo.btype == LFS_BTYPE_BTREE) {
|
||||
if (k == i || k == i+1) {
|
||||
// clobber this block
|
||||
printf("clobbering 0x%x\n", tinfo.block);
|
||||
uint8_t clobber_buf[BLOCK_SIZE];
|
||||
memset(clobber_buf, 0xcc, BLOCK_SIZE);
|
||||
CFG->erase(CFG, tinfo.block) => 0;
|
||||
CFG->prog(CFG, tinfo.block, 0,
|
||||
clobber_buf, BLOCK_SIZE) => 0;
|
||||
if (tinfo.btype != LFS_BTYPE_MDIR || k == i+1) {
|
||||
i += (tinfo.btype == LFS_BTYPE_MDIR) ? 2 : 1;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
goto clobbered;
|
||||
}
|
||||
}
|
||||
k += 1;
|
||||
}
|
||||
}
|
||||
|
||||
clobbered:;
|
||||
// clear relevant ck flags
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA) => 0;
|
||||
|
||||
// running lfsr_gc should eventually find the clobbered block
|
||||
for (lfs_block_t i = 0;; i++) {
|
||||
// a bit hacky, but this catches infinite loops
|
||||
LFS_ASSERT(i < 2*BLOCK_COUNT);
|
||||
|
||||
int err = lfsr_gc(&lfs);
|
||||
assert(!err || err == LFS_ERR_CORRUPT);
|
||||
// found it
|
||||
if (err == LFS_ERR_CORRUPT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
}
|
||||
done:;
|
||||
'''
|
||||
|
||||
[cases.test_gc_ckdata_unck]
|
||||
# AFTER=0 => after running lfsr_gc once
|
||||
# AFTER=1 => after running lfsr_gc to completion
|
||||
# AFTER=2 => after lfsr_fs_ckdata
|
||||
# AFTER=3 => after remounting with LFS_M_CKDATA
|
||||
defines.AFTER = [0, 1, 2]
|
||||
defines.GC_FLAGS = 'LFS_GC_CKDATA'
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64]
|
||||
defines.SIZE = [
|
||||
'0',
|
||||
'FILE_BUFFER_SIZE/2',
|
||||
'2*FILE_BUFFER_SIZE',
|
||||
'BLOCK_SIZE/2',
|
||||
'BLOCK_SIZE',
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 32'
|
||||
ifdef = 'LFS_GC'
|
||||
code = '''
|
||||
lfs_block_t i = 0;
|
||||
while (true) {
|
||||
// a bit hacky, but this catches infinite loops
|
||||
assert(i < 2*BLOCK_COUNT);
|
||||
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
|
||||
// create an interesting filesystem
|
||||
uint32_t prng = 42;
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
char name[256];
|
||||
sprintf(name, "squid%03x", i);
|
||||
|
||||
uint8_t wbuf[SIZE];
|
||||
for (lfs_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
}
|
||||
|
||||
lfsr_file_t file;
|
||||
lfsr_file_open(&lfs, &file, name,
|
||||
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
|
||||
lfsr_file_write(&lfs, &file, wbuf, SIZE) => SIZE;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
// run lfsr_gc before clobbering, this should not find anything
|
||||
|
||||
// run lfsr_gc once
|
||||
if (AFTER == 0) {
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// run lfsr_gc to completion
|
||||
} else if (AFTER == 1) {
|
||||
while (true) {
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
if (!(fsinfo.flags & LFS_I_CANCKDATA)) {
|
||||
break;
|
||||
}
|
||||
|
||||
lfsr_gc(&lfs) => 0;
|
||||
}
|
||||
|
||||
// run lfsr_fs_ckdata
|
||||
} else if (AFTER == 2) {
|
||||
lfsr_fs_ckdata(&lfs) => 0;
|
||||
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(!(fsinfo.flags & LFS_I_CANCKDATA));
|
||||
|
||||
// remount with LFS_M_CKDATA
|
||||
} else if (AFTER == 3) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR | LFS_M_CKDATA, CFG) => 0;
|
||||
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(!(fsinfo.flags & LFS_I_CANCKDATA));
|
||||
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
// traverse to find blocks
|
||||
lfsr_traversal_t t;
|
||||
lfsr_traversal_open(&lfs, &t, 0) => 0;
|
||||
lfs_block_t k = 0;
|
||||
for (lfs_block_t j = 0;; j++) {
|
||||
assert(j < 2*BLOCK_COUNT);
|
||||
|
||||
struct lfs_tinfo tinfo;
|
||||
int err = lfsr_traversal_read(&lfs, &t, &tinfo);
|
||||
assert(!err || err == LFS_ERR_NOENT);
|
||||
if (err == LFS_ERR_NOENT) {
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
// this gets a bit tricky be cause we need to clobber both
|
||||
// blocks in mdir pairs
|
||||
if (tinfo.btype == LFS_BTYPE_MDIR
|
||||
|| tinfo.btype == LFS_BTYPE_BTREE
|
||||
|| tinfo.btype == LFS_BTYPE_DATA) {
|
||||
if (k == i || k == i+1) {
|
||||
// clobber this block
|
||||
printf("clobbering 0x%x\n", tinfo.block);
|
||||
uint8_t clobber_buf[BLOCK_SIZE];
|
||||
memset(clobber_buf, 0xcc, BLOCK_SIZE);
|
||||
CFG->erase(CFG, tinfo.block) => 0;
|
||||
CFG->prog(CFG, tinfo.block, 0,
|
||||
clobber_buf, BLOCK_SIZE) => 0;
|
||||
if (tinfo.btype != LFS_BTYPE_MDIR || k == i+1) {
|
||||
i += (tinfo.btype == LFS_BTYPE_MDIR) ? 2 : 1;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
goto clobbered;
|
||||
}
|
||||
}
|
||||
k += 1;
|
||||
}
|
||||
}
|
||||
|
||||
clobbered:;
|
||||
// clear relevant ck flags
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKDATA) => 0;
|
||||
|
||||
// running lfsr_gc should eventually find the clobbered block
|
||||
//
|
||||
// note LFS_GC_CKDATA implies LFS_GC_CKMETA
|
||||
for (lfs_block_t i = 0;; i++) {
|
||||
// a bit hacky, but this catches infinite loops
|
||||
LFS_ASSERT(i < 2*BLOCK_COUNT);
|
||||
|
||||
int err = lfsr_gc(&lfs);
|
||||
assert(!err || err == LFS_ERR_CORRUPT);
|
||||
// found it
|
||||
if (err == LFS_ERR_CORRUPT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
}
|
||||
done:;
|
||||
'''
|
||||
|
||||
|
||||
# pseudo-fuzz test that dirtying still works with the GC API
|
||||
[cases.test_gc_mutation]
|
||||
@@ -1115,6 +1414,79 @@ code = '''
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# pseudo-fuzz test that spamming lfsr_gc_unck doesn't break anything
|
||||
[cases.test_gc_mutation_unck]
|
||||
defines.N = 100
|
||||
defines.MKCONSISTENT = [false, true]
|
||||
defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
| ((COMPACT) ? LFS_GC_COMPACT : 0)
|
||||
| ((CKMETA) ? LFS_GC_CKMETA : 0)
|
||||
| ((CKDATA) ? LFS_GC_CKDATA : 0)
|
||||
'''
|
||||
defines.GC_STEPS = [-1, 1, 2, 10, 100, 1000]
|
||||
# set compact thresh to minimum
|
||||
defines.GC_COMPACT_THRESH = 'BLOCK_SIZE/2'
|
||||
defines.SIZE = [
|
||||
'FILE_BUFFER_SIZE/2',
|
||||
'2*FILE_BUFFER_SIZE',
|
||||
'BLOCK_SIZE/2',
|
||||
'BLOCK_SIZE',
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
ifdef = 'LFS_GC'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
|
||||
uint32_t prng = 42;
|
||||
|
||||
// create a file
|
||||
lfsr_file_t file;
|
||||
lfsr_file_open(&lfs, &file, "spider",
|
||||
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => 0;
|
||||
uint8_t wbuf[SIZE];
|
||||
for (lfs_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
}
|
||||
lfsr_file_write(&lfs, &file, wbuf, SIZE) => SIZE;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (uint32_t i = 0; i < N; i++) {
|
||||
// rewrite the file every gc cycle
|
||||
lfsr_file_open(&lfs, &file, "spider",
|
||||
LFS_O_WRONLY | LFS_O_TRUNC) => 0;
|
||||
for (lfs_size_t j = 0; j < SIZE; j++) {
|
||||
wbuf[j] = 'a' + (TEST_PRNG(&prng) % 26);
|
||||
}
|
||||
lfsr_file_write(&lfs, &file, wbuf, SIZE) => SIZE;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
// choose a random set of flags to unck every cycle
|
||||
uint32_t flags = GC_FLAGS & TEST_PRNG(&prng);
|
||||
lfsr_gc_unck(&lfs, flags) => 0;
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
}
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
uint8_t rbuf[SIZE];
|
||||
lfsr_file_read(&lfs, &file, rbuf, SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
|
||||
|
||||
# many/fuzz tests mixed with GC
|
||||
@@ -1126,6 +1498,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -1153,6 +1526,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -1224,6 +1602,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -1334,6 +1713,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -1393,6 +1777,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -1440,6 +1825,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -1485,6 +1875,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -1642,6 +2033,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -1716,6 +2112,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -1809,6 +2206,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
@@ -1867,6 +2269,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -2142,6 +2545,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check that disk matches our simulation
|
||||
@@ -2226,6 +2634,7 @@ defines.LOOKAHEAD = [false, true]
|
||||
defines.COMPACT = [false, true]
|
||||
defines.CKMETA = [false, true]
|
||||
defines.CKDATA = [false, true]
|
||||
defines.UNCK = [false, true]
|
||||
defines.GC_FLAGS = '''
|
||||
((MKCONSISTENT) ? LFS_GC_MKCONSISTENT : 0)
|
||||
| ((LOOKAHEAD) ? LFS_GC_LOOKAHEAD : 0)
|
||||
@@ -2563,6 +2972,11 @@ code = '''
|
||||
|
||||
// gc!
|
||||
lfsr_gc(&lfs) => 0;
|
||||
|
||||
// unck to keep things interesting?
|
||||
if (UNCK) {
|
||||
lfsr_gc_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check that disk matches our simulation
|
||||
|
||||
+21
-7
@@ -74,7 +74,9 @@ code = '''
|
||||
: 0)
|
||||
| ((!MKCONSISTENT) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)));
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -135,7 +137,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
// with LFS_M_LOOKAHEAD, mount performs a lookahead scan
|
||||
@@ -148,7 +152,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
@@ -201,7 +207,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
// with LFS_M_COMPACT, mount compact any uncompacted blocks
|
||||
@@ -215,7 +223,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// mdir should have been compacted
|
||||
lfsr_file_open(&lfs, &file, "jellyfish", LFS_O_RDONLY) => 0;
|
||||
@@ -295,7 +305,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
// with LFS_M_MKCONSISTENT, mount cleans up orphans eagerly
|
||||
@@ -310,7 +322,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)));
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
lfsr_file_open(&lfs, &file, "cuttlefish", LFS_O_RDONLY) => 0;
|
||||
|
||||
+247
-105
@@ -1682,7 +1682,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_INCONSISTENT
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing
|
||||
lfsr_traversal_t t;
|
||||
@@ -1707,7 +1709,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((!MKCONSISTENT) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)));
|
||||
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1763,12 +1767,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1812,12 +1818,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try another mutation just for good measure
|
||||
lfsr_file_open(&lfs, &file, "tarantula",
|
||||
@@ -1831,11 +1839,13 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
@@ -1883,12 +1893,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1940,12 +1952,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1997,12 +2011,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2066,12 +2082,14 @@ code = '''
|
||||
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -2145,12 +2163,14 @@ code = '''
|
||||
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_rewind(&lfs, &file) => 0;
|
||||
@@ -2236,12 +2256,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -2336,12 +2358,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -2429,12 +2453,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -2509,12 +2535,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_file_close(&lfs, &file1) => 0;
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
@@ -2608,12 +2636,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_file_close(&lfs, &file1) => 0;
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
@@ -2700,12 +2730,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
lfsr_file_close(&lfs, &file1) => 0;
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
@@ -2784,13 +2816,15 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact, unless we're desynced
|
||||
// we should _not_ update lookahead/compact/etc, unless we're desynced
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((DESYNC) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!(LOOKAHEAD && DESYNC)) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!(CKMETA && DESYNC)) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!(CKDATA && DESYNC)) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
|
||||
@@ -2888,13 +2922,15 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact, unless we're desynced
|
||||
// we should _not_ update lookahead/compact/etc, unless we're desynced
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((DESYNC) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!(LOOKAHEAD && DESYNC)) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!(CKMETA && DESYNC)) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!(CKDATA && DESYNC)) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
|
||||
@@ -2985,13 +3021,15 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact, unless we're desynced
|
||||
// we should _not_ update lookahead/compact/etc, unless we're desynced
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((DESYNC) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!(LOOKAHEAD && DESYNC)) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!(CKMETA && DESYNC)) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!(CKDATA && DESYNC)) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
lfsr_file_close(&lfs, &file2) => 0;
|
||||
|
||||
@@ -3079,13 +3117,15 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact, unless we're desynced
|
||||
// we should _not_ update lookahead/compact/etc, unless we're desynced
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((DESYNC) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!(LOOKAHEAD && DESYNC)) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!(CKMETA && DESYNC)) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!(CKDATA && DESYNC)) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => LFS_ERR_NOENT;
|
||||
@@ -3176,12 +3216,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => LFS_ERR_NOENT;
|
||||
@@ -3272,12 +3314,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3376,12 +3420,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3491,12 +3537,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3606,12 +3654,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3708,12 +3758,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3804,12 +3856,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -3915,12 +3969,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4025,12 +4081,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4188,12 +4246,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4368,12 +4428,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4542,12 +4604,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4713,12 +4777,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -4891,12 +4957,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -5068,12 +5136,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -5256,12 +5326,14 @@ code = '''
|
||||
lfsr_traversal_read(&lfs, &t, &tinfo) => LFS_ERR_NOENT;
|
||||
lfsr_traversal_close(&lfs, &t) => 0;
|
||||
|
||||
// we should _not_ update lookahead/compact
|
||||
// we should _not_ update lookahead/compact/ckmeta/ckdata
|
||||
struct lfs_fsinfo fsinfo;
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check the file contents
|
||||
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
|
||||
@@ -5326,7 +5398,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -5352,7 +5426,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -5371,7 +5447,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -5449,7 +5527,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -5483,7 +5563,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -5504,7 +5586,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -5564,7 +5648,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -5592,7 +5678,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -5611,7 +5699,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the file
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -5696,7 +5786,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -5736,7 +5828,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -5756,7 +5850,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -5897,7 +5993,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -5944,7 +6042,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -5966,7 +6066,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6109,7 +6211,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing and compacting
|
||||
lfsr_traversal_t t;
|
||||
@@ -6161,7 +6265,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -6183,7 +6289,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6292,7 +6400,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -6340,7 +6450,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6410,7 +6522,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -6476,7 +6590,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS >= 3) ? LFS_I_INCONSISTENT : 0)
|
||||
| ((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6569,7 +6685,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -6631,7 +6749,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6722,7 +6842,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -6784,7 +6906,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -6878,7 +7002,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -6948,7 +7074,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -7040,7 +7168,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -7110,7 +7240,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD || ORPHANS > 0) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| ((!CKMETA || ORPHANS > 0) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA || ORPHANS > 0) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -7222,7 +7354,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS > 0) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -7275,7 +7409,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// running another traversal should clear the uncompacted flag
|
||||
lfsr_traversal_rewind(&lfs, &t) => 0;
|
||||
@@ -7295,7 +7431,9 @@ code = '''
|
||||
// uncompacted flag should have been cleared
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)));
|
||||
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0)
|
||||
| ((!CKMETA) ? LFS_I_CANCKMETA : 0)
|
||||
| ((!CKDATA) ? LFS_I_CANCKDATA : 0)));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
@@ -7388,7 +7526,9 @@ code = '''
|
||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||
assert(fsinfo.flags == (
|
||||
LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// try traversing with mkconsistent
|
||||
lfsr_traversal_t t;
|
||||
@@ -7459,7 +7599,9 @@ code = '''
|
||||
assert(fsinfo.flags == (
|
||||
((ORPHANS >= 3) ? LFS_I_INCONSISTENT : 0)
|
||||
| LFS_I_CANLOOKAHEAD
|
||||
| LFS_I_UNCOMPACTED));
|
||||
| LFS_I_UNCOMPACTED
|
||||
| LFS_I_CANCKMETA
|
||||
| LFS_I_CANCKDATA));
|
||||
|
||||
// check we can still read the files
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
|
||||
Reference in New Issue
Block a user