Moved rids out of attr-lists

It turns out we never really need to commit to two unrelated rids in a
single commit. And some data structures, mainly btrees/bshrubs, don't
even allow commits to unrelated rids.

Well, sort of. There are some cases that seem to require unrelated rids,
but these are easy enough to work around:

1. btree/mdir splits/merges end up with two rids - but these either
   converge or diverge from one rid, so as long as we assume sequential
   inserts/deletes operate on the _neighboring_ rid, things work out.

2. grms/etc commit to mid=-1 irregardless of the file mid - but these
   are also very special flags that are already handled differently to
   manage the global state updates, nothing new was needed here.

So, in theory, we can move the rids out of the lfsr_attr_t struct and
infer and rid changes as we play out the attr-list, saving 4 bytes
(~17%) from every attr we allocate on the stack.

As a plus, we remove the need to manually calculate the changes to the
rid in the attr-list, reducing the likelihood of bugs here and saving a
decent amount of code.

Unfortunately the code/stack savings from this change were a bit
disappointing. The extra rid parameter in every commit function added
quite a bit of overhead, and we have to do some funky memmoves in
lfsr_file_carve to account for the new strict attr-list order:

            code         stack          lfsr_attr_t
  before:  33924          2912                   24
  after:   33992 (+0.2%)  2904 (-0.3%)           20 (-16.7%)

Still, this decreases the amount of code that can contain bugs, and more
closely matches the actual behavior of lfsr_btree/bshrub_commit.

Someone should really get around to updating the rbyd/btree/mtree
tests... Well, at least the non-internal (dir/dread/file/fwrite/etc)
tests are working.
This commit is contained in:
Christopher Haster
2024-01-22 20:57:54 -06:00
parent e04748dadd
commit 33ac8bfc80
+259 -189
View File
File diff suppressed because it is too large Load Diff