static int
ddt_zap_lookup(objset_t *os, uint64_t object, ddt_entry_t *dde)
{
- uchar_t cbuf[sizeof (dde->dde_phys) + 1];
+ uchar_t *cbuf;
uint64_t one, csize;
int error;
+ cbuf = kmem_alloc(sizeof (dde->dde_phys) + 1, KM_SLEEP);
+
error = zap_length_uint64(os, object, (uint64_t *)&dde->dde_key,
DDT_KEY_WORDS, &one, &csize);
if (error)
- return (error);
+ goto out;
ASSERT(one == 1);
ASSERT(csize <= sizeof (cbuf));
error = zap_lookup_uint64(os, object, (uint64_t *)&dde->dde_key,
DDT_KEY_WORDS, 1, csize, cbuf);
if (error)
- return (error);
+ goto out;
ddt_decompress(cbuf, dde->dde_phys, csize, sizeof (dde->dde_phys));
+out:
+ kmem_free(cbuf, sizeof (dde->dde_phys) + 1);
- return (0);
+ return (error);
}
static void