gbmap: Added support for gbmap in lfs3_fs_grow

In lfs3_fs_grow, we need to update any gbmaps to match the new disk
size. The actual patch to the gbmap is easy, but it does get a bit
delicate since we need to feed the gbmap with an allocator in the new
disk size.

Fortunately, the opportunistism of the gbmap allocator avoids any
catch-22 issues, as long as we make sure to not trigger any gbmap
rebuilds.

Adds a bit of code, but not much:

                 code          stack          ctx
  before:       37168           2352          684
  after:        37168 (+0.0%)   2352 (+0.0%)  684 (+0.0%)

                 code          stack          ctx
  gbmap before: 39000           2456          800
  gbmap after:  39116 (+0.3%)   2456 (+0.0%)  800 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-10 13:44:40 -05:00
parent 24d75a24c5
commit 9e45249b29
7 changed files with 196 additions and 112 deletions
+2 -2
View File
@@ -2833,7 +2833,7 @@ class Gstate:
def __init__(self, mtree, config, tag, gdeltas):
super().__init__(mtree, config, tag, gdeltas)
d = 0
self.cursor, d_ = fromleb128(self.data, d); d += d_
self.window, d_ = fromleb128(self.data, d); d += d_
self.known, d_ = fromleb128(self.data, d); d += d_
block, trunk, cksum, d_ = frombranch(self.data, d); d += d_
self.btree = Btree.fetchck(
@@ -2845,7 +2845,7 @@ class Gstate:
def repr(self):
return 'gbmap %s 0x%x %d' % (
self.btree.addr(),
self.cursor, self.known)
self.window, self.known)
# keep track of known gstate
_known = [g for g in Gstate.__subclasses__() if g.tag is not None]