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 <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #12967
This commit is contained in:
Ryan Moeller 2021-07-27 13:47:27 +00:00 committed by Tony Hutter
parent af1630c883
commit ddb5a7a182
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}