Fixed prng xors during mdir splits/drops

We were unconditionally xoring our prng seed with mdir_[0]'s cksum, but
we should really use mdelta to xor in the relevant cksums.

This is a little bit more complicated, so adds a little bit of code:

           code          stack
  before: 33442           2640
  after:  33470 (+0.1%)   2640 (+0.0%)
This commit is contained in:
Christopher Haster
2024-05-24 01:47:00 -05:00
parent 081a74cb23
commit 09faac593c
+6 -1
View File
@@ -7051,7 +7051,12 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
// success? update in-device state, we must not error at this point
// toss our cksum into the filesystem seed for pseudorandom numbers
lfs->seed ^= mdir_[0].rbyd.cksum;
if (mdelta >= 0) {
lfs->seed ^= mdir_[0].rbyd.cksum;
}
if (mdelta > 0) {
lfs->seed ^= mdir_[1].rbyd.cksum;
}
// update any gstate changes
lfsr_fs_commitgdelta(lfs);