trv: Added LFS3_t_NOSPC, avoid ENOSPC errors in traversals

This relaxes error encountered during lfs3_mtree_gc to _not_ propagate,
but instead just log a warning and prevent the relevant work from being
checked off during EOT.

The idea is this allows other work to make progress in low-space
conditions.

I originally meant to limit this to gbmap repopulations, to match the
behavior of lfs3_alloc_repopgbmap, but I think extending the idea to all
filesystem mutating operations makes sense (LFS3_T_MKCONSISTENT +
LFS3_T_REPOPGBMAP + LFS3_T_COMPACTMETA).

---

To avoid incorrectly marking traversal work as completed, we need to
track if we hit any ENOSPC errors, thus the new LFS3_t_NOSPC flag:

  LFS3_t_NOSPC  0x00800000  Optional gc work ran out of space

Not the happiest just throwing flags at problems, but I can't think of a
better solution at the moment.

This doesn't differentiate between ENOSPC errors during the different
types of work, but in theory if we're hitting ENOSPC errors whatever
work returns the error is a toss-up anyways.

---

Adds a bit of code:

                 code          stack          ctx
  before:       37208           2352          688
  after:        37248 (+0.1%)   2352 (+0.0%)  688 (+0.0%)

                 code          stack          ctx
  gbmap before: 40120           2368          856
  gbmap after:  40204 (+0.2%)   2368 (+0.0%)  856 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-18 18:18:09 -05:00
parent 0a8ac0994c
commit f892d299dd
3 changed files with 57 additions and 10 deletions
+2 -1
View File
@@ -165,7 +165,7 @@ FLAGS = [
('^_GBMAP', 0x00080000, "Tstate = gbmap" ),
('^_GBMAP_P', 0x00090000, "Tstate = gbmap_p" ),
('^_DONE', 0x000a0000, "Tstate = done" ),
('t_BTYPE', 0x00f00000, "The current block type" ),
('t_BTYPE', 0x00700000, "The current block type" ),
('^_MDIR', 0x00100000, "Btype = mdir" ),
('^_BTREE', 0x00200000, "Btype = btree" ),
('^_DATA', 0x00300000, "Btype = data" ),
@@ -173,6 +173,7 @@ FLAGS = [
('t_DIRTY', 0x04000000, "Filesystem modified outside traversal" ),
('t_MUTATED', 0x02000000, "Filesystem modified during traversal" ),
('t_CKPOINTED', 0x01000000, "Filesystem ckpointed during traversal" ),
('t_NOSPC', 0x00800000, "Optional gc work ran out of space" ),
# Block allocator flags
('alloc_ERASE', 0x00000001, "Please erase the block" ),