diff options
author | Ryan Moeller <[email protected]> | 2021-07-27 13:47:27 +0000 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-02-03 15:28:01 -0800 |
commit | ddb5a7a182bd7e6fdbee121411132ab2d8f487df (patch) | |
tree | b8b85a06c2b05f486de2a7c27d5a353d21ef2259 /lib | |
parent | af1630c88361ea84eac9bea92949383fee4c6761 (diff) |
libzfs_sendrecv: Avoid extra avl_find
avl_add does avl_find internally, then avl_insert. We're already doing
the avl_find, so using avl_insert directly avoids repeating the search.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #12967
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 3e2eb5d91..13ac21df9 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -206,8 +206,9 @@ fsavl_create(nvlist_t *fss) * Note: if there are multiple snaps with the * same GUID, we ignore all but one. */ - if (avl_find(fsavl, fn, NULL) == NULL) - avl_add(fsavl, fn); + avl_index_t where = 0; + if (avl_find(fsavl, fn, &where) == NULL) + avl_insert(fsavl, fn, where); else free(fn); } |