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

Allow platform dependent path stripping for vdevs #9565

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

ghost
Copy link

@ghost ghost commented Nov 8, 2019

Motivation and Context

On Linux the full path preceding devices is stripped when formatting vdev names. On FreeBSD we only want to strip "/dev/".

Description

Hide the implementation details of path stripping behind zfs_strip_path().

Make zfs_strip_partition_path() static in Linux implementation while here, since it is never used outside of the file it is defined in. Some reordering was performed to logically group function definitions before use in the file after removing the forward declaration.

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:

On Linux the full path preceding devices is stripped when formatting
vdev names. On FreeBSD we only want to strip "/dev/". Hide the
implementation details of path stripping behind zfs_strip_path().

Make zfs_strip_partition_path() static in Linux implementation while
here, since it is never used outside of the file it is defined in.

Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
@ghost ghost added the Status: Code Review Needed Ready for review and testing label Nov 8, 2019
@behlendorf behlendorf requested a review from don-brady November 8, 2019 21:45
@codecov
Copy link

codecov bot commented Nov 9, 2019

Codecov Report

Merging #9565 into master will increase coverage by 0.09%.
The diff coverage is 90.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9565      +/-   ##
==========================================
+ Coverage   79.16%   79.26%   +0.09%     
==========================================
  Files         418      418              
  Lines      123686   123687       +1     
==========================================
+ Hits        97917    98039     +122     
+ Misses      25769    25648     -121
Flag Coverage Δ
#kernel 79.74% <ø> (+0.06%) ⬆️
#user 67.37% <90.62%> (+0.31%) ⬆️

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 734de7c...98af872. Read the comment docs.

@ghost
Copy link
Author

ghost commented Nov 11, 2019

can we simply unify how they show device paths so all platforms behave consistently

I don't think so. Each platform has very different device naming practices to account for. Portions of the path after /dev/ are important to display on FreeBSD, for example to differentiate /dev/mirror/foo from /dev/label/foo or /dev/gpt/foo. On Linux I believe a conscious decision was made to shorten the display name for formatting purposes due to the common use of longer names such as /dev/disk/by-path/pci-000:00:1f.2-ata-4.0-part1 or /dev/disk/by-partuuid/9d1dba85-f82a-4025-943d-797e4096e386. On illumos a different approach is required as well. Letting each platform handle its particular needs separately makes sense.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Nov 11, 2019
@behlendorf
Copy link
Contributor

While I agree that it might be nice in principle to have a common implementation, practically speaking this is one area where the platforms are significantly different. Letting each platform provide its own functions for this is very reasonable, and not that much code.

@behlendorf behlendorf merged commit 035ebb3 into openzfs:master Nov 11, 2019
@ghost ghost deleted the dev-path-stripping branch November 11, 2019 20:37
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant