Merge 1e36c5b9ff
into 50b32cb925
This commit is contained in:
commit
fea5af528d
|
@ -312,7 +312,9 @@ _SYS_NVPAIR_H int nvpair_value_double(const nvpair_t *, double *);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void);
|
||||||
_SYS_NVPAIR_H void fnvlist_free(nvlist_t *);
|
_SYS_NVPAIR_H void fnvlist_free(nvlist_t *);
|
||||||
_SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *);
|
_SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *);
|
||||||
|
_SYS_NVPAIR_H size_t fnvlist_size_xdr(nvlist_t *);
|
||||||
_SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *);
|
_SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *);
|
||||||
|
_SYS_NVPAIR_H char *fnvlist_pack_xdr(nvlist_t *, size_t *);
|
||||||
_SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t);
|
_SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_dup(const nvlist_t *);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_dup(const nvlist_t *);
|
||||||
|
|
|
@ -5287,12 +5287,12 @@ zfs_set_fsacl(zfs_handle_t *zhp, boolean_t un, nvlist_t *nvl)
|
||||||
assert(zhp->zfs_type == ZFS_TYPE_VOLUME ||
|
assert(zhp->zfs_type == ZFS_TYPE_VOLUME ||
|
||||||
zhp->zfs_type == ZFS_TYPE_FILESYSTEM);
|
zhp->zfs_type == ZFS_TYPE_FILESYSTEM);
|
||||||
|
|
||||||
err = nvlist_size(nvl, &nvsz, NV_ENCODE_NATIVE);
|
err = nvlist_size(nvl, &nvsz, NV_ENCODE_XDR);
|
||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
|
|
||||||
nvbuf = malloc(nvsz);
|
nvbuf = malloc(nvsz);
|
||||||
|
|
||||||
err = nvlist_pack(nvl, &nvbuf, &nvsz, NV_ENCODE_NATIVE, 0);
|
err = nvlist_pack(nvl, &nvbuf, &nvsz, NV_ENCODE_XDR, 0);
|
||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
|
|
||||||
zc.zc_nvlist_src_size = nvsz;
|
zc.zc_nvlist_src_size = nvsz;
|
||||||
|
|
|
@ -1225,11 +1225,12 @@ zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen,
|
||||||
nvlist_t *nvl)
|
nvlist_t *nvl)
|
||||||
{
|
{
|
||||||
char *packed;
|
char *packed;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
size_t len = fnvlist_size(nvl);
|
verify(nvlist_size(nvl, &len, NV_ENCODE_XDR) == 0);
|
||||||
packed = zfs_alloc(hdl, len);
|
packed = zfs_alloc(hdl, len);
|
||||||
|
|
||||||
verify(nvlist_pack(nvl, &packed, &len, NV_ENCODE_NATIVE, 0) == 0);
|
verify(nvlist_pack(nvl, &packed, &len, NV_ENCODE_XDR, 0) == 0);
|
||||||
|
|
||||||
*outnv = (uint64_t)(uintptr_t)packed;
|
*outnv = (uint64_t)(uintptr_t)packed;
|
||||||
*outlen = len;
|
*outlen = len;
|
||||||
|
|
|
@ -69,6 +69,14 @@ fnvlist_size(nvlist_t *nvl)
|
||||||
return (size);
|
return (size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
fnvlist_size_xdr(nvlist_t *nvl)
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
VERIFY0(nvlist_size(nvl, &size, NV_ENCODE_XDR));
|
||||||
|
return (size);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns allocated buffer of size *sizep. Caller must free the buffer with
|
* Returns allocated buffer of size *sizep. Caller must free the buffer with
|
||||||
* fnvlist_pack_free().
|
* fnvlist_pack_free().
|
||||||
|
@ -82,6 +90,15 @@ fnvlist_pack(nvlist_t *nvl, size_t *sizep)
|
||||||
return (packed);
|
return (packed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
fnvlist_pack_xdr(nvlist_t *nvl, size_t *sizep)
|
||||||
|
{
|
||||||
|
char *packed = 0;
|
||||||
|
VERIFY3U(nvlist_pack(nvl, &packed, sizep, NV_ENCODE_XDR,
|
||||||
|
KM_SLEEP), ==, 0);
|
||||||
|
return (packed);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fnvlist_pack_free(char *pack, size_t size)
|
fnvlist_pack_free(char *pack, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2757,8 +2757,7 @@ nvlist_xunpack(char *buf, size_t buflen, nvlist_t **nvlp, nv_alloc_t *nva)
|
||||||
if ((err = nvlist_xalloc(&nvl, 0, nva)) != 0)
|
if ((err = nvlist_xalloc(&nvl, 0, nva)) != 0)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
if ((err = nvlist_common(nvl, buf, &buflen, NV_ENCODE_NATIVE,
|
if ((err = nvlist_common(nvl, buf, &buflen, -1, NVS_OP_DECODE)) != 0)
|
||||||
NVS_OP_DECODE)) != 0)
|
|
||||||
nvlist_free(nvl);
|
nvlist_free(nvl);
|
||||||
else
|
else
|
||||||
*nvlp = nvl;
|
*nvlp = nvl;
|
||||||
|
|
|
@ -2530,7 +2530,7 @@ dmu_send_impl(struct dmu_send_params *dspp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nvlist_empty(nvl)) {
|
if (!nvlist_empty(nvl)) {
|
||||||
payload = fnvlist_pack(nvl, &payload_len);
|
payload = fnvlist_pack_xdr(nvl, &payload_len);
|
||||||
drr->drr_payloadlen = payload_len;
|
drr->drr_payloadlen = payload_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2421,6 +2421,7 @@ get_receive_resume_token_impl(dsl_dataset_t *ds)
|
||||||
redact_snaps, num_redact_snaps);
|
redact_snaps, num_redact_snaps);
|
||||||
kmem_free(redact_snaps, int_size * num_redact_snaps);
|
kmem_free(redact_snaps, int_size * num_redact_snaps);
|
||||||
}
|
}
|
||||||
|
/* XXX: using XDR seems to cause performace problems */
|
||||||
packed = fnvlist_pack(token_nv, &packed_size);
|
packed = fnvlist_pack(token_nv, &packed_size);
|
||||||
fnvlist_free(token_nv);
|
fnvlist_free(token_nv);
|
||||||
compressed = kmem_alloc(packed_size, KM_SLEEP);
|
compressed = kmem_alloc(packed_size, KM_SLEEP);
|
||||||
|
|
|
@ -206,7 +206,7 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
|
||||||
/*
|
/*
|
||||||
* Pack the configuration into a buffer.
|
* Pack the configuration into a buffer.
|
||||||
*/
|
*/
|
||||||
buf = fnvlist_pack(nvl, &buflen);
|
buf = fnvlist_pack_xdr(nvl, &buflen);
|
||||||
temp = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
|
temp = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -330,7 +330,7 @@ spa_history_log_sync(void *arg, dmu_tx_t *tx)
|
||||||
fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL));
|
fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL));
|
||||||
}
|
}
|
||||||
|
|
||||||
VERIFY3U(nvlist_pack(nvl, &record_packed, &reclen, NV_ENCODE_NATIVE,
|
VERIFY3U(nvlist_pack(nvl, &record_packed, &reclen, NV_ENCODE_XDR,
|
||||||
KM_SLEEP), ==, 0);
|
KM_SLEEP), ==, 0);
|
||||||
|
|
||||||
mutex_enter(&spa->spa_history_lock);
|
mutex_enter(&spa->spa_history_lock);
|
||||||
|
|
Loading…
Reference in New Issue