Fixed multiple open shrubs duplicating during mdir compact

An easy mistake to make, we were incorrectly checking the non-staging
shrub to see if our shrub had been copied over. Copying over the shrub
updates the staging shrub, so this wasn't actually doing anything
useful, resulting in a bunch of duplicate shrubs.

The fix is to use the staging shrub.

This was found thanks to test_fsync_wwrr, but only after bumping our
fragment_size up from cache_size (16 bytes) -> block_size/8 (512 bytes).
I'm guessing because this allowed our shrubs to be more overcommitted.
This commit is contained in:
Christopher Haster
2024-05-13 23:29:59 -05:00
parent 88d783f4bb
commit a2b4a95b89
+2 -2
View File
@@ -6102,7 +6102,7 @@ static int lfsr_mdir_commit__(lfs_t *lfs, lfsr_mdir_t *mdir,
&file->m.mdir, &file->bshrub)
// only compact once, first compact should stage
// the new block
&& file->bshrub.u.bshrub.blocks[0]
&& file->bshrub_.u.bshrub.blocks[0]
!= rbyd_.blocks[0]) {
int err = lfsr_shrub_compact(lfs, &rbyd_,
&file->bshrub_.u.bshrub,
@@ -6487,7 +6487,7 @@ static int lfsr_mdir_compact__(lfs_t *lfs, lfsr_mdir_t *mdir_,
// inlined shrub?
} else if (lfsr_bshrub_isbshrub(&file->m.mdir, &file->bshrub)
// only compact once, first compact should stage the new block
&& file->bshrub.u.bshrub.blocks[0]
&& file->bshrub_.u.bshrub.blocks[0]
!= mdir_->rbyd.blocks[0]) {
err = lfsr_shrub_compact(lfs, &mdir_->rbyd,
&file->bshrub_.u.bshrub, &file->bshrub.u.bshrub);