trv: Adopted LFS3_t_STALE for marking block queue as stale
This solves the previous gc-needs-block-queue-so-we-can-clobber-block-
queue issue by adding an additional LFS3_t_STALE flag to indicate when
any block queues would be invalid.
So instead of clearing block queues in lfs3_alloc_ckpoint, we just set
LFS3_t_STALE, and any lfs3_trv_ts can clear their block queues in
lfs3_trv_read. This allows lfs3_mgc_ts to be allocated without a block
queue when doing any LFS3_M_*/LFS3_F_*/LFS3_GC_* work.
LFS3_t_STALE is set at the same time as LFS3_t_CKPOINT and LFS3_t_DIRTY,
but we need a separate bit so lfs3_trv_read can clear the flag after
flushing without losing ckpoint/dirty information.
---
Unfortunately, none of the stack-allocated lfs3_mgc_ts are on the stack
hot-path, so we don't immediate savings. But note the 2-words saved in
ctx when compiling in LFS3_GC mode:
code stack ctx
before: 35940 2280 660
after: 35944 (+0.0%) 2280 (+0.0%) 660 (+0.0%)
code stack ctx
gbmap before: 38916 2296 772
gbmap after: 38916 (+0.0%) 2296 (+0.0%) 772 (+0.0%)
code stack ctx
gc before: 36012 2280 776
gc after: 36016 (+0.0%) 2280 (+0.0%) 768 (-1.0%)
This commit is contained in:
@@ -340,9 +340,10 @@ enum lfs3_btype {
|
||||
#define LFS3_t_TYPE 0xf0000000 // The traversal's type
|
||||
#define LFS3_t_BTYPE 0x00f00000 // The current block type
|
||||
#define LFS3_t_ZOMBIE 0x08000000 // File has been removed
|
||||
#define LFS3_t_DIRTY 0x04000000 // Filesystem ckpointed outside traversal
|
||||
#define LFS3_t_CKPOINTED \
|
||||
0x02000000 // Filesystem ckpointed during traversal
|
||||
0x04000000 // Filesystem ckpointed during traversal
|
||||
#define LFS3_t_DIRTY 0x02000000 // Filesystem ckpointed outside traversal
|
||||
#define LFS3_t_STALE 0x01000000 // Block queue probably out-of-date
|
||||
|
||||
// GC flags
|
||||
#ifndef LFS3_RDONLY
|
||||
@@ -1022,7 +1023,7 @@ typedef struct lfs3 {
|
||||
|
||||
// optional incremental gc state
|
||||
#ifdef LFS3_GC
|
||||
lfs3_trv_t gc;
|
||||
lfs3_mgc_t gc;
|
||||
#endif
|
||||
} lfs3_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user