Skip to content

Make the vfs.zfs.vdev.raidz_impl sysctl cross-platform #16980

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

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

asomers
Copy link
Contributor

@asomers asomers commented Jan 22, 2025

Signed-off-by: Alan Somers [email protected]
Sponsored by: ConnectWise

Motivation and Context

It creates a vfs.zfs.vdev.raidz_impl sysctl on FreeBSD, so the implementation can be queried or changed.

Description

Replace the Linux-specific module_param_call and MODULE_PARM_DESC with the portable ZFS_MODULE_PARAM_CALL.

How Has This Been Tested?

Tested on FreeBSD. Tried creating pools with every available raidz_impl testing. On Linux, compile-tested only.

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)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly. (the setting was already in the man page)
  • 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.

Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
@amotin amotin added the Status: Work in Progress Not yet ready for general review label Jan 23, 2025
@asomers asomers force-pushed the vfs.zfs.vdev.raidz_impl branch from f27d84f to 6a214e6 Compare January 23, 2025 18:30
Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

It seems you are stil changing the behavior on Linus by using param_get_charp() instead of vdev_raidz_impl_get() before. I am not sure it is possible to drop the zfs_vdev_raidz_impl variable completely with existing macros, but I don't think it is really needed here.

@asomers
Copy link
Contributor Author

asomers commented Jan 23, 2025

It seems you are stil changing the behavior on Linus by using param_get_charp() instead of vdev_raidz_impl_get() before. I am not sure it is possible to drop the zfs_vdev_raidz_impl variable completely with existing macros, but I don't think it is really needed here.

Yes, exactly. The existing macros seem to require that variable.

@amotin
Copy link
Member

amotin commented Jan 23, 2025

Yes, exactly. The existing macros seem to require that variable.

But nobody should force you to use it, if as I understand in this case arbitrary string needs to be produced.

Instead, define the FreeBSD and Linux sysctls separately.

Signed-off-by:	Alan Somers <[email protected]>
Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

That was an unexpected move.

@asomers
Copy link
Contributor Author

asomers commented Jan 24, 2025

That was an unexpected move.

Umm, what was unexpected?

@amotin
Copy link
Member

amotin commented Jan 24, 2025

That was an unexpected move.

Umm, what was unexpected?

Splitting the tunable into two completely separate for FreeBSD and Linux. You just missed one function, but decided to turn 180 degrees and go other direction.

@asomers
Copy link
Contributor Author

asomers commented Jan 24, 2025

Splitting the tunable into two completely separate for FreeBSD and Linux. You just missed one function, but decided to turn 180 degrees and go other direction.

Well, what would you like for me to do?

@amotin
Copy link
Member

amotin commented Jan 24, 2025

I was thinking you replace spl_param_get_charp() with a wrapper around vdev_raidz_impl_get().

@amotin amotin added the Status: Code Review Needed Ready for review and testing label Jan 24, 2025
Copy link
Contributor

@allanjude allanjude left a comment

Choose a reason for hiding this comment

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

Reviewed-by: Allan Jude <[email protected]>

Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

I have no objections, but asking myself how hard should we push cross-platform implementation for procedural parameters. It would be good, but use existing set of macros for it seemed pretty messy when Alan tried.

@amotin amotin removed the Status: Work in Progress Not yet ready for general review label Jan 24, 2025
@asomers
Copy link
Contributor Author

asomers commented Jan 24, 2025

The latest push returns to using the cross-platform macro. I'm ok with committing either version.

Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

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

I don't think you need to rename zfs_vdev_raidz_impl into zfs_vdev_raidz_impl_setting and add separate zfs_vdev_raidz_impl. Just leave them as they were. As I understand Linux will pass the argument to the get/set methods, which you may use or not. I wonder if it could be passed on FreeBSD also, so that we could avoid global symbol.

The ZFS_MODULE_PARAM_CALL macro still requires a symbol by this name,
but apparently doesn't care about its type.

Signed-off-by: Alan Somers <[email protected]>
@amotin
Copy link
Member

amotin commented Jan 24, 2025

@asomers Take a note of checkstype error: ./module/os/linux/zfs/vdev_raidz.c: 32: unparenthesized return expression.

Signed-off-by: Alan Somers <[email protected]>
@amotin amotin added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jan 28, 2025
@amotin amotin merged commit 12f0baf into openzfs:master Jan 29, 2025
24 of 25 checks passed
@asomers asomers deleted the vfs.zfs.vdev.raidz_impl branch January 29, 2025 16:12
ixhamza pushed a commit to ixhamza/zfs that referenced this pull request Feb 25, 2025
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes openzfs#16980
ixhamza pushed a commit to truenas/zfs that referenced this pull request Feb 25, 2025
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes openzfs#16980
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.

3 participants