bmap: Simplified bmap configs, reduced to one LFS3_F_GBMAP flag

TLDR: This drops the idea of different bmap strategies/modes, and sorts
out most of the compile-time/runtime conditional bmap interactions.

---

Motivation: Benchmarking (at least up to the 32-bit word limit) has
shown the bmap will unlikely be a significant bottleneck, even on large
disks. The largest disks tend to be NAND, and NAND's ridiculous block
size limits pressure on block allocation.

There are still concerns for areas I haven't measured yet:

- SD/eMMC/FTL - Small blocks, so more pressure on block allocation. In
  theory the logical block size can be artificially increased, but this
  comes with a granularity tradeoff.

- I've only measured throughput, latency is a whole other story.

  However, users have reported lfs3_fs_gc is useful for mitigating this,
  so maybe latency is less of a concern now?

But while there may still be room for improvement via alternative bmap
strategies, the risk a concerning amount of complexity. Yes,
configuration gets more complicated, but the real issue is any bmap
strategies that try to track _deallocations_ (the original idea being
treediffing) risk falling leaking blocks if all cases aren't covered.

The current "bmap cache" strategy strikes a really nice balance where it
reduces _amortized_ block allocation -> ~O(log n) without RAM, while
retaining the safe, bug-resistant, single-source-of-truth properties
that come with lookahead-based allocation.

---

So, long story short, dropping other strategies, and now the presence of
the bmap is a boolean flag.

This is also the first format-specific flag:

- Define LFS3_BMAP to enable the bmap logic, but note by default the
  bmap will still not be used.

- Define LFS3_YES_BMAP to force the bmap to be used.

- With LFS3_BMAP, passing LFS3_F_GBMAP to lfs3_format will include the
  on-disk block-map.

- No flag is needed during mount, the presence of the bmap is determined
  by the on-disk wcompat flags (LFS3_WCOMPAT_GBMAP). This also prevents
  rw mounting if the bmap is not supported, but rdonly mounting is
  allowed.

- Users can check if the bmap is in use via lfs3_fs_stat, which reports
  LFS3_I_GBMAP in the flags field.

There's still some missing pieces, but these will be a bit more
involved:

- lfs3_fs_grow needs to be made bmap aware!

- We probably want something like lfs3_fs_mkgbmap and lfs3_fs_rmgbmap to
  allow converting between bmap backed/not-backed filesystem images.

Code changes minimal:

                code          stack          ctx
  before:      37172           2352          684
  after:       37172 (+0.0%)   2352 (+0.0%)  684 (+0.0%)

                code          stack          ctx
  bmap before: 38844           2456          800
  bmap after:  38852 (+0.0%)   2456 (+0.0%)  800 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-06 13:06:38 -05:00
