Reorganized traversal flags again
One nice thing about merging LOOKAHEAD + LOOKGBMAP, is now our core
traversal flags fit in a single byte. This is useful for organizing
things, especially so as the traversal flags seem to permeate into
basically every flag set.
The main change was to actually group these flags into a byte, which
helps readability and in theory could make some bulk accesses cheaper
(in practice I don't think we currently leverage this):
T_MODE 0x00000001 ---- ---- ---- ---- ---- ---- ---- ---1
T_RDONLY 0x00000000 ---- ---- ---- ---- ---- ---- ---- ----
T_RDWR 0x00000001 ---- ---- ---- ---- ---- ---- ---- ---1
T_MTREEONLY 0x00000002 ---- ---- ---- ---- ---- ---- ---- --1-
T_EXCL 0x00000008 ---- ---- ---- ---- ---- ---- ---- 1---
T_MKCONSISTENT 0x00000100 ---- ---- ---- ---- ---- ---1 ---- ----
T_LOOKAHEAD 0x00000200 ---- ---- ---- ---- ---- --1- ---- ----
T_PREERASE* 0x00000400 ---- ---- ---- ---- ---- -1-- ---- ----
T_COMPACT 0x00000800 ---- ---- ---- ---- ---- 1--- ---- ----
T_CKMETA 0x00001000 ---- ---- ---- ---- ---1 ---- ---- ----
T_CKDATA 0x00002000 ---- ---- ---- ---- --1- ---- ---- ----
T_REPAIRMETA* 0x00004000 ---- ---- ---- ---- -1-- ---- ---- ----
T_REPAIRDATA* 0x00008000 ---- ---- ---- ---- 1--- ---- ---- ----
t_EVICT* 0x00000010 ---- ---- ---- ---- ---- ---- ---1 ----
t_TYPE 0xf0000000 1111 ---- ---- ---- ---- ---- ---- ----
t_ZOMBIE 0x08000000 ---- 1--- ---- ---- ---- ---- ---- ----
t_CKPOINTED 0x04000000 ---- -1-- ---- ---- ---- ---- ---- ----
t_DIRTY 0x02000000 ---- --1- ---- ---- ---- ---- ---- ----
t_STALE 0x01000000 ---- ---1 ---- ---- ---- ---- ---- ----
t_BTYPE 0x00ff0000 ---- ---- 1111 1111 ---- ---- ---- ----
* Planned
This gives btype a full byte as well, which is a bit overkill, but can
be reduced in the future if we run into traversal flag pressure.
This also pushes some future planned flags (DEDUP, COMPR, etc) into
higher-order bits, but that's not the end of the world.
Code changes basically nothing:
code stack ctx
before: 35152 2136 660
after: 35152 (+0.0%) 2136 (+0.0%) 660 (+0.0%)
code stack ctx
gbmap before: 38080 2136 776
gbmap after: 38076 (-0.0%) 2136 (+0.0%) 776 (+0.0%)
This commit is contained in:
@@ -7255,11 +7255,11 @@ static inline bool lfs3_t_isckdata(uint32_t flags) {
|
||||
|
||||
// internal traversal flags
|
||||
static inline uint8_t lfs3_t_btype(uint32_t flags) {
|
||||
return (flags >> 20) & 0xf;
|
||||
return (flags >> 16) & 0xff;
|
||||
}
|
||||
|
||||
static inline uint32_t lfs3_t_btypeflags(uint8_t btype) {
|
||||
return (uint32_t)btype << 20;
|
||||
return (uint32_t)btype << 16;
|
||||
}
|
||||
|
||||
static inline void lfs3_t_setbtype(uint32_t *flags, uint8_t btype) {
|
||||
|
||||
Reference in New Issue
Block a user