aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-08-30 17:13:46 -0400
committerTony Hutter <[email protected]>2021-09-14 15:05:55 -0700
commit72a989cf60b4c7b9a46dc5854c0bd2561ce6b576 (patch)
tree8133d7ee2002161fe3f3c20c7020d3d7c5b15e5c /cmd
parent6bb6410570e6aeb19ae82d9287922927432f8c74 (diff)
Fix cross-endian interoperability of zstd
It turns out that layouts of union bitfields are a pain, and the current code results in an inconsistent layout between BE and LE systems, leading to zstd-active datasets on one erroring out on the other. Switch everyone over to the LE layout, and add compatibility code to read both. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12008 Closes #12022
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zdb/zdb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index c548936bc..e964e3ba8 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -2218,7 +2218,8 @@ snprintf_zstd_header(spa_t *spa, char *blkbuf, size_t buflen,
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf),
" ZSTD:size=%u:version=%u:level=%u:EMBEDDED",
- zstd_hdr.c_len, zstd_hdr.version, zstd_hdr.level);
+ zstd_hdr.c_len, zfs_get_hdrversion(&zstd_hdr),
+ zfs_get_hdrlevel(&zstd_hdr));
return;
}
@@ -2242,7 +2243,8 @@ snprintf_zstd_header(spa_t *spa, char *blkbuf, size_t buflen,
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf),
" ZSTD:size=%u:version=%u:level=%u:NORMAL",
- zstd_hdr.c_len, zstd_hdr.version, zstd_hdr.level);
+ zstd_hdr.c_len, zfs_get_hdrversion(&zstd_hdr),
+ zfs_get_hdrlevel(&zstd_hdr));
abd_return_buf_copy(pabd, buf, BP_GET_LSIZE(bp));
}