parent 38cfa5cc5e
commit 9d322741ca
8 changed files with 374 additions and 449 deletions
+182 -232
View File
@@ -7513,66 +7513,14 @@ static inline bool lfs3_m_isckdatacksums(uint32_t flags) {
}
#endif
// format flags
#ifdef LFS3_BMAP
static inline bool lfs3_m_isbmapnone(uint32_t flags) {
static inline bool lfs3_f_isgbmap(uint32_t flags) {
(void)flags;
#if defined(LFS3_YES_BMAPNONE)
#ifdef LFS3_YES_BMAP
return true;
#elif defined(LFS3_YES_BMAPFAST) \
|| defined(LFS3_YES_BMAPSLOW) \
|| defined(LFS3_YES_BMAPCACHE) \
|| defined(LFS3_YES_BMAPNONE)
return false;
#else
return (flags & LFS3_M_BMAPMODE) == LFS3_M_BMAPNONE;
#endif
}
#endif
#ifdef LFS3_BMAP
static inline bool lfs3_m_isbmapcache(uint32_t flags) {
(void)flags;
#if defined(LFS3_YES_BMAPCACHE)
return true;
#elif defined(LFS3_YES_BMAPFAST) \
|| defined(LFS3_YES_BMAPSLOW) \
|| defined(LFS3_YES_BMAPCACHE) \
|| defined(LFS3_YES_BMAPNONE)
return false;
#else
return (flags & LFS3_M_BMAPMODE) == LFS3_M_BMAPCACHE;
#endif
}
#endif
#ifdef LFS3_BMAP
static inline bool lfs3_m_isbmapslow(uint32_t flags) {
(void)flags;
#if defined(LFS3_YES_BMAPSLOW)
return true;
#elif defined(LFS3_YES_BMAPFAST) \
|| defined(LFS3_YES_BMAPSLOW) \
|| defined(LFS3_YES_BMAPCACHE) \
|| defined(LFS3_YES_BMAPNONE)
return false;
#else
return (flags & LFS3_M_BMAPMODE) == LFS3_M_BMAPSLOW;
#endif
}
#endif
#ifdef LFS3_BMAP
static inline bool lfs3_m_isbmapfast(uint32_t flags) {
(void)flags;
#if defined(LFS3_YES_BMAPFAST)
return true;
#elif defined(LFS3_YES_BMAPFAST) \
|| defined(LFS3_YES_BMAPSLOW) \
|| defined(LFS3_YES_BMAPCACHE) \
|| defined(LFS3_YES_BMAPNONE)
return false;
#else
return (flags & LFS3_M_BMAPMODE) == LFS3_M_BMAPFAST;
return flags & LFS3_F_GBMAP;
#endif
}
#endif
@@ -7585,8 +7533,8 @@ static inline bool lfs3_i_isinmtree(uint32_t flags) {
#endif
#ifdef LFS3_REVDBG
static inline bool lfs3_i_isinbmap(uint32_t flags) {
return (flags & LFS3_i_INMODE) == LFS3_i_INBMAP;
static inline bool lfs3_i_isingbmap(uint32_t flags) {
return (flags & LFS3_i_INMODE) == LFS3_i_INGBMAP;
}
#endif
@@ -7798,6 +7746,9 @@ static void lfs3_fs_flushgdelta(lfs3_t *lfs3) {
lfs3_memset(lfs3->grm_d, 0, LFS3_GRM_DSIZE);
// zero the gbmapdelta
//
// note we do this unconditionally! before figuring out if littlefs
// actually configured to use the gbmap
#ifdef LFS3_BMAP
lfs3_memset(lfs3->gbmap_d, 0, LFS3_GBMAP_DSIZE);
#endif
@@ -7814,7 +7765,9 @@ static void lfs3_fs_commitgdelta(lfs3_t *lfs3) {
// keep track of the on-disk gbmap
#ifdef LFS3_BMAP
lfs3_data_fromgbmap(&lfs3->gbmap, lfs3->gbmap_p);
if (lfs3_f_isgbmap(lfs3->flags)) {
lfs3_data_fromgbmap(&lfs3->gbmap, lfs3->gbmap_p);
}
#endif
}
#endif
@@ -7835,11 +7788,13 @@ static void lfs3_fs_revertgdelta(lfs3_t *lfs3) {
// revert to the on-disk gbmap
#ifdef LFS3_BMAP
err = lfs3_data_readgbmap(lfs3,
&LFS3_DATA_BUF(lfs3->gbmap_p, LFS3_GBMAP_DSIZE),
&lfs3->gbmap);
if (err) {
LFS3_UNREACHABLE();
if (lfs3_f_isgbmap(lfs3->flags)) {
err = lfs3_data_readgbmap(lfs3,
&LFS3_DATA_BUF(lfs3->gbmap_p, LFS3_GBMAP_DSIZE),
&lfs3->gbmap);
if (err) {
LFS3_UNREACHABLE();
}
}
#endif
}
@@ -7893,48 +7848,51 @@ static int lfs3_rbyd_appendgdelta(lfs3_t *lfs3, lfs3_rbyd_t *rbyd) {
// pending gbmap state?
#ifdef LFS3_BMAP
// TODO is this the right place?
// try to update to most recent lookahead window
lfs3->gbmap.window = (lfs3->lookahead.window + lfs3->lookahead.off)
% lfs3->cfg->block_count;
lfs3->gbmap.known = lfs3->lookahead.bmapped;
if (lfs3_f_isgbmap(lfs3->flags)) {
// TODO is this the right place?
// try to update to most recent lookahead window
lfs3->gbmap.window = (lfs3->lookahead.window + lfs3->lookahead.off)
% lfs3->cfg->block_count;
lfs3->gbmap.known = lfs3->lookahead.bmapped;
uint8_t gbmapdelta_[LFS3_GBMAP_DSIZE];
lfs3_data_fromgbmap(&lfs3->gbmap, gbmapdelta_);
lfs3_memxor(gbmapdelta_, lfs3->gbmap_p, LFS3_GBMAP_DSIZE);
lfs3_memxor(gbmapdelta_, lfs3->gbmap_d, LFS3_GBMAP_DSIZE);
uint8_t gbmapdelta_[LFS3_GBMAP_DSIZE];
lfs3_data_fromgbmap(&lfs3->gbmap, gbmapdelta_);
lfs3_memxor(gbmapdelta_, lfs3->gbmap_p, LFS3_GBMAP_DSIZE);
lfs3_memxor(gbmapdelta_, lfs3->gbmap_d, LFS3_GBMAP_DSIZE);
if (lfs3_memlen(gbmapdelta_, LFS3_GBMAP_DSIZE) != 0) {
// make sure to xor any existing delta
lfs3_data_t data;
lfs3_stag_t tag = lfs3_rbyd_lookup(lfs3, rbyd, -1, LFS3_TAG_GBMAPDELTA,
&data);
if (tag < 0 && tag != LFS3_ERR_NOENT) {
return tag;
}
uint8_t gbmapdelta[LFS3_GBMAP_DSIZE];
lfs3_memset(gbmapdelta, 0, LFS3_GBMAP_DSIZE);
if (tag != LFS3_ERR_NOENT) {
lfs3_ssize_t d = lfs3_data_read(lfs3, &data,
gbmapdelta, LFS3_GBMAP_DSIZE);
if (d < 0) {
return d;
if (lfs3_memlen(gbmapdelta_, LFS3_GBMAP_DSIZE) != 0) {
// make sure to xor any existing delta
lfs3_data_t data;
lfs3_stag_t tag = lfs3_rbyd_lookup(lfs3, rbyd,
-1, LFS3_TAG_GBMAPDELTA,
&data);
if (tag < 0 && tag != LFS3_ERR_NOENT) {
return tag;
}
}
lfs3_memxor(gbmapdelta_, gbmapdelta, LFS3_GBMAP_DSIZE);
uint8_t gbmapdelta[LFS3_GBMAP_DSIZE];
lfs3_memset(gbmapdelta, 0, LFS3_GBMAP_DSIZE);
if (tag != LFS3_ERR_NOENT) {
lfs3_ssize_t d = lfs3_data_read(lfs3, &data,
gbmapdelta, LFS3_GBMAP_DSIZE);
if (d < 0) {
return d;
}
}
// append to our rbyd, replacing any existing delta
lfs3_size_t size = lfs3_memlen(gbmapdelta_, LFS3_GBMAP_DSIZE);
int err = lfs3_rbyd_appendrattr(lfs3, rbyd, -1, LFS3_RATTR_BUF(
// opportunistically remove this tag if delta is all zero
(size == 0)
? LFS3_TAG_RM | LFS3_TAG_GBMAPDELTA
: LFS3_TAG_GBMAPDELTA, 0,
gbmapdelta_, size));
if (err) {
return err;
lfs3_memxor(gbmapdelta_, gbmapdelta, LFS3_GBMAP_DSIZE);
// append to our rbyd, replacing any existing delta
lfs3_size_t size = lfs3_memlen(gbmapdelta_, LFS3_GBMAP_DSIZE);
int err = lfs3_rbyd_appendrattr(lfs3, rbyd, -1, LFS3_RATTR_BUF(
// opportunistically remove this tag if delta is all zero
(size == 0)
? LFS3_TAG_RM | LFS3_TAG_GBMAPDELTA
: LFS3_TAG_GBMAPDELTA, 0,
gbmapdelta_, size));
if (err) {
return err;
}
}
}
#endif
@@ -7967,6 +7925,9 @@ static int lfs3_fs_consumegdelta(lfs3_t *lfs3, const lfs3_mdir_t *mdir) {
}
// consume any gbmap deltas
//
// note we do this unconditionally! before figuring out if littlefs
// actually configured to use the gbmap
#ifdef LFS3_BMAP
tag = lfs3_rbyd_lookup(lfs3, &mdir->r, -1, LFS3_TAG_GBMAPDELTA,
&data);
@@ -10260,17 +10221,21 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
if (err) {
// end of mtree?
if (err == LFS3_ERR_NOENT) {
#ifdef LFS3_BMAP
// transition to traversing the bmap if there is one
trv->b.shrub = lfs3->gbmap.b;
trv->bid = -2;
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_BMAP);
continue;
#else
// guess we're done
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_DONE);
continue;
#endif
if (LFS3_IFDEF_BMAP(
lfs3_f_isgbmap(lfs3->flags),
false)) {
#ifdef LFS3_BMAP
// transition to traversing the bmap if there is one
trv->b.shrub = lfs3->gbmap.b;
trv->bid = -2;
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_BMAP);
continue;
#endif
} else {
// guess we're done
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_DONE);
continue;
}
}
return err;
}
@@ -10403,8 +10368,9 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
// we need to include this in case the bmap is rebuilt
// multiple times before an mdir commit
} else if (LFS3_IFDEF_BMAP(
lfs3_t_tstate(trv->b.h.flags)
== LFS3_TSTATE_BMAP,
lfs3_f_isgbmap(lfs3->flags)
&& lfs3_t_tstate(trv->b.h.flags)
== LFS3_TSTATE_BMAP,
false)) {
#ifdef LFS3_BMAP
// decode the on-disk gbmap
@@ -10439,8 +10405,9 @@ static lfs3_stag_t lfs3_mtree_traverse_(lfs3_t *lfs3, lfs3_trv_t *trv,
#endif
// end of on-disk bmap? guess we're done
} else if (LFS3_IFDEF_BMAP(
lfs3_t_tstate(trv->b.h.flags)
== LFS3_TSTATE_BMAP_P,
lfs3_f_isgbmap(lfs3->flags)
&& lfs3_t_tstate(trv->b.h.flags)
== LFS3_TSTATE_BMAP_P,
false)) {
#ifdef LFS3_BMAP
lfs3_t_settstate(&trv->b.h.flags, LFS3_TSTATE_DONE);
@@ -11008,11 +10975,13 @@ static inline int lfs3_alloc_ckpoint(lfs3_t *lfs3) {
#ifndef LFS3_2BONLY
// checkpoint the allocator
lfs3->lookahead.ckpoint = lfs3->block_count;
#ifdef LFS3_BMAP
// do we need to rebuild the bmap?
if (lfs3->lookahead.bmapped < lfs3_min(
lfs3->cfg->bmap_scan_thresh,
lfs3->block_count)) {
if (lfs3_f_isgbmap(lfs3->flags)
&& lfs3->lookahead.bmapped < lfs3_min(
lfs3->cfg->bmap_scan_thresh,
lfs3->block_count)) {
int err = lfs3_alloc_rebuildbmap(lfs3);
if (err) {
return err;
@@ -11022,6 +10991,7 @@ static inline int lfs3_alloc_ckpoint(lfs3_t *lfs3) {
lfs3->lookahead.ckpoint = lfs3->block_count;
}
#endif
return 0;
#else
(void)lfs3;
@@ -11252,8 +11222,9 @@ static lfs3_sblock_t lfs3_alloc(lfs3_t *lfs3, uint32_t flags) {
// no blocks in our lookahead buffer?
// known blocks in our bmap?
#ifdef LFS3_YES_BMAPCACHE
if (lfs3->lookahead.bmapped > 0) {
#ifdef LFS3_BMAP
if (lfs3_f_isgbmap(lfs3->flags)
&& lfs3->lookahead.bmapped > 0) {
int err = lfs3_alloc_markbmap(lfs3, &lfs3->gbmap.b, lfs3_min(
lfs3->lookahead.bmapped,
lfs3->lookahead.ckpoint));
@@ -15418,7 +15389,7 @@ static int lfs3_init(lfs3_t *lfs3, uint32_t flags,
| LFS3_IFDEF_CKFETCHES(LFS3_M_CKFETCHES, 0)
| LFS3_IFDEF_CKMETAPARITY(LFS3_M_CKMETAPARITY, 0)
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)
| LFS3_IFDEF_BMAP(LFS3_M_BMAPMODE, 0))) == 0);
| LFS3_IFDEF_BMAP(LFS3_F_GBMAP, 0))) == 0);
// LFS3_M_REVDBG and LFS3_M_REVNOISE are incompatible
#if defined(LFS3_REVNOISE) && defined(LFS3_REVDBG)
LFS3_ASSERT(!lfs3_m_isrevdbg(flags) || !lfs3_m_isrevnoise(flags));
@@ -15796,70 +15767,48 @@ static int lfs3_deinit(lfs3_t *lfs3) {
// internal
#define LFS3_rcompat_OVERFLOW 0x80000000 // Can't represent all flags
#define LFS3_RCOMPAT_COMPAT \
(LFS3_RCOMPAT_BSHRUB \
| LFS3_RCOMPAT_BTREE \
| LFS3_RCOMPAT_MMOSS \
| LFS3_RCOMPAT_MTREE \
| LFS3_RCOMPAT_GRM)
#define LFS3_WCOMPAT_NONSTANDARD 0x00000001 // Non-standard filesystem format
#define LFS3_WCOMPAT_RDONLY 0x00000002 // Writing is disallowed
#define LFS3_WCOMPAT_DIR 0x00000010 // Directory files in use
#define LFS3_WCOMPAT_GCKSUM 0x00001000 // Global-checksum in use
#define LFS3_WCOMPAT_GBMAP 0x00006000 // Global block-map in use
#define LFS3_WCOMPAT_GBMAPNONE 0x00000000 // Gbmap not in use
#define LFS3_WCOMPAT_GBMAPCACHE 0x00002000 // Gbmap in cache mode
#define LFS3_WCOMPAT_GBMAPVFR 0x00004000 // Gbmap in VFR mode
#define LFS3_WCOMPAT_GBMAPIFR 0x00006000 // Gbmap in IFR mode
#define LFS3_WCOMPAT_GBMAP 0x00002000 // Global on-disk block-map in use
// internal
#define LFS3_wcompat_OVERFLOW 0x80000000 // Can't represent all flags
// TODO this should really be calculated at runtime, we should allow no
// gbmap when bmap mode == LFS3_M_BMAPNONE even when compiling with
// LFS3_BMAP
#if defined(LFS3_YES_BMAPCACHE)
#define LFS3_WCOMPAT_COMPAT \
(LFS3_WCOMPAT_DIR \
| LFS3_WCOMPAT_GCKSUM \
| LFS3_WCOMPAT_GBMAPCACHE)
#elif defined(LFS3_YES_BMAPVFR)
#define LFS3_WCOMPAT_COMPAT \
(LFS3_WCOMPAT_DIR \
| LFS3_WCOMPAT_GCKSUM \
| LFS3_WCOMPAT_GBMAPVFR)
#elif defined(LFS3_YES_BMAPIFR)
#define LFS3_WCOMPAT_COMPAT \
(LFS3_WCOMPAT_DIR \
| LFS3_WCOMPAT_GCKSUM \
| LFS3_WCOMPAT_GBMAPIFR)
#else
#define LFS3_WCOMPAT_COMPAT \
(LFS3_WCOMPAT_DIR \
| LFS3_WCOMPAT_GCKSUM)
#endif
#define LFS3_OCOMPAT_NONSTANDARD 0x00000001 // Non-standard filesystem format
// internal
#define LFS3_ocompat_OVERFLOW 0x80000000 // Can't represent all flags
#define LFS3_OCOMPAT_COMPAT 0
typedef uint32_t lfs3_rcompat_t;
typedef uint32_t lfs3_wcompat_t;
typedef uint32_t lfs3_ocompat_t;
static inline bool lfs3_rcompat_isincompat(lfs3_rcompat_t rcompat) {
return rcompat != LFS3_RCOMPAT_COMPAT;
static inline bool lfs3_wcompat_isgbmap(lfs3_wcompat_t flags) {
return flags & LFS3_WCOMPAT_GBMAP;
}
static inline bool lfs3_wcompat_isincompat(lfs3_wcompat_t wcompat) {
return wcompat != LFS3_WCOMPAT_COMPAT;
// figure out what compat flags the current fs configuration needs
static inline lfs3_rcompat_t lfs3_rcompat(const lfs3_t *lfs3) {
(void)lfs3;
return LFS3_RCOMPAT_BSHRUB
| LFS3_RCOMPAT_BTREE
| LFS3_RCOMPAT_MMOSS
| LFS3_RCOMPAT_MTREE
| LFS3_RCOMPAT_GRM;
}
static inline bool lfs3_ocompat_isincompat(lfs3_ocompat_t ocompat) {
return ocompat != LFS3_OCOMPAT_COMPAT;
static inline lfs3_wcompat_t lfs3_wcompat(const lfs3_t *lfs3) {
(void)lfs3;
return LFS3_WCOMPAT_DIR
| LFS3_WCOMPAT_GCKSUM
| LFS3_IFDEF_BMAP(
(lfs3_f_isgbmap(lfs3->flags)) ? LFS3_WCOMPAT_GBMAP : 0,
0);
}
static inline lfs3_ocompat_t lfs3_ocompat(const lfs3_t *lfs3) {
(void)lfs3;
return 0;
}
// compat flags on-disk encoding
@@ -15989,51 +15938,63 @@ static int lfs3_mountmroot(lfs3_t *lfs3, const lfs3_mdir_t *mroot) {
// check for any rcompatflags, we must understand these to read
// the filesystem
lfs3_rcompat_t rcompat = 0;
lfs3_rcompat_t rcompat = lfs3_rcompat(lfs3);
lfs3_rcompat_t rcompat_ = 0;
tag = lfs3_mdir_lookup(lfs3, mroot, LFS3_TAG_RCOMPAT,
&data);
if (tag < 0 && tag != LFS3_ERR_NOENT) {
return tag;
}
if (tag != LFS3_ERR_NOENT) {
int err = lfs3_data_readrcompat(lfs3, &data, &rcompat);
int err = lfs3_data_readrcompat(lfs3, &data, &rcompat_);
if (err) {
return err;
}
}
if (lfs3_rcompat_isincompat(rcompat)) {
if (rcompat_ != rcompat) {
LFS3_ERROR("Incompatible rcompat flags 0x%0"PRIx32" (!= 0x%0"PRIx32")",
rcompat,
LFS3_RCOMPAT_COMPAT);
rcompat_,
rcompat);
return LFS3_ERR_NOTSUP;
}
// check for any wcompatflags, we must understand these to write
// the filesystem
#ifndef LFS3_RDONLY
lfs3_wcompat_t wcompat = 0;
lfs3_wcompat_t wcompat = lfs3_wcompat(lfs3);
lfs3_wcompat_t wcompat_ = 0;
tag = lfs3_mdir_lookup(lfs3, mroot, LFS3_TAG_WCOMPAT,
&data);
if (tag < 0 && tag != LFS3_ERR_NOENT) {
return tag;
}
if (tag != LFS3_ERR_NOENT) {
int err = lfs3_data_readwcompat(lfs3, &data, &wcompat);
int err = lfs3_data_readwcompat(lfs3, &data, &wcompat_);
if (err) {
return err;
}
}
if (lfs3_wcompat_isincompat(wcompat)) {
LFS3_WARN("Incompatible wcompat flags 0x%0"PRIx32" (!= 0x%0"PRIx32")",
// optional wcompat flags
lfs3_wcompat_t wmask = ~(
LFS3_IFDEF_BMAP(LFS3_IFDEF_YES_BMAP(0, LFS3_WCOMPAT_GBMAP), 0));
if ((wcompat_ & wmask) != (wcompat & wmask)) {
LFS3_WARN("Incompatible wcompat flags 0x%0"PRIx32" "
"(!= 0x%0"PRIx32" & ~0x%0"PRIx32")",
wcompat_,
wcompat,
LFS3_WCOMPAT_COMPAT);
// we can continue if rdonly
~wmask);
// we can ignore this if rdonly
if (!lfs3_m_isrdonly(lfs3->flags)) {
return LFS3_ERR_NOTSUP;
}
}
#ifdef LFS3_BMAP
// using the gbmap?
if (lfs3_wcompat_isgbmap(wcompat_)) {
lfs3->flags |= LFS3_I_GBMAP;
}
#endif
// we don't bother to check for any ocompatflags, we would just
@@ -16317,29 +16278,33 @@ static int lfs3_mountinited(lfs3_t *lfs3) {
}
#if !defined(LFS3_RDONLY) && !defined(LFS3_2BONLY)
#ifdef LFS3_BMAP
// decode the global block-map
err = lfs3_data_readgbmap(lfs3,
&LFS3_DATA_BUF(lfs3->gbmap_d, LFS3_GBMAP_DSIZE),
&lfs3->gbmap);
if (err) {
// TODO switch to read-only?
return err;
}
if (LFS3_IFDEF_BMAP(
lfs3_f_isgbmap(lfs3->flags),
false)) {
#ifdef LFS3_BMAP
// decode the global block-map
err = lfs3_data_readgbmap(lfs3,
&LFS3_DATA_BUF(lfs3->gbmap_d, LFS3_GBMAP_DSIZE),
&lfs3->gbmap);
if (err) {
// TODO switch to read-only?
return err;
}
// if we have a bmap, position our lookahead buffer at the last
// known bmap window
lfs3->lookahead.window = lfs3->gbmap.window;
lfs3->lookahead.bmapped = lfs3->gbmap.known;
#else
// if we _don't_ have a bmap, position our lookahead buffer
// pseudo-randomly using our gcksum as a prng
//
// the purpose of this is to avoid bad wear patterns such as always
// allocating blocks near the beginning of disk after a power-loss
//
lfs3->lookahead.window = lfs3->gcksum % lfs3->block_count;
#endif
// if we have a bmap, position our lookahead buffer at the last
// known bmap window
lfs3->lookahead.window = lfs3->gbmap.window;
lfs3->lookahead.bmapped = lfs3->gbmap.known;
#endif
} else {
// if we _don't_ have a bmap, position our lookahead buffer
// pseudo-randomly using our gcksum as a prng
//
// the purpose of this is to avoid bad wear patterns such as always
// allocating blocks near the beginning of disk after a power-loss
//
lfs3->lookahead.window = lfs3->gcksum % lfs3->block_count;
}
#endif
return 0;
@@ -16393,13 +16358,6 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
#ifdef LFS3_YES_CKDATA
flags |= LFS3_M_CKDATA
#endif
#if defined(LFS3_YES_BMAPCACHE)
flags = (flags & ~LFS3_M_BMAPMODE) | LFS3_M_BMAPCACHE;
#elif defined(LFS3_YES_BMAPVFR)
flags = (flags & ~LFS3_M_BMAPMODE) | LFS3_M_BMAPVFR;
#elif defined(LFS3_YES_BMAPIFR)
flags = (flags & ~LFS3_M_BMAPMODE) | LFS3_M_BMAPIFR;
#endif
// unknown flags?
LFS3_ASSERT((flags & ~(
@@ -16417,8 +16375,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
| LFS3_IFDEF_RDONLY(0, LFS3_M_LOOKAHEAD)
| LFS3_IFDEF_RDONLY(0, LFS3_M_COMPACT)
| LFS3_M_CKMETA
| LFS3_M_CKDATA
| LFS3_IFDEF_BMAP(LFS3_M_BMAPMODE, 0))) == 0);
| LFS3_M_CKDATA)) == 0);
// these flags require a writable filesystem
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_ismkconsistent(flags));
LFS3_ASSERT(!lfs3_m_isrdonly(flags) || !lfs3_t_islookahead(flags));
@@ -16435,8 +16392,7 @@ int lfs3_mount(lfs3_t *lfs3, uint32_t flags,
| LFS3_IFDEF_CKPROGS(LFS3_M_CKPROGS, 0)
| LFS3_IFDEF_CKFETCHES(LFS3_M_CKFETCHES, 0)
| LFS3_IFDEF_CKMETAPARITY(LFS3_M_CKMETAPARITY, 0)
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)
| LFS3_IFDEF_BMAP(LFS3_M_BMAPMODE, 0)),
| LFS3_IFDEF_CKDATACKSUMS(LFS3_M_CKDATACKSUMS, 0)),
cfg);
if (err) {
return err;
@@ -16567,9 +16523,11 @@ static int lfs3_formatinited(lfs3_t *lfs3) {
int err;
// create an initial bmap
#ifdef LFS3_BMAP
err = lfs3_formatbmap(lfs3);
if (err) {
return err;
if (lfs3_f_isgbmap(lfs3->flags)) {
err = lfs3_formatbmap(lfs3);
if (err) {
return err;
}
}
#endif
@@ -16606,9 +16564,7 @@ static int lfs3_formatinited(lfs3_t *lfs3) {
// warning free... alternatives? switch to builder pattern?
#ifdef LFS3_BMAP
#define LFS3_RATTR_IFDEF_BMAP \
(lfs3_m_isbmapfast(lfs3->flags) \
|| lfs3_m_isbmapslow(lfs3->flags) \
|| lfs3_m_isbmapcache(lfs3->flags)) \
(lfs3_f_isgbmap(lfs3->flags)) \
? LFS3_RATTR_DATA(LFS3_TAG_GBMAPDELTA, 0, \
(&((struct {lfs3_data_t d;}){ \
lfs3_data_fromgbmap(&lfs3->gbmap, \
@@ -16633,10 +16589,10 @@ static int lfs3_formatinited(lfs3_t *lfs3) {
LFS3_DISK_VERSION_MINOR}), 2),
LFS3_RATTR_LE32(
LFS3_TAG_RCOMPAT, 0,
LFS3_RCOMPAT_COMPAT),
lfs3_rcompat(lfs3)),
LFS3_RATTR_LE32(
LFS3_TAG_WCOMPAT, 0,
LFS3_WCOMPAT_COMPAT),
lfs3_wcompat(lfs3)),
LFS3_RATTR_GEOMETRY(
LFS3_TAG_GEOMETRY, 0,
(&(lfs3_geometry_t){
@@ -16706,16 +16662,10 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
flags |= LFS3_F_CKMETA;
#endif
#ifdef LFS3_YES_CKDATA
flags |= LFS3_F_CKDATA
flags |= LFS3_F_CKDATA;
#endif
#if defined(LFS3_YES_BMAPFAST)
flags = (flags & ~LFS3_F_BMAPMODE) | LFS3_F_BMAPFAST;
#elif defined(LFS3_YES_BMAPSLOW)
flags = (flags & ~LFS3_F_BMAPMODE) | LFS3_F_BMAPSLOW;
#elif defined(LFS3_YES_BMAPCACHE)
flags = (flags & ~LFS3_F_BMAPMODE) | LFS3_F_BMAPCACHE;
#elif defined(LFS3_YES_BMAPNONE)
flags = (flags & ~LFS3_F_BMAPMODE) | LFS3_F_BMAPNONE;
#ifdef LFS3_YES_BMAP
flags |= LFS3_F_GBMAP;
#endif
// unknown flags?
@@ -16729,7 +16679,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
| LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, 0)
| LFS3_F_CKMETA
| LFS3_F_CKDATA
| LFS3_IFDEF_BMAP(LFS3_F_BMAPMODE, 0))) == 0);
| LFS3_IFDEF_BMAP(LFS3_F_GBMAP, 0))) == 0);
int err = lfs3_init(lfs3,
flags & (
@@ -16740,7 +16690,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags,
| LFS3_IFDEF_CKFETCHES(LFS3_F_CKFETCHES, 0)
| LFS3_IFDEF_CKMETAPARITY(LFS3_F_CKMETAPARITY, 0)
| LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, 0)
| LFS3_IFDEF_BMAP(LFS3_F_BMAPMODE, 0)),
| LFS3_IFDEF_BMAP(LFS3_F_GBMAP, 0)),
cfg);
if (err) {
return err;
@@ -16808,7 +16758,7 @@ int lfs3_fs_stat(lfs3_t *lfs3, struct lfs3_fsinfo *fsinfo) {
| LFS3_IFDEF_RDONLY(0, LFS3_I_COMPACT)
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPMODE, 0));
| LFS3_IFDEF_BMAP(LFS3_I_GBMAP, 0));
// some flags we calculate on demand
#ifndef LFS3_RDONLY
fsinfo->flags |= (lfs3_grm_count(lfs3) > 0) ? LFS3_I_MKCONSISTENT : 0;
+4 -23
View File
@@ -194,12 +194,7 @@ enum lfs3_type {
#define LFS3_F_CKDATA 0x00002000 // Check metadata + data checksums
#ifdef LFS3_BMAP
#define LFS3_F_BMAPMODE 0x03000000 // On-disk block-map mode
#define LFS3_F_BMAPNONE 0x00000000 // Don't use the bmap
#define LFS3_F_BMAPCACHE \
0x01000000 // Use the bmap to cache lookahead scans
#define LFS3_F_BMAPVFR 0x02000000 // Use the bmap in VFR mode
#define LFS3_F_BMAPIFR 0x03000000 // Use the bmap in IFR mode
#define LFS3_F_GBMAP 0x01000000 // Use the global on-disk block-map
#endif
#endif
@@ -247,15 +242,6 @@ enum lfs3_type {
#define LFS3_M_CKMETA 0x00001000 // Check metadata checksums
#define LFS3_M_CKDATA 0x00002000 // Check metadata + data checksums
#ifdef LFS3_BMAP
#define LFS3_M_BMAPMODE 0x03000000 // On-disk block map mode
#define LFS3_M_BMAPNONE 0x00000000 // Don't use bmap
#define LFS3_M_BMAPCACHE \
0x01000000 // Use the bmap to cache lookahead scans
#define LFS3_M_BMAPVFR 0x02000000 // Use the bmap in VFR mode
#define LFS3_M_BMAPIFR 0x03000000 // Use the bmap in IFR mode
#endif
// Filesystem info flags
#define LFS3_I_RDONLY 0x00000001 // Mounted read only
@@ -298,19 +284,14 @@ enum lfs3_type {
#define LFS3_I_CKDATA 0x00002000 // Data checksums not checked recently
#ifdef LFS3_BMAP
#define LFS3_I_BMAPMODE 0x03000000 // On-disk block map mode
#define LFS3_I_BMAPNONE 0x00000000 // Mounted with LFS3_M_BMAPNONE
#define LFS3_I_BMAPCACHE \
0x01000000 // Mounted with LFS3_M_BMAPCACHE
#define LFS3_I_BMAPVFR 0x02000000 // Mounted with LFS3_M_BMAPVFR
#define LFS3_I_BMAPIFR 0x03000000 // Mounted with LFS3_M_BMAPIFR
#define LFS3_I_GBMAP 0x01000000 // Global on-disk block-map in use
#endif
// internally used flags, don't use these
#ifdef LFS3_REVDBG
#define LFS3_i_INMODE 0x00030000
#define LFS3_i_INMODE 0x00030000 // Btree commit mode
#define LFS3_i_INMTREE 0x00010000 // Committing to mtree
#define LFS3_i_INBMAP 0x00020000 // Committing to bmap
#define LFS3_i_INGBMAP 0x00020000 // Committing to gbmap
#endif
+10 -23
View File
@@ -47,10 +47,9 @@
#ifndef LFS3_GC
#define LFS3_GC
#endif
// TODO how interact with bmap?
// #ifndef LFS3_BMAP
// #define LFS3_BMAP
// #endif
#ifndef LFS3_BMAP
#define LFS3_BMAP
#endif
#endif
// LFS3_YES_* variants imply the relevant LFS3_* macro
@@ -88,25 +87,6 @@
#define LFS3_BMAP
#endif
// LFS3_BMAP mappings
//
// TODO eventually allow runtime flags
//
// LFS3_YES_BMAP* => LFS3_BMAP
#if defined(LFS3_YES_BMAPCACHE) \
|| defined(LFS3_YES_BMAPVFR) \
|| defined(LFS3_YES_BMAPIFR)
#define LFS3_BMAP
#endif
// TODO figure out the best default bmap mode
// if LFS3_BMAP but no algorithm defined, default to LFS3_YES_BMAPCACHE
#if defined(LFS3_BMAP) \
&& !defined(LFS3_BMAPCACHE) \
&& !defined(LFS3_BMAPVFR) \
&& !defined(LFS3_BMAPIFR)
#define LFS3_YES_BMAPCACHE
#endif
// LFS3_NO_LOG disables all logging macros
#ifdef LFS3_NO_LOG
#ifndef LFS3_NO_DEBUG
@@ -289,6 +269,13 @@
#define LFS3_IFDEF_BMAP(a, b) (b)
#endif
// TODO other LFS3_IFDEF_YES_* macros?
#ifdef LFS3_YES_BMAP
#define LFS3_IFDEF_YES_BMAP(a, b) (a)
#else
#define LFS3_IFDEF_YES_BMAP(a, b) (b)
#endif
// Some function attributes, no way around these
+5 -23
View File
@@ -73,11 +73,7 @@ FLAGS = [
('F_CKMETA', 0x00001000, "Check metadata checksums" ),
('F_CKDATA', 0x00002000, "Check metadata + data checksums" ),
('F_BMAPMODE', 0x03000000, "On-disk block-map mode" ),
('^_BMAPNONE', 0x00000000, "Don't use the bmap" ),
('^_BMAPCACHE', 0x01000000, "Use the bmap to cache lookahead scans" ),
('^_BMAPVFR', 0x02000000, "Use the bmap in VFR mode" ),
('^_BMAPIFR', 0x03000000, "Use the bmap in IFR mode" ),
('F_GBMAP', 0x01000000, "Use the global on-disk block-map" ),
# Filesystem mount flags
('M_MODE', 1, "Mount's access mode" ),
@@ -98,12 +94,6 @@ FLAGS = [
('M_CKMETA', 0x00001000, "Check metadata checksums" ),
('M_CKDATA', 0x00002000, "Check metadata + data checksums" ),
('M_BMAPMODE', 0x03000000, "On-disk block-map mode" ),
('^_BMAPNONE', 0x00000000, "Don't use the bmap" ),
('^_BMAPCACHE', 0x01000000, "Use the bmap to cache lookahead scans" ),
('^_BMAPVFR', 0x02000000, "Use the bmap in VFR mode" ),
('^_BMAPIFR', 0x03000000, "Use the bmap in IFR mode" ),
# GC flags
('GC_MKCONSISTENT',0x00000100, "Make the filesystem consistent" ),
('GC_LOOKAHEAD', 0x00000200, "Populate lookahead buffer" ),
@@ -128,15 +118,11 @@ FLAGS = [
('I_CKMETA', 0x00001000, "Metadata checksums not checked recently" ),
('I_CKDATA', 0x00002000, "Data checksums not checked recently" ),
('I_BMAPMODE', 0x03000000, "On-disk block-map mode" ),
('^_BMAPNONE', 0x00000000, "Mounted with LFS3_M_BMAPNONE" ),
('^_BMAPCACHE', 0x01000000, "Mounted with LFS3_M_BMAPCACHE" ),
('^_BMAPVFR', 0x02000000, "Mounted with LFS3_M_BMAPVFR" ),
('^_BMAPIFR', 0x03000000, "Mounted with LFS3_M_BMAPIFR" ),
('I_GBMAP', 0x01000000, "Global on-disk block-map in use" ),
('i_INMTREE', 0x00030000, "Committing to mtree" ),
('i_INMODE', 0x00030000, "Btree commit mode" ),
('^_INMTREE', 0x00010000, "Committing to mtree" ),
('^_INBMAP', 0x00020000, "Committing to bmap" ),
('^_INGBMAP', 0x00020000, "Committing to gbmap" ),
# Traversal flags
('T_MODE', 1, "The traversal's access mode" ),
@@ -203,11 +189,7 @@ FLAGS = [
('WCOMPAT_RDONLY', 0x00000002, "Writing is disallowed" ),
('WCOMPAT_DIR', 0x00000010, "Directory file types in use" ),
('WCOMPAT_GCKSUM', 0x00001000, "Global-checksum in use" ),
('WCOMPAT_GBMAP', 0x00006000, "Global block-map in use" ),
('^_GBMAPNONE', 0x00000000, "Gbmap not in use" ),
('^_GBMAPCACHE', 0x00002000, "Gbmap in cache mode" ),
('^_GBMAPVFR', 0x00004000, "Gbmap in VFR mode" ),
('^_GBMAPIFR', 0x00006000, "Gbmap in IFR mode" ),
('WCOMPAT_GBMAP', 0x00002000, "Global on-disk block-map in use" ),
('wcompat_OVERFLOW',
0x80000000, "Can't represent all flags" ),
+9
View File
@@ -1,7 +1,16 @@
# Test some low-level block-map operations
#
# Note these is very much not-exhaustive, but the entire test suite can
# be run with the gbmap if you define LFS3_YES_BMAP:
#
# LFS3_YES_BMAP=1 make test -j
#
after = ['test_btree', 'test_mtree']
ifdef = 'LFS3_BMAP'
# test bmap operations
# test simple set operations
[cases.test_bmap_set_split]
in = 'lfs3.c'
+6 -6
View File
@@ -1459,7 +1459,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// run gc
if (AFTER == 0) {
@@ -1575,7 +1575,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -1650,7 +1650,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// run gc
if (AFTER == 0) {
@@ -1766,7 +1766,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// test that we can reset flags with lfs3_fs_unck
lfs3_fs_unck(&lfs3, GC_FLAGS) => 0;
@@ -1781,7 +1781,7 @@ code = '''
// _not_ imply uncking ckmeta
| ((!(CKDATA && !CKMETA)) ? LFS3_I_CKMETA : 0)
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// run gc
if (AFTER == 0) {
@@ -1897,7 +1897,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
+37 -21
View File
@@ -87,12 +87,12 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
# test that various format flags don't, uh, assert or anything
# test that various format flags don't assert or anything
#
# these end up passed to mount internally
[cases.test_mount_format_flags]
@@ -104,6 +104,7 @@ defines.CKMETAPARITY = [false, true]
defines.CKDATACKSUMS = [false, true]
defines.CKMETA = [false, true]
defines.CKDATA = [false, true]
defines.GBMAP = [false, true]
if = [
'LFS3_IFDEF_REVDBG(true, !REVDBG)',
'LFS3_IFDEF_REVNOISE(true, !REVNOISE)',
@@ -112,6 +113,7 @@ if = [
'LFS3_IFDEF_CKFETCHES(true, !CKFETCHES)',
'LFS3_IFDEF_CKMETAPARITY(true, !CKMETAPARITY)',
'LFS3_IFDEF_CKDATACKSUMS(true, !CKDATACKSUMS)',
'LFS3_IFDEF_BMAP(true, !GBMAP)',
]
code = '''
lfs3_t lfs3;
@@ -128,10 +130,24 @@ code = '''
? LFS3_IFDEF_CKDATACKSUMS(LFS3_F_CKDATACKSUMS, -1)
: 0)
| ((CKMETA) ? LFS3_F_CKMETA : 0)
| ((CKDATA) ? LFS3_F_CKDATA : 0),
| ((CKDATA) ? LFS3_F_CKDATA : 0)
| ((GBMAP) ? LFS3_IFDEF_BMAP(LFS3_F_GBMAP, -1) : 0),
CFG) => 0;
lfs3_mount(&lfs3, LFS3_M_RDWR, CFG) => 0;
// test that format-only flags are read correctly
struct lfs3_fsinfo fsinfo;
lfs3_fs_stat(&lfs3, &fsinfo) => 0;
assert(fsinfo.flags == (
LFS3_I_MKCONSISTENT
| LFS3_I_LOOKAHEAD
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_YES_BMAP(
LFS3_I_GBMAP,
(GBMAP) ? LFS3_IFDEF_BMAP(LFS3_I_GBMAP, -1) : 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -155,7 +171,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
// with LFS3_M_LOOKAHEAD, mount performs a lookahead scan
@@ -172,7 +188,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -228,7 +244,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
// with LFS3_M_COMPACT, mount compact any uncompacted blocks
@@ -246,7 +262,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// mdir should have been compacted
lfs3_file_open(&lfs3, &file, "jellyfish", LFS3_O_RDONLY) => 0;
@@ -332,7 +348,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
// with LFS3_M_MKCONSISTENT, mount cleans up orphans eagerly
@@ -351,7 +367,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
lfs3_file_open(&lfs3, &file, "cuttlefish", LFS3_O_RDONLY) => 0;
@@ -672,7 +688,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_LE32(
LFS3_TAG_RCOMPAT, 0,
LFS3_RCOMPAT_COMPAT
lfs3_rcompat(&lfs3)
| LFS3_RCOMPAT_NONSTANDARD))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -698,7 +714,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_LE32(
LFS3_TAG_WCOMPAT, 0,
LFS3_WCOMPAT_COMPAT
lfs3_wcompat(&lfs3)
| LFS3_WCOMPAT_NONSTANDARD))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -727,7 +743,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_LE32(
LFS3_TAG_OCOMPAT, 0,
LFS3_OCOMPAT_COMPAT
lfs3_ocompat(&lfs3)
| LFS3_OCOMPAT_NONSTANDARD))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -754,7 +770,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_LE32(
LFS3_TAG_WCOMPAT, 0,
LFS3_WCOMPAT_COMPAT
lfs3_wcompat(&lfs3)
| LFS3_WCOMPAT_RDONLY))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -782,7 +798,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_LE32(
LFS3_TAG_RCOMPAT, 0,
LFS3_RCOMPAT_COMPAT
lfs3_rcompat(&lfs3)
| LFS3_RCOMPAT_WRONLY))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -814,7 +830,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_RCOMPAT, 0,
lfs3_data_fromle32(LFS3_RCOMPAT_COMPAT, rcompat_buf),
lfs3_data_fromle32(lfs3_rcompat(&lfs3), rcompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -848,7 +864,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_WCOMPAT, 0,
lfs3_data_fromle32(LFS3_WCOMPAT_COMPAT, wcompat_buf),
lfs3_data_fromle32(lfs3_wcompat(&lfs3), wcompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -882,7 +898,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_OCOMPAT, 0,
lfs3_data_fromle32(LFS3_OCOMPAT_COMPAT, ocompat_buf),
lfs3_data_fromle32(lfs3_ocompat(&lfs3), ocompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -914,7 +930,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_RCOMPAT, 0,
lfs3_data_fromle32(LFS3_RCOMPAT_COMPAT, rcompat_buf),
lfs3_data_fromle32(lfs3_rcompat(&lfs3), rcompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -948,7 +964,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_WCOMPAT, 0,
lfs3_data_fromle32(LFS3_WCOMPAT_COMPAT, wcompat_buf),
lfs3_data_fromle32(lfs3_wcompat(&lfs3), wcompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
@@ -979,7 +995,7 @@ code = '''
lfs3_mdir_commit(&lfs3, &lfs3.mroot, LFS3_RATTRS(
LFS3_RATTR_CAT(
LFS3_TAG_OCOMPAT, 0,
lfs3_data_fromle32(LFS3_OCOMPAT_COMPAT, ocompat_buf),
lfs3_data_fromle32(lfs3_ocompat(&lfs3), ocompat_buf),
LFS3_DATA_BUF(overflow, sizeof(overflow))))) => 0;
lfs3_unmount(&lfs3) => 0;
+121 -121
View File
@@ -35,7 +35,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -74,7 +74,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -88,7 +88,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -127,7 +127,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -1714,7 +1714,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing
lfs3_trv_t trv;
@@ -1732,7 +1732,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -1749,7 +1749,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -1803,7 +1803,7 @@ code = '''
lfs3_file_close(&lfs3, &file) => 0;
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -1819,7 +1819,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -1855,7 +1855,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -1877,7 +1877,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try another mutation just for good measure
lfs3_file_open(&lfs3, &file, "tarantula",
@@ -1898,7 +1898,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_trv_close(&lfs3, &trv) => 0;
@@ -1944,7 +1944,7 @@ code = '''
lfs3_mkdir(&lfs3, "spider") => 0;
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -1960,7 +1960,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -2010,7 +2010,7 @@ code = '''
lfs3_remove(&lfs3, "spider") => 0;
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2026,7 +2026,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -2071,7 +2071,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2092,7 +2092,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_unmount(&lfs3) => 0;
'''
@@ -2165,7 +2165,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -2249,7 +2249,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_rewind(&lfs3, &file) => 0;
@@ -2333,7 +2333,7 @@ code = '''
lfs3_file_close(&lfs3, &file) => 0;
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2349,7 +2349,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -2442,7 +2442,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2458,7 +2458,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -2544,7 +2544,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2560,7 +2560,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -2636,7 +2636,7 @@ code = '''
lfs3_file_flush(&lfs3, &file1) => 0;
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2652,7 +2652,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file1) => 0;
lfs3_file_close(&lfs3, &file2) => 0;
@@ -2747,7 +2747,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2763,7 +2763,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file1) => 0;
lfs3_file_close(&lfs3, &file2) => 0;
@@ -2851,7 +2851,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2867,7 +2867,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file1) => 0;
lfs3_file_close(&lfs3, &file2) => 0;
@@ -2946,7 +2946,7 @@ code = '''
lfs3_file_close(&lfs3, &file1) => 0;
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -2966,7 +2966,7 @@ code = '''
? LFS3_I_CKMETA
: 0)
| ((!(CKDATA && DESYNC)) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file2) => 0;
@@ -3064,7 +3064,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3084,7 +3084,7 @@ code = '''
? LFS3_I_CKMETA
: 0)
| ((!(CKDATA && DESYNC)) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file2) => 0;
@@ -3175,7 +3175,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3195,7 +3195,7 @@ code = '''
? LFS3_I_CKMETA
: 0)
| ((!(CKDATA && DESYNC)) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
lfs3_file_close(&lfs3, &file2) => 0;
@@ -3281,7 +3281,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3301,7 +3301,7 @@ code = '''
? LFS3_I_CKMETA
: 0)
| ((!(CKDATA && DESYNC)) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => LFS3_ERR_NOENT;
@@ -3390,7 +3390,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3406,7 +3406,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => LFS3_ERR_NOENT;
@@ -3495,7 +3495,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3511,7 +3511,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -3608,7 +3608,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3624,7 +3624,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -3732,7 +3732,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3748,7 +3748,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -3856,7 +3856,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3872,7 +3872,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -3967,7 +3967,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -3983,7 +3983,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4072,7 +4072,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4088,7 +4088,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4192,7 +4192,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4208,7 +4208,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4311,7 +4311,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4327,7 +4327,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4483,7 +4483,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4499,7 +4499,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4672,7 +4672,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4688,7 +4688,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -4855,7 +4855,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -4871,7 +4871,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -5035,7 +5035,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5051,7 +5051,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -5222,7 +5222,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5238,7 +5238,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -5408,7 +5408,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5424,7 +5424,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -5605,7 +5605,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_DATA);
// we should be at end of traversal now
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5621,7 +5621,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check the file contents
lfs3_file_open(&lfs3, &file, "spider", LFS3_O_RDONLY) => 0;
@@ -5689,7 +5689,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -5707,7 +5707,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
assert(tinfo.block == 0 || tinfo.block == 1);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5724,7 +5724,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -5747,7 +5747,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the file
for (int remount = 0; remount < 2; remount++) {
@@ -5828,7 +5828,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -5851,7 +5851,7 @@ code = '''
assert(tinfo.btype == LFS3_BTYPE_MDIR);
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5871,7 +5871,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -5896,7 +5896,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the file
for (int remount = 0; remount < 2; remount++) {
@@ -5959,7 +5959,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -5979,7 +5979,7 @@ code = '''
assert(tinfo.btype == LFS3_BTYPE_MDIR);
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -5996,7 +5996,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -6019,7 +6019,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the file
for (int remount = 0; remount < 2; remount++) {
@@ -6109,7 +6109,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -6140,7 +6140,7 @@ code = '''
assert(tinfo.btype == LFS3_BTYPE_MDIR);
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -6158,7 +6158,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -6182,7 +6182,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -6326,7 +6326,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -6362,7 +6362,7 @@ code = '''
assert(tinfo.btype == LFS3_BTYPE_MDIR);
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -6382,7 +6382,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -6408,7 +6408,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -6557,7 +6557,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing and compacting
lfs3_trv_t trv;
@@ -6598,7 +6598,7 @@ code = '''
assert(tinfo.btype == LFS3_BTYPE_MDIR);
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -6618,7 +6618,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -6644,7 +6644,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -6759,7 +6759,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -6791,7 +6791,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -6817,7 +6817,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -6890,7 +6890,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -6944,7 +6944,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -6969,7 +6969,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7068,7 +7068,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -7114,7 +7114,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -7140,7 +7140,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7239,7 +7239,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -7285,7 +7285,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -7311,7 +7311,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7411,7 +7411,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -7465,7 +7465,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -7491,7 +7491,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7591,7 +7591,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -7645,7 +7645,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -7671,7 +7671,7 @@ code = '''
// note ckdata implies ckmeta
| (((!CKMETA && !CKDATA) || ORPHANS > 0) ? LFS3_I_CKMETA : 0)
| ((!CKDATA || ORPHANS > 0) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7789,7 +7789,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -7822,7 +7822,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -7851,7 +7851,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// running another traversal should clear the uncompacted flag
lfs3_trv_rewind(&lfs3, &trv) => 0;
@@ -7875,7 +7875,7 @@ code = '''
// note ckdata implies ckmeta
| ((!CKMETA && !CKDATA) ? LFS3_I_CKMETA : 0)
| ((!CKDATA) ? LFS3_I_CKDATA : 0)
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {
@@ -7971,7 +7971,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// try traversing with mkconsistent
lfs3_trv_t trv;
@@ -8026,7 +8026,7 @@ code = '''
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_MDIR);
}
#ifdef LFS3_BMAP
#ifdef LFS3_YES_BMAP
lfs3_trv_read(&lfs3, &trv, &tinfo) => 0;
assert(tinfo.btype == LFS3_BTYPE_BTREE);
assert(tinfo.block == 2);
@@ -8054,7 +8054,7 @@ code = '''
| LFS3_I_COMPACT
| LFS3_I_CKMETA
| LFS3_I_CKDATA
| LFS3_IFDEF_BMAP(LFS3_I_BMAPCACHE, 0)));
| LFS3_IFDEF_YES_BMAP(LFS3_I_GBMAP, 0)));
// check we can still read the files
for (int remount = 0; remount < 2; remount++) {