Moved post-compaction mdir commits into lfsr_mdir_compact__
Since we need access to the pending attr-list in lfsr_mdir_compact__
now, we might as well just do the pending commit. Worst case, a call to
lfsr_mdir_compact__ can provide a NULL attr-list for the previous
behavior (though we always follow up compaction with a commit).
The only downside is that this behavior is now a bit different from
lfsr_rbyd_compact. Need to revisit lfsr_rbyd_compact and see if it
should do the same.
This had a tiny improvement to code size, which I think is just the cost
of two function calls:
code stack
before: 31716 2776
after: 31676 (-0.1%) 2776 (+0.0%)
This commit is contained in:
@@ -6007,6 +6007,17 @@ static int lfsr_mdir_compact__(lfs_t *lfs, lfsr_mdir_t *mdir_,
|
||||
}
|
||||
}
|
||||
|
||||
// once we've compacted, finish our commit
|
||||
//
|
||||
// upper layers should make sure this can't fail by limiting the
|
||||
// maximum commit size
|
||||
err = lfsr_mdir_commit__(lfs, mdir_, start_rid, end_rid,
|
||||
attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6050,25 +6061,14 @@ compact:;
|
||||
}
|
||||
|
||||
// compact our mdir
|
||||
err = lfsr_mdir_compact__(lfs, &mdir_, start_rid, end_rid, mdir,
|
||||
attrs, attr_count);
|
||||
err = lfsr_mdir_compact__(lfs, &mdir_, start_rid, end_rid,
|
||||
mdir, attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
}
|
||||
|
||||
// we've compacted, try to commit again
|
||||
//
|
||||
// upper layers should make sure this can't fail by limiting the
|
||||
// maximum commit size
|
||||
*mdir = mdir_;
|
||||
err = lfsr_mdir_commit__(lfs, mdir, start_rid, end_rid,
|
||||
attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6542,15 +6542,8 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
|
||||
return err;
|
||||
}
|
||||
|
||||
err = lfsr_mdir_compact__(lfs, &mdir_, 0, split_rid, mdir,
|
||||
attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = lfsr_mdir_commit__(lfs, &mdir_, 0, split_rid,
|
||||
attrs, attr_count);
|
||||
err = lfsr_mdir_compact__(lfs, &mdir_, 0, split_rid,
|
||||
mdir, attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
@@ -6562,15 +6555,8 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
|
||||
return err;
|
||||
}
|
||||
|
||||
err = lfsr_mdir_compact__(lfs, &msibling_, split_rid, -1, mdir,
|
||||
attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = lfsr_mdir_commit__(lfs, &msibling_, split_rid, -1,
|
||||
attrs, attr_count);
|
||||
err = lfsr_mdir_compact__(lfs, &msibling_, split_rid, -1,
|
||||
mdir, attrs, attr_count);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_RANGE);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user