Skip to content

Commit faa1e40

Browse files
nabijaczlewelitonyhutter
authored andcommitted
include: move SPA_MINBLOCKSHIFT and zio_encrypt to sys/fs/zfs.h
These are used by userspace, so should live in a public header Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#12116
1 parent 44cec45 commit faa1e40

File tree

3 files changed

+41
-38
lines changed

3 files changed

+41
-38
lines changed

include/sys/fs/zfs.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,47 @@ typedef enum {
16151615
#define ZFS_EV_HIST_DSID "history_dsid"
16161616
#define ZFS_EV_RESILVER_TYPE "resilver_type"
16171617

1618+
1619+
/*
1620+
* We currently support block sizes from 512 bytes to 16MB.
1621+
* The benefits of larger blocks, and thus larger IO, need to be weighed
1622+
* against the cost of COWing a giant block to modify one byte, and the
1623+
* large latency of reading or writing a large block.
1624+
*
1625+
* Note that although blocks up to 16MB are supported, the recordsize
1626+
* property can not be set larger than zfs_max_recordsize (default 1MB).
1627+
* See the comment near zfs_max_recordsize in dsl_dataset.c for details.
1628+
*
1629+
* Note that although the LSIZE field of the blkptr_t can store sizes up
1630+
* to 32MB, the dnode's dn_datablkszsec can only store sizes up to
1631+
* 32MB - 512 bytes. Therefore, we limit SPA_MAXBLOCKSIZE to 16MB.
1632+
*/
1633+
#define SPA_MINBLOCKSHIFT 9
1634+
#define SPA_OLD_MAXBLOCKSHIFT 17
1635+
#define SPA_MAXBLOCKSHIFT 24
1636+
#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
1637+
#define SPA_OLD_MAXBLOCKSIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT)
1638+
#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
1639+
1640+
1641+
/* supported encryption algorithms */
1642+
enum zio_encrypt {
1643+
ZIO_CRYPT_INHERIT = 0,
1644+
ZIO_CRYPT_ON,
1645+
ZIO_CRYPT_OFF,
1646+
ZIO_CRYPT_AES_128_CCM,
1647+
ZIO_CRYPT_AES_192_CCM,
1648+
ZIO_CRYPT_AES_256_CCM,
1649+
ZIO_CRYPT_AES_128_GCM,
1650+
ZIO_CRYPT_AES_192_GCM,
1651+
ZIO_CRYPT_AES_256_GCM,
1652+
ZIO_CRYPT_FUNCTIONS
1653+
};
1654+
1655+
#define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_GCM
1656+
#define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF
1657+
1658+
16181659
#ifdef __cplusplus
16191660
}
16201661
#endif

include/sys/spa.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,6 @@ struct dsl_pool;
7272
struct dsl_dataset;
7373
struct dsl_crypto_params;
7474

75-
/*
76-
* We currently support block sizes from 512 bytes to 16MB.
77-
* The benefits of larger blocks, and thus larger IO, need to be weighed
78-
* against the cost of COWing a giant block to modify one byte, and the
79-
* large latency of reading or writing a large block.
80-
*
81-
* The recordsize property can not be set larger than zfs_max_recordsize
82-
* (default 16MB on 64-bit and 1MB on 32-bit). See the comment near
83-
* zfs_max_recordsize in dsl_dataset.c for details.
84-
*
85-
* Note that although the LSIZE field of the blkptr_t can store sizes up
86-
* to 32MB, the dnode's dn_datablkszsec can only store sizes up to
87-
* 32MB - 512 bytes. Therefore, we limit SPA_MAXBLOCKSIZE to 16MB.
88-
*/
89-
#define SPA_MINBLOCKSHIFT 9
90-
#define SPA_OLD_MAXBLOCKSHIFT 17
91-
#define SPA_MAXBLOCKSHIFT 24
92-
#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
93-
#define SPA_OLD_MAXBLOCKSIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT)
94-
#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
95-
9675
/*
9776
* Alignment Shift (ashift) is an immutable, internal top-level vdev property
9877
* which can only be set at vdev creation time. Physical writes are always done

include/sys/zio.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,6 @@ enum zio_checksum {
108108

109109
#define ZIO_DEDUPCHECKSUM ZIO_CHECKSUM_SHA256
110110

111-
/* supported encryption algorithms */
112-
enum zio_encrypt {
113-
ZIO_CRYPT_INHERIT = 0,
114-
ZIO_CRYPT_ON,
115-
ZIO_CRYPT_OFF,
116-
ZIO_CRYPT_AES_128_CCM,
117-
ZIO_CRYPT_AES_192_CCM,
118-
ZIO_CRYPT_AES_256_CCM,
119-
ZIO_CRYPT_AES_128_GCM,
120-
ZIO_CRYPT_AES_192_GCM,
121-
ZIO_CRYPT_AES_256_GCM,
122-
ZIO_CRYPT_FUNCTIONS
123-
};
124-
125-
#define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_GCM
126-
#define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF
127-
128111
/* macros defining encryption lengths */
129112
#define ZIO_OBJSET_MAC_LEN 32
130113
#define ZIO_DATA_IV_LEN 12

0 commit comments

Comments
 (0)