Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor parts of block_fs.cpp #3233

Merged
merged 6 commits into from
Apr 8, 2022
Merged

Refactor parts of block_fs.cpp #3233

merged 6 commits into from
Apr 8, 2022

Conversation

pinkwah
Copy link
Contributor

@pinkwah pinkwah commented Apr 7, 2022

This is the commits from #3194 except for the controversial last one.

@@ -1096,22 +1074,18 @@ void block_fs_fwrite_buffer(block_fs_type *block_fs, const char *filename,

void block_fs_fread_realloc_buffer(block_fs_type *block_fs,
const char *filename, buffer_type *buffer) {
block_fs_aquire_rlock(block_fs);
std::lock_guard guard{block_fs->mutex};
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra block...?

free(data_ext);
free(lock_ext);
}

/*
This function is called both when allocating a new block_fs
instance, and when an existing block_fs instance is 'rotated'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"rotated" mentioned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look again 🪄

Note how the only place in production where the `block_level_lock` is
set, it is fixed to `false`. The lock exists further up the stack inside
`enkf_fs`. Therefore it is safe to remove this functionality.

: w

block_fs: remove unused `.lock` functionality

Note how the only place in production where the `block_level_lock` is
set, it is fixed to `false`. The lock exists further up the stack inside
`enkf_fs`. Therefore it is safe to remove this functionality.
Note how this value is set only in one place, and it is set to `1.0`.
The comment next to this line says that a fragmentation_limit of `1.0`
means no fragmentation is run. Hence this is safe.
This is not necessary, as the paths are now only used for diagnostics
and initialisation.
@codecov-commenter
Copy link

codecov-commenter commented Apr 7, 2022

Codecov Report

Merging #3233 (5a0ecaa) into main (b6f194d) will decrease coverage by 0.01%.
The diff coverage is 61.53%.

@@            Coverage Diff             @@
##             main    #3233      +/-   ##
==========================================
- Coverage   65.68%   65.67%   -0.02%     
==========================================
  Files         614      614              
  Lines       49045    48815     -230     
  Branches     4407     4405       -2     
==========================================
- Hits        32216    32060     -156     
+ Misses      15357    15271      -86     
- Partials     1472     1484      +12     
Impacted Files Coverage Δ
libres/lib/res_util/block_fs.cpp 52.54% <57.77%> (-0.06%) ⬇️
libres/lib/enkf/block_fs_driver.cpp 80.23% <85.71%> (-1.02%) ⬇️
ert_gui/tools/plot/plot_api.py 82.35% <0.00%> (-9.76%) ⬇️
ert/data/record/_transformation.py 88.23% <0.00%> (-0.50%) ⬇️
ert_shared/main.py 86.47% <0.00%> (+0.40%) ⬆️
ert_gui/gert_main.py 96.25% <0.00%> (+1.10%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@BjarneHerland BjarneHerland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@pinkwah pinkwah merged commit 5d1eaae into equinor:main Apr 8, 2022
@pinkwah pinkwah deleted the refactor-bfs2 branch April 8, 2022 14:13
@sondreso sondreso added the release-notes:improvement Automatically categorise as improvement in release notes label Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:improvement Automatically categorise as improvement in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants