Skip to content

Conversation

@robn
Copy link
Member

@robn robn commented Jan 7, 2026

Motivation and Context

Just a few small cleanup targets of opportunity while studying symbol exports.

Description

See commit messages. Summary:

  • remove the unusued spinlocks that protected the old "heavy" atomics, long deleted
  • move 64-bit math compat functions to separate source file
  • unexport kstat_proc_entry_* APIs
  • remove a spurious _KERNEL check

How Has This Been Tested?

ZTS run completed.

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)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • 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:

robn added 4 commits January 6, 2026 21:30
Long ago, SPL atomics were implemented as a global spinlock over
conventional operations. In 5e9b5d8 (2009-10) they was converted to
proper atomics, with the spinlock retained as a fallback.

The switch to compile with the fallback was later removed in a912589
(2018-05), but the code it enabled wasn't. So lets do that.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
It's a lot of rarely-compiled code, so move it to the side to make other
code easier to read.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
These are used to implement the kstat and procfs_list interfaces, and
aren't used from outside. There's no need to export them.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
This code is only compiled for the Linux kernel module, so that define
is always set.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[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 am surprised that kernel does not provide 64bit math...

@amotin amotin added the Status: Code Review Needed Ready for review and testing label Jan 8, 2026
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.

Well these days the kernel does provide 64-bit division on 32-bit architectures as long as you use the various helper function do_div, div64_u64, div64_s64. This was originally needed way back in 2010. These days we could likely just provide the __udivdi3, __divdi3, symbols as wrappers around those helpers. But that would be for another PR, the cleanup itself looks good!

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jan 8, 2026
@behlendorf behlendorf closed this in 2ca6e88 Jan 8, 2026
behlendorf pushed a commit that referenced this pull request Jan 8, 2026
It's a lot of rarely-compiled code, so move it to the side to make other
code easier to read.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #18117
behlendorf pushed a commit that referenced this pull request Jan 8, 2026
These are used to implement the kstat and procfs_list interfaces, and
aren't used from outside. There's no need to export them.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #18117
behlendorf pushed a commit that referenced this pull request Jan 8, 2026
This code is only compiled for the Linux kernel module, so that define
is always set.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #18117
@robn robn deleted the spl-tidy branch January 9, 2026 02: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.

3 participants