Skip to content

Conversation

@robn
Copy link
Member

@robn robn commented Nov 14, 2025

Motivation and Context

@behlendorf made this cool list of stuff we should do, and I started looking into one of them, and now libuutil is gone. Hurrah!

Description

Mostly a mechanical conversion. The uu_ APIs are rather more complex, but we don't seem to use any of the extra features to any great extent. Pools are trivially removed and "walk" iterators are trivially replaced with loops.

There's two changes of note for AVL comparison functions:

  • The uu_avl comparison functions are more lenient on their returns than standard AVLs, which will only accept -1, 0 or 1. Adding TREE_ISIGN around a few strcmp() calls takes care of it.
  • The uu_avl comparison functions can take an argument, passed in through uu_avl_find(). This is used to set the sort order for zfs_iter(). Since we can't pass in an argument any more, I've worked around it by adding the argument to the node. It's a little more memory but the AVL is created, used and destroyed within the same function, so it should be pretty low overhead.

We only used uu_list in one place, in zfs_do_userspace(). I've swapped in the regular lists, however I'm not even sure if what's there is even doing anything. It does a thing to drain the AVL onto a list, then refill it in "sorted" order, but since the AVL wasn't recreated and the list didn't have a comparator, I'm not sure that it even did anything. I might be missing something subtle, so I've left it there.

Removing packaging is just searching out libuutil and removing it everywhere it's mentioned, but I do not know how packages are constructed very well, so this may need more work.

How Has This Been Tested?

Compiles on Linux and FreeBSD. ZTS passed. Package targets appear to produce files, but not 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)
  • 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 November 14, 2025 21:33
Lets just use the AVL implementation we use everywhere else.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
Lets just use the list implementation we use everywhere else.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
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.

That was fast, and this all looks great! As hoped it seems to have been a pretty mechanical change. At least to my eye this updated code is even nicer to read as well. Shedding this extra dependency has been on my wish list for ages. I'll be nice no longer having multiple AVL and list implementations to keep track.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants