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

9185 metaslab_verify_weight_and_frag() shouldn't cause side-effects #9209

Closed
wants to merge 1 commit into from

Conversation

sdimitro
Copy link
Contributor

metaslab_verify_weight_and_frag() a verification function and
by the end of it there shouldn't be any side-effects.

The function calls metaslab_weight() which in turn calls
metaslab_set_fragmentation(). The latter can dirty and otherwise
not dirty metaslab fro the next TXGand set metaslab_condense_wanted
if the spacemaps were just upgraded (meaning we just enabled the
SPACEMAP_HISTOGRAM feature through upgrade).

This patch ensures that metaslabs like these are skipped thus
avoiding that problem. We could also get rid of that function
completely but I hesitated because it has caught issues during
development of other features in the past.

Fixing this issue should also help with with most failures that
issue #9186 has been causing to the test-bots recently.

Motivation and Context

Description

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

`metaslab_verify_weight_and_frag()` a verification function and
by the end of it there shouldn't be any side-effects.

The function calls `metaslab_weight()` which in turn calls
`metaslab_set_fragmentation()`. The latter can dirty and otherwise
not dirty metaslab fro the next TXGand set `metaslab_condense_wanted`
if the spacemaps were just upgraded (meaning we just enabled the
SPACEMAP_HISTOGRAM feature through upgrade).

This patch ensures that metaslabs like these are skipped thus
avoiding that problem. We could also get rid of that function
completely but I hesitated because it has caught issues during
development of other features in the past.

Fixing this issue should also help with with most failures that
issue openzfs#9186 has been causing to the test-bots recently.

Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
@codecov
Copy link

codecov bot commented Aug 23, 2019

Codecov Report

Merging #9209 into master will increase coverage by 0.34%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9209      +/-   ##
==========================================
+ Coverage   58.23%   58.58%   +0.34%     
==========================================
  Files         235      235              
  Lines       77720    77570     -150     
==========================================
+ Hits        45259    45442     +183     
+ Misses      32461    32128     -333
Flag Coverage Δ
#kernel 100% <ø> (ø) ⬆️
#user 58.58% <100%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4302698...89e732a. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 23, 2019

Codecov Report

Merging #9209 into master will increase coverage by 1.57%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9209      +/-   ##
==========================================
+ Coverage   77.54%   79.11%   +1.57%     
==========================================
  Files         389      400      +11     
  Lines      121529   122003     +474     
==========================================
+ Hits        94237    96522    +2285     
+ Misses      27292    25481    -1811
Flag Coverage Δ
#kernel 79.73% <100%> (+2.87%) ⬆️
#user 66.81% <100%> (+0.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4302698...89e732a. Read the comment docs.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Aug 26, 2019
* those metaslabs.
*/
if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t))
return;
Copy link
Member

Choose a reason for hiding this comment

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

The comment explains this well, but this seems like this is exposing a poorly-designed corner of the code. Could we do something like pass a nodirty flag to metaslab_weight(), or have a metaslab_weight_impl(), which just recalculates the weight and doesn't check about condensing? That way, if metaslab_weight() decides to mutate the metaslab due to some other condition, the relevant code will be close by, and we won't have to add another check here.

@behlendorf
Copy link
Contributor

Closing. This should be unnecessary with the fix proposed in #9209.

@behlendorf behlendorf closed this Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants