MFV 286555: Avoid 128K kmem allocations in mzap_upgrade()

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Approved by: Rich Lowe <richlowe@richlowe.net>

illumos/illumos-gate@be3e2ab906
This commit is contained in:
Alexander Motin 2015-08-09 20:41:44 +00:00
parent 475e2caa3d
commit 1838fc920f

View File

@ -547,7 +547,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags)
ASSERT(RW_WRITE_HELD(&zap->zap_rwlock));
sz = zap->zap_dbuf->db_size;
mzp = kmem_alloc(sz, KM_SLEEP);
mzp = zio_buf_alloc(sz);
bcopy(zap->zap_dbuf->db_data, mzp, sz);
nchunks = zap->zap_m.zap_num_chunks;
@ -555,7 +555,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags)
err = dmu_object_set_blocksize(zap->zap_objset, zap->zap_object,
1ULL << fzap_default_block_shift, 0, tx);
if (err) {
kmem_free(mzp, sz);
zio_buf_free(mzp, sz);
return (err);
}
}
@ -581,7 +581,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags)
if (err)
break;
}
kmem_free(mzp, sz);
zio_buf_free(mzp, sz);
*zapp = zap;
return (err);
}