The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fe2418f26ed0b2b9e06152c16f72f2bb4ec27c29

commit fe2418f26ed0b2b9e06152c16f72f2bb4ec27c29
Author:     Gleb Smirnoff <gleb...@freebsd.org>
AuthorDate: 2025-08-20 14:53:20 +0000
Commit:     Gleb Smirnoff <gleb...@freebsd.org>
CommitDate: 2025-08-20 14:53:20 +0000

    libsa/zfs: inline vdev_init_from_label() into vdev_probe()
    
    This function is used only once and also pulls three variables from the
    nvlist that the only caller have already pulled out.
    
    Reviewed by:            mav, imp
    Differential Revision:  https://reviews.freebsd.org/D52031
---
 stand/libsa/zfs/zfsimpl.c | 36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
index bc960a1fe3c0..f15d9b016068 100644
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -1171,30 +1171,6 @@ done:
        return (rc);
 }
 
-static int
-vdev_init_from_label(spa_t *spa, const nvlist_t *nvlist)
-{
-       uint64_t top_guid, label_guid, txg;
-       nvlist_t *vdevs;
-       int rc;
-
-       if (nvlist_find(nvlist, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64,
-           NULL, &top_guid, NULL) ||
-           nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64,
-           NULL, &label_guid, NULL) != 0 ||
-           nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64,
-           NULL, &txg, NULL) != 0 ||
-           nvlist_find(nvlist, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST,
-           NULL, &vdevs, NULL)) {
-               printf("ZFS: can't find vdev details\n");
-               return (ENOENT);
-       }
-
-       rc = vdev_from_nvlist(spa, top_guid, label_guid, txg, vdevs);
-       nvlist_destroy(vdevs);
-       return (rc);
-}
-
 static void
 vdev_set_state(vdev_t *vdev)
 {
@@ -2079,7 +2055,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t 
*_write, void *priv,
        vdev_t vtmp;
        spa_t *spa;
        vdev_t *vdev, *top;
-       nvlist_t *nvl;
+       nvlist_t *nvl, *vdevs;
        uint64_t val;
        uint64_t guid, pool_guid, top_guid, txg;
        const char *pool_name;
@@ -2230,7 +2206,15 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t 
*_write, void *priv,
                return (EIO);
        }
 
-       rc = vdev_init_from_label(spa, nvl);
+       if (nvlist_find(nvl, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, NULL,
+           &vdevs, NULL)) {
+               printf("ZFS: can't find vdev details\n");
+               nvlist_destroy(nvl);
+               return (ENOENT);
+       }
+
+       rc = vdev_from_nvlist(spa, top_guid, guid, txg, vdevs);
+       nvlist_destroy(vdevs);
        nvlist_destroy(nvl);
        if (rc != 0)
                return (rc);

Reply via email to