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

Add trim support to zpool wait #10071

Merged
merged 1 commit into from
Mar 4, 2020
Merged

Conversation

jgallag88
Copy link
Contributor

Motivation and Context

#9162 added zpool wait, which provides a mechanism for waiting synchronously for the completion of long-running pool activities such as scrubs and device removals. zpool wait doesn't support waiting for the completion of manual trim operations though, since it was written initially before trim support was integrated. However, manual trims fall into the category of long-running pool activities which people might want to wait synchronously for, so this change adds the missing trim support to zpool wait.

Description

With this change, users can run zpool wait -t trim <pool> to wait for all of the vdevs in the pool with trims in progress to finish being trimmed. They can also add a -w flag to the command that starts the trim (i.e. zpool trim -w <pool>) to make zpool trim synchronous.

The logic to wait for trims to complete is implemented in a very similar manner to the logic to wait for device initialization to complete, since the interfaces for and implementations of trimming and initialization are very similar.

How Has This Been Tested?

Added tests to cover the new functionality.

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:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Feb 27, 2020
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this last bit of zpool wait functionality!

Manual trims fall into the category of long-running pool activities
which people might want to wait synchronously for. This change adds
support to 'zpool wait' for waiting for manual trim operations to
complete. It also adds a '-w' flag to 'zpool trim' which can be used to
turn 'zpool trim' into a synchronous operation.

Signed-off-by: John Gallagher <john.gallagher@delphix.com>
@ahrens ahrens added the Type: Feature Feature request or new feature label Feb 28, 2020
@codecov-io
Copy link

codecov-io commented Feb 28, 2020

Codecov Report

Merging #10071 into master will decrease coverage by <1%.
The diff coverage is 82%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #10071    +/-   ##
========================================
- Coverage      79%      79%   -<1%     
========================================
  Files         386      386            
  Lines      122316   122349    +33     
========================================
- Hits        97059    97005    -54     
- Misses      25257    25344    +87
Flag Coverage Δ
#kernel 79% <100%> (ø) ⬇️
#user 67% <56%> (ø) ⬇️

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 3d5ba1c...71e407b. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Mar 3, 2020
@behlendorf behlendorf merged commit 2288d41 into openzfs:master Mar 4, 2020
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
Manual trims fall into the category of long-running pool activities
which people might want to wait synchronously for. This change adds
support to 'zpool wait' for waiting for manual trim operations to
complete. It also adds a '-w' flag to 'zpool trim' which can be used to
turn 'zpool trim' into a synchronous operation.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Signed-off-by: John Gallagher <john.gallagher@delphix.com>
Closes openzfs#10071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested) Type: Feature Feature request or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants