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

Make txg_wait_synced conditional in zfsvfs_teardown #9115

Merged
merged 1 commit into from Aug 15, 2019

Conversation

PaulZ-98
Copy link
Contributor

@PaulZ-98 PaulZ-98 commented Aug 2, 2019

The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Signed-off-by: Paul Zuchowski pzuchowski@datto.com

The function zfsvfs_teardown only skips txg_wait_synced if the objset is read-only. We can also avoid txg_wait_synced if the objset has no dirty data. Detect if the objset is dirty and don't call txg_wait_synced if it is not.

Motivation and Context

Applications that perform lots of sync tasks are already forcing txg_wait_synced. If the application also limits ZFS mounts by unmounting datasets after use, it could be helpful to performance to avoid txg_wait_synced during unmount when we can.

Description

Add to the conditional test for txg_wait_synced in zfsvfs_teardown.

How Has This Been Tested?

Ran the zfs test suite.

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:

@ahrens ahrens added Status: Code Review Needed Ready for review and testing Type: Performance Performance improvement or performance problem labels Aug 5, 2019
for (int t = 0; t < TXG_SIZE; t++) {
os_dirty = dmu_objset_is_dirty(os, t);
if (os_dirty)
break;
Copy link
Member

Choose a reason for hiding this comment

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

[nit] I think this would be slightly easier to read as:

if (dmu_objset_is_dirty(...)) {
  os_dirty = B_TRUE;
  break;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Matt I made that change.

@ahrens ahrens requested a review from grwilson August 5, 2019 18:31
The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
@codecov
Copy link

codecov bot commented Aug 6, 2019

Codecov Report

Merging #9115 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9115      +/-   ##
==========================================
+ Coverage   79.18%   79.21%   +0.02%     
==========================================
  Files         400      400              
  Lines      121692   121656      -36     
==========================================
+ Hits        96360    96367       +7     
+ Misses      25332    25289      -43
Flag Coverage Δ
#kernel 79.72% <100%> (+0.04%) ⬆️
#user 67.4% <ø> (+0.35%) ⬆️

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 c81f179...16e8c2d. 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 Aug 14, 2019
@behlendorf behlendorf merged commit e2b31b5 into openzfs:master Aug 15, 2019
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Dec 24, 2019
The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes openzfs#9115
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Dec 27, 2019
The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes openzfs#9115
tonyhutter pushed a commit that referenced this pull request Jan 23, 2020
The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #9115
allanjude pushed a commit to KlaraSystems/zfs that referenced this pull request Apr 28, 2020
The call to txg_wait_synced in zfsvfs_teardown should
be made conditional on the objset having dirty data.
This can prevent unnecessary txg_wait_synced during
some unmount operations.

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes openzfs#9115

Signed-off-by: Bryant G. Ly <bly@catalogicsoftware.com>

Conflicts:
	module/zfs/zfs_vfsops.c
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: Performance Performance improvement or performance problem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants