Rearranged flags a bit
Mainly to make space for more shared open/mount flags that are future
planned.
The nice thing about our flags is they don't live on-disk, so we can
always change them whenever we need to.
It gets a bit messy, but this is what the current layout looks like:
8 8 8 8
.----++----++----++----.
.----..-..-..----------.
o_flags: |type||f||t|| o |
|----||-|:-:'--.-.-----'
|----||-|:-:---:-:-----.
d_flags: |type||f|: : : : |
|----||-|:-:---:-:-----'
|----||-|:-'--..-..----.
t_flags: |type||f|| t ||f||tstt|
'----''-'|----|'-''----'
.--------|----|:-:-----.
gc_flags: | | t |: : |
'--------|----|:-:-----'
.----..-.|----|:-:.----.
f_flags: | f ||m|| t |: :| f |
'----'|-||----|:-:'----'
.----.|-||----||-|.----.
m_flags: | i ||m|| t ||o|| m |
|----||-|'----'|-||----|
|----||-|------|-||----|
i_flags: | i ||m| |o|| m |
'----''-'------'-''----'
The main downside of this layout is that some of the traversal flags,
LFS_T_DIRTY/MUTATED, now risk ambiguity with open/mount flags. But I
don't think this is really avoidable as traversals are already using
almost the entire 32-bit encoding space...
No code changes:
code stack
before: 36480 2680
after: 36480 (+0.0%) 2680 (+0.0%)
This commit is contained in:
@@ -6672,8 +6672,8 @@ static inline bool lfsr_t_ismutated(uint32_t flags) {
|
||||
}
|
||||
|
||||
static inline uint32_t lfsr_t_swapdirty(uint32_t flags) {
|
||||
uint32_t x = ((flags >> 19) ^ (flags >> 18)) & 0x1;
|
||||
return flags ^ (x << 19) ^ (x << 18);
|
||||
uint32_t x = ((flags >> 9) ^ (flags >> 8)) & 0x1;
|
||||
return flags ^ (x << 9) ^ (x << 8);
|
||||
}
|
||||
|
||||
// mount flags
|
||||
@@ -13831,7 +13831,7 @@ int lfsr_fs_gc(lfs_t *lfs, lfs_soff_t steps, uint32_t flags) {
|
||||
uint32_t pending = flags & (
|
||||
((lfs->flags & (
|
||||
LFS_I_HASORPHANS
|
||||
| LFS_I_UNCOMPACTED)) >> 16)
|
||||
| LFS_I_UNCOMPACTED)) >> 12)
|
||||
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0)
|
||||
| LFS_GC_CKMETA
|
||||
| LFS_GC_CKDATA);
|
||||
@@ -13896,7 +13896,7 @@ int lfsr_fs_gc(lfs_t *lfs, lfs_soff_t steps, uint32_t flags) {
|
||||
pending &= (
|
||||
((lfs->flags & (
|
||||
LFS_I_HASORPHANS
|
||||
| LFS_I_UNCOMPACTED)) >> 16)
|
||||
| LFS_I_UNCOMPACTED)) >> 12)
|
||||
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0)
|
||||
// only consider our filesystem checked if we
|
||||
// weren't mutated
|
||||
|
||||
Reference in New Issue
Block a user