t: Moved opened traversal clobbering into lfsr_file_close
Since we're clobbering at the mid-level now, our mtraversals can only
ever point to unsynced reg file handles.
This means we can limit traversal clobbering to lfsr_file_close, and
move it out of the common/simple lfsr_omdir_close.
Look like any code changes canceled out perfectly:
code stack
before: 35356 2688
after: 35356 (-0.0%) 2688 (+0.0%)
This commit is contained in:
@@ -5914,13 +5914,8 @@ static void lfsr_omdir_open(lfs_t *lfs, lfsr_omdir_t *o) {
|
|||||||
lfs->omdirs = o;
|
lfs->omdirs = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed in lfsr_omdir_close
|
|
||||||
static void lfsr_omdir_clobber(lfs_t *lfs, lfsr_omdir_t *o, bool dirty);
|
|
||||||
|
|
||||||
static void lfsr_omdir_close(lfs_t *lfs, lfsr_omdir_t *o) {
|
static void lfsr_omdir_close(lfs_t *lfs, lfsr_omdir_t *o) {
|
||||||
LFS_ASSERT(lfsr_omdir_isopen(lfs, o));
|
LFS_ASSERT(lfsr_omdir_isopen(lfs, o));
|
||||||
// make sure we're not entangled in any traversals
|
|
||||||
lfsr_omdir_clobber(lfs, o, false);
|
|
||||||
// remove from opened list
|
// remove from opened list
|
||||||
for (lfsr_omdir_t **o_ = &lfs->omdirs; *o_; o_ = &(*o_)->next) {
|
for (lfsr_omdir_t **o_ = &lfs->omdirs; *o_; o_ = &(*o_)->next) {
|
||||||
if (*o_ == o) {
|
if (*o_ == o) {
|
||||||
@@ -9983,6 +9978,12 @@ int lfsr_file_close(lfs_t *lfs, lfsr_file_t *file) {
|
|||||||
err = lfsr_file_sync(lfs, file);
|
err = lfsr_file_sync(lfs, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we're unsync, we need to clobber any traversals that may be
|
||||||
|
// referencing our bshrub/memory, but we don't need to mark as dirty
|
||||||
|
if (lfsr_f_isunsync(file->o.flags)) {
|
||||||
|
lfsr_omdir_clobber(lfs, &file->o, false);
|
||||||
|
}
|
||||||
|
|
||||||
// remove from tracked mdirs
|
// remove from tracked mdirs
|
||||||
lfsr_omdir_close(lfs, &file->o);
|
lfsr_omdir_close(lfs, &file->o);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user