Skip to content

Commit ab2894e

Browse files
ahrensbehlendorf
authored andcommitted
Illumos 5135 - zpool_find_import_cached() can use fnvlist_*
Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Max Grossman <max.grossman@delphix.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/5135 illumos/illumos-gate@b18d6b0 Ported by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2693
1 parent d97aa48 commit ab2894e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lib/libzfs/libzfs_import.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,21 +1312,15 @@ zpool_find_import_cached(libzfs_handle_t *hdl, const char *cachefile,
13121312

13131313
elem = NULL;
13141314
while ((elem = nvlist_next_nvpair(raw, elem)) != NULL) {
1315-
verify(nvpair_value_nvlist(elem, &src) == 0);
1315+
src = fnvpair_value_nvlist(elem);
13161316

1317-
verify(nvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME,
1318-
&name) == 0);
1317+
name = fnvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME);
13191318
if (poolname != NULL && strcmp(poolname, name) != 0)
13201319
continue;
13211320

1322-
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
1323-
&this_guid) == 0);
1324-
if (guid != 0) {
1325-
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
1326-
&this_guid) == 0);
1327-
if (guid != this_guid)
1328-
continue;
1329-
}
1321+
this_guid = fnvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID);
1322+
if (guid != 0 && guid != this_guid)
1323+
continue;
13301324

13311325
if (pool_active(hdl, name, this_guid, &active) != 0) {
13321326
nvlist_free(raw);

0 commit comments

Comments
 (0)