Dropped internal LFS_i_UNTIDY pseudo-alias flag
We really shouldn't have two names for the same thing, it just makes things more confusing, even if the public name doesn't quite match the internal usage. Especially now that we internally rely on these being the same flag. This renames LFS_i_UNTIDY -> LFS_I_MKCONSISTENT and drops the untidy/ mktidy naming internally. No code changes.
This commit is contained in:
@@ -6727,11 +6727,6 @@ static inline bool lfsr_m_isckdatacksums(uint32_t flags) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// internal fs flags
|
|
||||||
static inline bool lfsr_i_isuntidy(uint32_t flags) {
|
|
||||||
return flags & LFS_i_UNTIDY;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// opened mdir things ///
|
/// opened mdir things ///
|
||||||
@@ -9625,7 +9620,7 @@ eot:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// needed in lfsr_mtree_gc
|
// needed in lfsr_mtree_gc
|
||||||
static int lfsr_fs_mktidy_(lfs_t *lfs, lfsr_mdir_t *mdir);
|
static int lfsr_mdir_mkconsistent(lfs_t *lfs, lfsr_mdir_t *mdir);
|
||||||
static void lfs_alloc_ckpoint(lfs_t *lfs);
|
static void lfs_alloc_ckpoint(lfs_t *lfs);
|
||||||
static void lfs_alloc_markfree(lfs_t *lfs);
|
static void lfs_alloc_markfree(lfs_t *lfs);
|
||||||
|
|
||||||
@@ -9656,10 +9651,10 @@ dropped:;
|
|||||||
|
|
||||||
// mkconsistencing mdirs?
|
// mkconsistencing mdirs?
|
||||||
if (lfsr_t_ismkconsistent(t->o.o.flags)
|
if (lfsr_t_ismkconsistent(t->o.o.flags)
|
||||||
&& lfsr_i_isuntidy(lfs->flags)
|
&& lfsr_t_ismkconsistent(lfs->flags)
|
||||||
&& tag == LFSR_TAG_MDIR) {
|
&& tag == LFSR_TAG_MDIR) {
|
||||||
lfsr_mdir_t *mdir = (lfsr_mdir_t*)bptr.data.u.buffer;
|
lfsr_mdir_t *mdir = (lfsr_mdir_t*)bptr.data.u.buffer;
|
||||||
err = lfsr_fs_mktidy_(lfs, mdir);
|
err = lfsr_mdir_mkconsistent(lfs, mdir);
|
||||||
if (err) {
|
if (err) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@@ -9728,7 +9723,7 @@ eot:;
|
|||||||
// was mkconsistent successful?
|
// was mkconsistent successful?
|
||||||
if (lfsr_t_ismkconsistent(t->o.o.flags)
|
if (lfsr_t_ismkconsistent(t->o.o.flags)
|
||||||
&& !lfsr_t_isdirty(t->o.o.flags)) {
|
&& !lfsr_t_isdirty(t->o.o.flags)) {
|
||||||
lfs->flags &= ~LFS_i_UNTIDY;
|
lfs->flags &= ~LFS_I_MKCONSISTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// was compaction successful? note we may need multiple passes if
|
// was compaction successful? note we may need multiple passes if
|
||||||
@@ -11298,9 +11293,9 @@ static void lfsr_file_close_(lfs_t *lfs, const lfsr_file_t *file) {
|
|||||||
if (lfsr_grm_count(lfs) < 2) {
|
if (lfsr_grm_count(lfs) < 2) {
|
||||||
lfsr_grm_push(lfs, file->o.o.mdir.mid);
|
lfsr_grm_push(lfs, file->o.o.mdir.mid);
|
||||||
|
|
||||||
// fallback to just marking the filesystem as untidy
|
// fallback to just marking the filesystem as inconsistent
|
||||||
} else {
|
} else {
|
||||||
lfs->flags |= LFS_i_UNTIDY;
|
lfs->flags |= LFS_I_MKCONSISTENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13297,7 +13292,7 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
|
|||||||
// setup flags
|
// setup flags
|
||||||
lfs->flags = flags
|
lfs->flags = flags
|
||||||
// assume we contain orphans until proven otherwise
|
// assume we contain orphans until proven otherwise
|
||||||
| LFS_i_UNTIDY
|
| LFS_I_MKCONSISTENT
|
||||||
// default to an empty lookahead
|
// default to an empty lookahead
|
||||||
| LFS_I_LOOKAHEAD
|
| LFS_I_LOOKAHEAD
|
||||||
// default to assuming we need compaction somewhere, worst case
|
// default to assuming we need compaction somewhere, worst case
|
||||||
@@ -14324,7 +14319,7 @@ int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
|
|||||||
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
|
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
|
||||||
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
|
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
|
||||||
| LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0)
|
| LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0)
|
||||||
| LFS_I_MKCONSISTENT // synonym for LFS_i_UNTIDY
|
| LFS_I_MKCONSISTENT
|
||||||
| LFS_I_LOOKAHEAD
|
| LFS_I_LOOKAHEAD
|
||||||
| LFS_I_COMPACT
|
| LFS_I_COMPACT
|
||||||
| LFS_I_CKMETA
|
| LFS_I_CKMETA
|
||||||
@@ -14424,7 +14419,7 @@ static int lfsr_fs_fixgrm(lfs_t *lfs) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lfsr_fs_mktidy_(lfs_t *lfs, lfsr_mdir_t *mdir) {
|
static int lfsr_mdir_mkconsistent(lfs_t *lfs, lfsr_mdir_t *mdir) {
|
||||||
// save the current mid
|
// save the current mid
|
||||||
lfsr_mid_t mid = mdir->mid;
|
lfsr_mid_t mid = mdir->mid;
|
||||||
|
|
||||||
@@ -14472,7 +14467,7 @@ failed:;
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lfsr_fs_mktidy(lfs_t *lfs) {
|
static int lfsr_fs_fixorphans(lfs_t *lfs) {
|
||||||
// LFS_T_MKCONSISTENT really just removes orphans
|
// LFS_T_MKCONSISTENT really just removes orphans
|
||||||
lfsr_traversal_t t;
|
lfsr_traversal_t t;
|
||||||
lfsr_traversal_init(&t, LFS_T_MTREEONLY | LFS_T_MKCONSISTENT);
|
lfsr_traversal_init(&t, LFS_T_MTREEONLY | LFS_T_MKCONSISTENT);
|
||||||
@@ -14508,8 +14503,8 @@ int lfsr_fs_mkconsistent(lfs_t *lfs) {
|
|||||||
// this must happen after fixgrm, since removing orphaned
|
// this must happen after fixgrm, since removing orphaned
|
||||||
// stickynotes risks outdating the grm
|
// stickynotes risks outdating the grm
|
||||||
//
|
//
|
||||||
if (lfsr_i_isuntidy(lfs->flags)) {
|
if (lfsr_t_ismkconsistent(lfs->flags)) {
|
||||||
int err = lfsr_fs_mktidy(lfs);
|
int err = lfsr_fs_fixorphans(lfs);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -14581,7 +14576,7 @@ static int lfsr_fs_gc_(lfs_t *lfs, lfsr_traversal_t *t,
|
|||||||
// do we have any pending work?
|
// do we have any pending work?
|
||||||
uint32_t pending = flags & (
|
uint32_t pending = flags & (
|
||||||
(lfs->flags & (
|
(lfs->flags & (
|
||||||
LFS_i_UNTIDY
|
LFS_I_MKCONSISTENT
|
||||||
| LFS_I_LOOKAHEAD
|
| LFS_I_LOOKAHEAD
|
||||||
| LFS_I_COMPACT
|
| LFS_I_COMPACT
|
||||||
| LFS_I_CKMETA
|
| LFS_I_CKMETA
|
||||||
@@ -14635,7 +14630,7 @@ static int lfsr_fs_gc_(lfs_t *lfs, lfsr_traversal_t *t,
|
|||||||
|
|
||||||
// clear any pending flags we make progress on
|
// clear any pending flags we make progress on
|
||||||
pending &= lfs->flags & (
|
pending &= lfs->flags & (
|
||||||
LFS_i_UNTIDY
|
LFS_I_MKCONSISTENT
|
||||||
| LFS_I_LOOKAHEAD
|
| LFS_I_LOOKAHEAD
|
||||||
| LFS_I_COMPACT
|
| LFS_I_COMPACT
|
||||||
| LFS_I_CKMETA
|
| LFS_I_CKMETA
|
||||||
|
|||||||
@@ -231,9 +231,6 @@ enum lfs_type {
|
|||||||
#define LFS_I_CKMETA 0x00100000 // Metadata checksums not checked recently
|
#define LFS_I_CKMETA 0x00100000 // Metadata checksums not checked recently
|
||||||
#define LFS_I_CKDATA 0x00200000 // Data checksums not checked recently
|
#define LFS_I_CKDATA 0x00200000 // Data checksums not checked recently
|
||||||
|
|
||||||
// internally used flags, don't use these
|
|
||||||
#define LFS_i_UNTIDY 0x00010000 // Filesystem may have orphaned stickynotes
|
|
||||||
|
|
||||||
|
|
||||||
// Block types
|
// Block types
|
||||||
enum lfs_btype {
|
enum lfs_btype {
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ FLAGS = [
|
|||||||
('M', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
('M', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||||
('M', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
('M', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||||
|
|
||||||
('m', 'UNTIDY', 0x00010000, "Filesystem may have orphaned stickynotes" ),
|
|
||||||
|
|
||||||
# GC flags
|
# GC flags
|
||||||
('GC', 'MKCONSISTENT',
|
('GC', 'MKCONSISTENT',
|
||||||
0x00010000, "Make the filesystem consistent" ),
|
0x00010000, "Make the filesystem consistent" ),
|
||||||
|
|||||||
@@ -5314,7 +5314,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
struct lfs_fsinfo fsinfo;
|
struct lfs_fsinfo fsinfo;
|
||||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||||
@@ -5450,7 +5450,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
struct lfs_fsinfo fsinfo;
|
struct lfs_fsinfo fsinfo;
|
||||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||||
@@ -5600,7 +5600,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
struct lfs_fsinfo fsinfo;
|
struct lfs_fsinfo fsinfo;
|
||||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||||
@@ -5756,7 +5756,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
struct lfs_fsinfo fsinfo;
|
struct lfs_fsinfo fsinfo;
|
||||||
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
lfsr_fs_stat(&lfs, &fsinfo) => 0;
|
||||||
|
|||||||
@@ -6458,7 +6458,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -6602,7 +6602,7 @@ code = '''
|
|||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
// if we introduce actual orphans, me _must not_ clear the orphan flag
|
// if we introduce actual orphans, me _must not_ clear the orphan flag
|
||||||
if (ORPHANS >= 3) {
|
if (ORPHANS >= 3) {
|
||||||
assert(lfs.flags & LFS_i_UNTIDY);
|
assert(lfs.flags & LFS_I_MKCONSISTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we introduced actual orphans, we _must_ be marked as inconsistent
|
// if we introduced actual orphans, we _must_ be marked as inconsistent
|
||||||
@@ -6759,7 +6759,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -6917,7 +6917,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -7086,7 +7086,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -7253,7 +7253,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -7418,7 +7418,7 @@ code = '''
|
|||||||
// we should have cleaned up all grms/orphans
|
// we should have cleaned up all grms/orphans
|
||||||
assert(lfs.grm.mids[0] == -1);
|
assert(lfs.grm.mids[0] == -1);
|
||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
assert(!(lfs.flags & LFS_i_UNTIDY));
|
assert(!(lfs.flags & LFS_I_MKCONSISTENT));
|
||||||
|
|
||||||
// which means there shouldn't be that many files left
|
// which means there shouldn't be that many files left
|
||||||
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
assert((lfs.mtree.u.weight & 0x7fffffff) <= (2 << lfs.mdir_bits));
|
||||||
@@ -7613,7 +7613,7 @@ code = '''
|
|||||||
assert(lfs.grm.mids[1] == -1);
|
assert(lfs.grm.mids[1] == -1);
|
||||||
// if we introduce actual orphans, me _must not_ clear the orphan flag
|
// if we introduce actual orphans, me _must not_ clear the orphan flag
|
||||||
if (ORPHANS >= 3) {
|
if (ORPHANS >= 3) {
|
||||||
assert(lfs.flags & LFS_i_UNTIDY);
|
assert(lfs.flags & LFS_I_MKCONSISTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mdirs should have been compacted
|
// mdirs should have been compacted
|
||||||
|
|||||||
Reference in New Issue
Block a user