Made significant progress around inlined-file state during mdir commits
The main improvement is moving the special inlined-file compaction logic up into lfsr_mdir_compact__. We only need this logic for files stored in mdirs, and thanks to its recursive nature, we weren't getting any benefit from handling this at a lower level anyways. This is a nice logical restructuring that probably saves a bit of code cost in the end. Another significant improvement is moving the staging copy of the inlined tree's state up into the file struct itself. This solves the problem of needed N copies of temporary inlined state when you have N open files. It also provides a central place to stage changes when compacting inlined trees, which happens across several different places in the mdir commit logic. Though some may see this as more a hack than a feature. Also note-worthy, but minor: these changes required an additional opened-mdir linked-list to know when the mdir is a file and may contain an inlined tree.
This commit is contained in:
@@ -874,6 +874,7 @@ def frepr(mdir, rid, tag):
|
||||
did, _ = fromleb128(data)
|
||||
did = '0x%x' % did
|
||||
return 'bookmark %s' % did
|
||||
|
||||
elif tag == TAG_DIR:
|
||||
# read the did
|
||||
did = '?'
|
||||
@@ -882,6 +883,25 @@ def frepr(mdir, rid, tag):
|
||||
did, _ = fromleb128(data)
|
||||
did = '0x%x' % did
|
||||
return 'dir %s' % did
|
||||
|
||||
elif tag == TAG_REG:
|
||||
size = 0
|
||||
structs = []
|
||||
# inlined?
|
||||
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_INLINED)
|
||||
if not done and rid_ == rid and tag_ == TAG_INLINED:
|
||||
size = max(size, len(data))
|
||||
structs.append('inlined 0x%x.%x %d' % (mdir.block, j+d, len(data)))
|
||||
# inlined tree?
|
||||
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, TAG_TRUNK)
|
||||
if not done and rid_ == rid and tag_ == TAG_TRUNK:
|
||||
d = 0
|
||||
trunk, d_ = fromleb128(data[d:]); d += d_
|
||||
weight, d_ = fromleb128(data[d:]); d += d_
|
||||
size = max(size, weight)
|
||||
structs.append('trunk 0x%x.%x' % (mdir.block, trunk))
|
||||
return 'reg %s' % ', '.join(it.chain(['%d' % size], structs))
|
||||
|
||||
else:
|
||||
return 'type 0x%02x' % (tag & 0xff)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user