Skip to content

Commit fe2418f

Browse files
committed
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
1 parent a1572e2 commit fe2418f

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

stand/libsa/zfs/zfsimpl.c

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,30 +1171,6 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, uint64_t label_guid,
11711171
return (rc);
11721172
}
11731173

1174-
static int
1175-
vdev_init_from_label(spa_t *spa, const nvlist_t *nvlist)
1176-
{
1177-
uint64_t top_guid, label_guid, txg;
1178-
nvlist_t *vdevs;
1179-
int rc;
1180-
1181-
if (nvlist_find(nvlist, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64,
1182-
NULL, &top_guid, NULL) ||
1183-
nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64,
1184-
NULL, &label_guid, NULL) != 0 ||
1185-
nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64,
1186-
NULL, &txg, NULL) != 0 ||
1187-
nvlist_find(nvlist, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST,
1188-
NULL, &vdevs, NULL)) {
1189-
printf("ZFS: can't find vdev details\n");
1190-
return (ENOENT);
1191-
}
1192-
1193-
rc = vdev_from_nvlist(spa, top_guid, label_guid, txg, vdevs);
1194-
nvlist_destroy(vdevs);
1195-
return (rc);
1196-
}
1197-
11981174
static void
11991175
vdev_set_state(vdev_t *vdev)
12001176
{
@@ -2079,7 +2055,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv,
20792055
vdev_t vtmp;
20802056
spa_t *spa;
20812057
vdev_t *vdev, *top;
2082-
nvlist_t *nvl;
2058+
nvlist_t *nvl, *vdevs;
20832059
uint64_t val;
20842060
uint64_t guid, pool_guid, top_guid, txg;
20852061
const char *pool_name;
@@ -2230,7 +2206,15 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv,
22302206
return (EIO);
22312207
}
22322208

2233-
rc = vdev_init_from_label(spa, nvl);
2209+
if (nvlist_find(nvl, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, NULL,
2210+
&vdevs, NULL)) {
2211+
printf("ZFS: can't find vdev details\n");
2212+
nvlist_destroy(nvl);
2213+
return (ENOENT);
2214+
}
2215+
2216+
rc = vdev_from_nvlist(spa, top_guid, guid, txg, vdevs);
2217+
nvlist_destroy(vdevs);
22342218
nvlist_destroy(nvl);
22352219
if (rc != 0)
22362220
return (rc);

0 commit comments

Comments
 (0)