Moved dir->count check before commit, limited to < 0xff
This matches the logic originally implemented in48bd2bf, which was lost during the big no-recursion refactor84da4c0. Other notes: - Checking >= 0xff matches the split logic during compaction (line 2158): end - split < 0xff - Grouping dir->erased || dir->count >= 0xff together makes it clear these share a common code path. - Checking for dir->count >= 0xff early avoids committing >8-bit ids to disk. The cat may already be out-of-the bag on this one, but opening the id space up to the full 10-bits should probably be on a non-patch release. Found by dschendt
This commit is contained in:
@@ -2264,7 +2264,7 @@ static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir->erased) {
|
if (dir->erased || dir->count >= 0xff) {
|
||||||
// try to commit
|
// try to commit
|
||||||
struct lfs_commit commit = {
|
struct lfs_commit commit = {
|
||||||
.block = dir->pair[0],
|
.block = dir->pair[0],
|
||||||
@@ -2333,10 +2333,6 @@ static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir,
|
|||||||
lfs->gdisk = lfs->gstate;
|
lfs->gdisk = lfs->gstate;
|
||||||
lfs->gdelta = (lfs_gstate_t){0};
|
lfs->gdelta = (lfs_gstate_t){0};
|
||||||
|
|
||||||
if(dir->count == 0x3ff)
|
|
||||||
{
|
|
||||||
goto compact;
|
|
||||||
}
|
|
||||||
goto fixmlist;
|
goto fixmlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user