From 5c27ec10889d3d8f12d59fb7e5068ed2d8697c85 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Fri, 6 Apr 2018 13:30:26 -0700 Subject: Fixes for SNPRINTF_BLKPTR with encrypted BP's mdb doesn't have dmu_ot[], so we need a different mechanism for its SNPRINTF_BLKPTR() to determine if the BP is encrypted vs authenticated. Additionally, since it already relies on BP_IS_ENCRYPTED (etc), SNPRINTF_BLKPTR might as well figure out the "crypt_type" on its own, rather than making the caller do so. Reviewed-by: Brian Behlendorf Reviewed-by: Tom Caputi Signed-off-by: Matthew Ahrens Closes #7390 --- module/zfs/spa_misc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'module') diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 5e2af24e3..17f8c1638 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1421,7 +1421,6 @@ snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp) char type[256]; char *checksum = NULL; char *compress = NULL; - char *crypt_type = NULL; if (bp != NULL) { if (BP_GET_TYPE(bp) & DMU_OT_NEWTYPE) { @@ -1435,15 +1434,6 @@ snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp) (void) strlcpy(type, dmu_ot[BP_GET_TYPE(bp)].ot_name, sizeof (type)); } - if (BP_IS_ENCRYPTED(bp)) { - crypt_type = "encrypted"; - } else if (BP_IS_AUTHENTICATED(bp)) { - crypt_type = "authenticated"; - } else if (BP_HAS_INDIRECT_MAC_CKSUM(bp)) { - crypt_type = "indirect-MAC"; - } else { - crypt_type = "unencrypted"; - } if (!BP_IS_EMBEDDED(bp)) { checksum = zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name; @@ -1452,7 +1442,7 @@ snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp) } SNPRINTF_BLKPTR(snprintf, ' ', buf, buflen, bp, type, checksum, - crypt_type, compress); + compress); } void -- cgit v1.2.3