From faa1e4082d64ccdb8b9b9b40bcff23b259133a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 27 May 2021 17:09:32 +0200 Subject: [PATCH] include: move SPA_MINBLOCKSHIFT and zio_encrypt to sys/fs/zfs.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are used by userspace, so should live in a public header Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #12116 --- include/sys/fs/zfs.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/sys/spa.h | 21 --------------------- include/sys/zio.h | 17 ----------------- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index c8e199fc67..be6a6b2074 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1615,6 +1615,47 @@ typedef enum { #define ZFS_EV_HIST_DSID "history_dsid" #define ZFS_EV_RESILVER_TYPE "resilver_type" + +/* + * We currently support block sizes from 512 bytes to 16MB. + * The benefits of larger blocks, and thus larger IO, need to be weighed + * against the cost of COWing a giant block to modify one byte, and the + * large latency of reading or writing a large block. + * + * Note that although blocks up to 16MB are supported, the recordsize + * property can not be set larger than zfs_max_recordsize (default 1MB). + * See the comment near zfs_max_recordsize in dsl_dataset.c for details. + * + * Note that although the LSIZE field of the blkptr_t can store sizes up + * to 32MB, the dnode's dn_datablkszsec can only store sizes up to + * 32MB - 512 bytes. Therefore, we limit SPA_MAXBLOCKSIZE to 16MB. + */ +#define SPA_MINBLOCKSHIFT 9 +#define SPA_OLD_MAXBLOCKSHIFT 17 +#define SPA_MAXBLOCKSHIFT 24 +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) +#define SPA_OLD_MAXBLOCKSIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT) +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) + + +/* supported encryption algorithms */ +enum zio_encrypt { + ZIO_CRYPT_INHERIT = 0, + ZIO_CRYPT_ON, + ZIO_CRYPT_OFF, + ZIO_CRYPT_AES_128_CCM, + ZIO_CRYPT_AES_192_CCM, + ZIO_CRYPT_AES_256_CCM, + ZIO_CRYPT_AES_128_GCM, + ZIO_CRYPT_AES_192_GCM, + ZIO_CRYPT_AES_256_GCM, + ZIO_CRYPT_FUNCTIONS +}; + +#define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_GCM +#define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF + + #ifdef __cplusplus } #endif diff --git a/include/sys/spa.h b/include/sys/spa.h index 3eebcd84fc..67724a68f0 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -72,27 +72,6 @@ struct dsl_pool; struct dsl_dataset; struct dsl_crypto_params; -/* - * We currently support block sizes from 512 bytes to 16MB. - * The benefits of larger blocks, and thus larger IO, need to be weighed - * against the cost of COWing a giant block to modify one byte, and the - * large latency of reading or writing a large block. - * - * The recordsize property can not be set larger than zfs_max_recordsize - * (default 16MB on 64-bit and 1MB on 32-bit). See the comment near - * zfs_max_recordsize in dsl_dataset.c for details. - * - * Note that although the LSIZE field of the blkptr_t can store sizes up - * to 32MB, the dnode's dn_datablkszsec can only store sizes up to - * 32MB - 512 bytes. Therefore, we limit SPA_MAXBLOCKSIZE to 16MB. - */ -#define SPA_MINBLOCKSHIFT 9 -#define SPA_OLD_MAXBLOCKSHIFT 17 -#define SPA_MAXBLOCKSHIFT 24 -#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) -#define SPA_OLD_MAXBLOCKSIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT) -#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) - /* * Alignment Shift (ashift) is an immutable, internal top-level vdev property * which can only be set at vdev creation time. Physical writes are always done diff --git a/include/sys/zio.h b/include/sys/zio.h index 5bb7120834..39de5175b7 100644 --- a/include/sys/zio.h +++ b/include/sys/zio.h @@ -108,23 +108,6 @@ enum zio_checksum { #define ZIO_DEDUPCHECKSUM ZIO_CHECKSUM_SHA256 -/* supported encryption algorithms */ -enum zio_encrypt { - ZIO_CRYPT_INHERIT = 0, - ZIO_CRYPT_ON, - ZIO_CRYPT_OFF, - ZIO_CRYPT_AES_128_CCM, - ZIO_CRYPT_AES_192_CCM, - ZIO_CRYPT_AES_256_CCM, - ZIO_CRYPT_AES_128_GCM, - ZIO_CRYPT_AES_192_GCM, - ZIO_CRYPT_AES_256_GCM, - ZIO_CRYPT_FUNCTIONS -}; - -#define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_GCM -#define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF - /* macros defining encryption lengths */ #define ZIO_OBJSET_MAC_LEN 32 #define ZIO_DATA_IV_LEN 12