Skip to content

Prefer VERIFY0 over comparision with 0 or NULL#17591

Closed
robn wants to merge 5 commits intoopenzfs:masterfrom
robn:verify-zero
Closed

Prefer VERIFY0 over comparision with 0 or NULL#17591
robn wants to merge 5 commits intoopenzfs:masterfrom
robn:verify-zero

Conversation

@robn
Copy link
Copy Markdown
Member

@robn robn commented Aug 4, 2025

Motivation and Context

VERIFY0(n) gives better output than VERIFY(n == 0) because it'll show both values, and its shorter to type than VERIFY3U(n, == 0). So let's do that, and same for ASSERT and pointer variants too,

Description

  • Use VERIFY0(n) instead of VERIFY(n == 0), VERIFY3U(n, ==, 0), VERIFY3S(n, ==, 0)
  • Use ASSERT0(n) instead of ASSERTn == 0), ASSERT3U(n, ==, 0), ASSERT3S(n, ==, 0)
  • Use VERIFY0P(n) instead of VERIFY(n == NULL), VERIFY3P(n, ==, NULL)
  • Use ASSERT0P(n) instead of ASSERT(n == NULL), ASSERT3P(n, ==, NULL)

How Has This Been Tested?

Compile checked on Linux and FreeBSD, with and without --enable-debug. ZTS run completed on Linux with --enable-debug.

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:

Copy link
Copy Markdown
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.

Thanks. This partially overlaps with old #14424. I tend to close it now, but wonder if you wish to take anything out of it, even if only ideas.

@robn
Copy link
Copy Markdown
Member Author

robn commented Aug 5, 2025

Yeah, I'm headed in the same direction as those. Nothing more for this PR; its the sort of thing I just do when I have a free evening and don't want to think too hard :)

@amotin amotin added Status: Code Review Needed Ready for review and testing Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Aug 5, 2025
Copy link
Copy Markdown
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.

Nice. If you can resolve the latest conflicts I'll get this bit of cleanup merged.

robn added 5 commits August 7, 2025 07:31
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
@robn
Copy link
Copy Markdown
Member Author

robn commented Aug 6, 2025

Rebased!

@github-actions github-actions Bot removed the Status: Accepted Ready to integrate (reviewed, tested) label Aug 6, 2025
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Aug 6, 2025
@behlendorf behlendorf closed this in c39e076 Aug 7, 2025
behlendorf pushed a commit that referenced this pull request Aug 7, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #17591
behlendorf pushed a commit that referenced this pull request Aug 7, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #17591
behlendorf pushed a commit that referenced this pull request Aug 7, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #17591
behlendorf pushed a commit that referenced this pull request Aug 7, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #17591
spauka pushed a commit to spauka/zfs that referenced this pull request Aug 30, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
spauka pushed a commit to spauka/zfs that referenced this pull request Aug 30, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
spauka pushed a commit to spauka/zfs that referenced this pull request Aug 30, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
spauka pushed a commit to spauka/zfs that referenced this pull request Aug 30, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
spauka pushed a commit to spauka/zfs that referenced this pull request Aug 30, 2025
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
@robn robn deleted the verify-zero branch January 9, 2026 02:37
lundman pushed a commit to openzfsonosx/openzfs-fork that referenced this pull request Jan 30, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonosx/openzfs-fork that referenced this pull request Jan 30, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonosx/openzfs-fork that referenced this pull request Jan 30, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonosx/openzfs-fork that referenced this pull request Jan 30, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonosx/openzfs-fork that referenced this pull request Jan 30, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Feb 23, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Feb 23, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Feb 23, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Feb 23, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Feb 23, 2026
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes openzfs#17591
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