Tweaked btree/bshrub rbyd commit_ to accept any bid

This gets a bit muddled now with traversals mutating inner btree nodes
directly.

Except for some asserts, we can accept any bid in the relevant rbyd
here, and accepting any bid is better than accepting only one bid
(left-leaning) inconsistent with the rest of the btree API
(right-leaning)...

Code changes minimal:

           code          stack
  before: 35448           2800
  after:  35440 (-0.0%)   2800 (+0.0%)
This commit is contained in:
Christopher Haster
2024-07-01 15:08:23 -05:00
parent f3446abfa7
commit e2ec25e511
+4 -8
View File
@@ -4786,7 +4786,6 @@ static int lfsr_btree_commit__(lfs_t *lfs, lfsr_btree_t *btree,
recurse:; recurse:;
// done? // done?
if (!lfsr_rbyd_trunk(&parent)) { if (!lfsr_rbyd_trunk(&parent)) {
LFS_ASSERT(bid == 0);
*btree = rbyd_; *btree = rbyd_;
*attr_count_ = 0; *attr_count_ = 0;
return 0; return 0;
@@ -4894,9 +4893,8 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree,
return err; return err;
} }
// adjust bid to point to the zero-most rid // adjust rid
bid -= rid_; rid -= (bid-rid_);
rid -= bid;
} }
return lfsr_btree_commit_(lfs, btree, bid, &rbyd, rid, return lfsr_btree_commit_(lfs, btree, bid, &rbyd, rid,
@@ -5814,10 +5812,8 @@ static int lfsr_bshrub_commit(lfs_t *lfs,
return err; return err;
} }
// TODO // adjust rid
// adjust bid to point to the zero-most rid rid -= (bid-rid_);
bid -= rid_;
rid -= bid;
} }
return lfsr_bshrub_commit_(lfs, mdir, bshrub, bid, &rbyd, rid, return lfsr_bshrub_commit_(lfs, mdir, bshrub, bid, &rbyd, rid,