Skip to content

Commit

Permalink
Reinstate "Add zstd support to zfs"
Browse files Browse the repository at this point in the history
This commit reverts 1777a1dff, transposed to account for the
un-consolidation into dbuf_alloc_arcbuf_from_arcbuf.
  • Loading branch information
aerusso committed Jun 10, 2021
1 parent a910bb7 commit 3c1a2a9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,7 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, uint64_t txg)
spa_t *spa = db->db_objset->os_spa;
enum zio_compress compress_type =
arc_get_compression(db->db_buf);
uint8_t complevel = arc_get_complevel(db->db_buf);

if (arc_is_encrypted(db->db_buf)) {
boolean_t byteorder;
Expand All @@ -1557,11 +1558,11 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, uint64_t txg)
dr->dt.dl.dr_data = arc_alloc_raw_buf(spa, db,
dmu_objset_id(dn->dn_objset), byteorder, salt, iv,
mac, dn->dn_type, size, arc_buf_lsize(db->db_buf),
compress_type);
compress_type, complevel);
} else if (compress_type != ZIO_COMPRESS_OFF) {
ASSERT3U(type, ==, ARC_BUFC_DATA);
dr->dt.dl.dr_data = arc_alloc_compressed_buf(spa, db,
size, arc_buf_lsize(db->db_buf), compress_type);
size, arc_buf_lsize(db->db_buf), compress_type, complevel);
} else {
dr->dt.dl.dr_data = arc_alloc_buf(spa, db, type, size);
}
Expand Down Expand Up @@ -3270,6 +3271,7 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db)
dbuf_dirty_record_t *dr = db->db_data_pending;
arc_buf_t *data = dr->dt.dl.dr_data;
enum zio_compress compress_type = arc_get_compression(data);
uint8_t complevel = arc_get_complevel(data);

if (arc_is_encrypted(data)) {
boolean_t byteorder;
Expand All @@ -3281,11 +3283,11 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db)
dbuf_set_data(db, arc_alloc_raw_buf(dn->dn_objset->os_spa, db,
dmu_objset_id(dn->dn_objset), byteorder, salt, iv, mac,
dn->dn_type, arc_buf_size(data), arc_buf_lsize(data),
compress_type));
compress_type, complevel));
} else if (compress_type != ZIO_COMPRESS_OFF) {
dbuf_set_data(db, arc_alloc_compressed_buf(
dn->dn_objset->os_spa, db, arc_buf_size(data),
arc_buf_lsize(data), compress_type));
arc_buf_lsize(data), compress_type, complevel));
} else {
dbuf_set_data(db, arc_alloc_buf(dn->dn_objset->os_spa, db,
DBUF_GET_BUFC_TYPE(db), db->db.db_size));
Expand Down Expand Up @@ -4078,6 +4080,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
int lsize = arc_buf_lsize(*datap);
arc_buf_contents_t type = DBUF_GET_BUFC_TYPE(db);
enum zio_compress compress_type = arc_get_compression(*datap);
uint8_t complevel = arc_get_complevel(*datap);

if (arc_is_encrypted(*datap)) {
boolean_t byteorder;
Expand All @@ -4088,11 +4091,11 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
arc_get_raw_params(*datap, &byteorder, salt, iv, mac);
*datap = arc_alloc_raw_buf(os->os_spa, db,
dmu_objset_id(os), byteorder, salt, iv, mac,
dn->dn_type, psize, lsize, compress_type);
dn->dn_type, psize, lsize, compress_type, complevel);
} else if (compress_type != ZIO_COMPRESS_OFF) {
ASSERT3U(type, ==, ARC_BUFC_DATA);
*datap = arc_alloc_compressed_buf(os->os_spa, db,
psize, lsize, compress_type);
psize, lsize, compress_type, complevel);
} else {
*datap = arc_alloc_buf(os->os_spa, db, type, psize);
}
Expand Down

0 comments on commit 3c1a2a9

Please sign in to comment.