Skip to content

Commit

Permalink
Make zdb display the compression algorithm and level
Browse files Browse the repository at this point in the history
Signed-off-by: Allan Jude <allan@klarasystems.com>
  • Loading branch information
allanjude committed Jul 6, 2020
1 parent 87bb538 commit 3fef3c8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cmd/zdb/zdb.c
Expand Up @@ -2795,9 +2795,26 @@ dump_object(objset_t *os, uint64_t object, int verbosity,
" (K=%s)", ZDB_CHECKSUM_NAME(doi.doi_checksum));
}

if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) {
if (doi.doi_compress != ZIO_COMPRESS_INHERIT) {
(void) snprintf(aux + strlen(aux), sizeof (aux) - strlen(aux),
" (Z=%s)", ZDB_COMPRESS_NAME(doi.doi_compress));
} else if (ZIO_COMPRESS_HASLEVEL(os->os_compress)) {
const char *compname = NULL;
if (zfs_prop_index_to_string(ZFS_PROP_COMPRESSION,
ZIO_COMPRESS_RAW(os->os_compress, os->os_complevel),
&compname) == 0) {
(void) snprintf(aux + strlen(aux),
sizeof (aux) - strlen(aux), " (Z=inherit=%s)",
compname);
} else {
(void) snprintf(aux + strlen(aux),
sizeof (aux) - strlen(aux),
" (Z=inherit=%s-unknown)",
ZDB_COMPRESS_NAME(os->os_compress));
}
} else {
(void) snprintf(aux + strlen(aux), sizeof (aux) - strlen(aux),
" (Z=inherit=%s)", ZDB_COMPRESS_NAME(os->os_compress));
}

(void) printf("%10lld %3u %5s %5s %5s %6s %5s %6s %s%s\n",
Expand Down

0 comments on commit 3fef3c8

Please sign in to comment.