aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorTom Caputi <tcaputi@datto.com>2017-11-08 19:12:59 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2018-02-02 19:37:16 +0000
commitae76f45cda0e0857f99e53959cf71c7a5d66bd8b (patch)
treee1c3cabe0971272785a442d6fb627bf6ebd07148 /module/zfs/arc.c
parent4c46b99d24a6e71b3c72462c11cb051d0930ad60 (diff)
downloadsrc-ae76f45cda0e0857f99e53959cf71c7a5d66bd8b.tar.gz
src-ae76f45cda0e0857f99e53959cf71c7a5d66bd8b.zip
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 45b0abe7fd6c..2f3fe97719d5 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -1229,6 +1229,7 @@ hdr_full_cons(void *vbuf, void *unused, int kmflag)
arc_buf_hdr_t *hdr = vbuf;
bzero(hdr, HDR_FULL_SIZE);
+ hdr->b_l1hdr.b_byteswap = DMU_BSWAP_NUMFUNCS;
cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL);
refcount_create(&hdr->b_l1hdr.b_refcnt);
mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL);
@@ -3246,9 +3247,6 @@ arc_hdr_alloc_abd(arc_buf_hdr_t *hdr, boolean_t alloc_rdata)
ASSERT(!HDR_SHARED_DATA(hdr) || alloc_rdata);
IMPLY(alloc_rdata, HDR_PROTECTED(hdr));
- if (hdr->b_l1hdr.b_pabd == NULL && !HDR_HAS_RABD(hdr))
- hdr->b_l1hdr.b_byteswap = DMU_BSWAP_NUMFUNCS;
-
if (alloc_rdata) {
size = HDR_GET_PSIZE(hdr);
ASSERT3P(hdr->b_crypt_hdr.b_rabd, ==, NULL);
@@ -6751,6 +6749,17 @@ arc_write_ready(zio_t *zio)
ASSERT3U(BP_GET_TYPE(bp), !=, DMU_OT_INTENT_LOG);
ASSERT(HDR_PROTECTED(hdr));
+ if (BP_SHOULD_BYTESWAP(bp)) {
+ if (BP_GET_LEVEL(bp) > 0) {
+ hdr->b_l1hdr.b_byteswap = DMU_BSWAP_UINT64;
+ } else {
+ hdr->b_l1hdr.b_byteswap =
+ DMU_OT_BYTESWAP(BP_GET_TYPE(bp));
+ }
+ } else {
+ hdr->b_l1hdr.b_byteswap = DMU_BSWAP_NUMFUNCS;
+ }
+
hdr->b_crypt_hdr.b_ot = BP_GET_TYPE(bp);
hdr->b_crypt_hdr.b_dsobj = zio->io_bookmark.zb_objset;
zio_crypt_decode_params_bp(bp, hdr->b_crypt_hdr.b_salt,