mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 19:57:43 +03:00
module/*.ko: prune .data, global .rodata
Evaluated every variable that lives in .data (and globals in .rodata) in the kernel modules, and constified/eliminated/localised them appropriately. This means that all read-only data is now actually read-only data, and, if possible, at file scope. A lot of previously- global-symbols became inlinable (and inlined!) constants. Probably not in a big Wowee Performance Moment, but hey. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12899
This commit is contained in:
@@ -93,7 +93,7 @@ struct {
|
||||
* of multi-page linear ABDs are expensive operations due to KVA mapping and
|
||||
* unmapping, and with time they cause KVA fragmentations.
|
||||
*/
|
||||
size_t zfs_abd_scatter_min_size = PAGE_SIZE + 1;
|
||||
static size_t zfs_abd_scatter_min_size = PAGE_SIZE + 1;
|
||||
|
||||
#if defined(_KERNEL)
|
||||
SYSCTL_DECL(_vfs_zfs);
|
||||
|
||||
@@ -198,7 +198,7 @@ zfs_crypto_dispatch(freebsd_crypt_session_t *session, struct cryptop *crp)
|
||||
static void
|
||||
freebsd_crypt_uio_debug_log(boolean_t encrypt,
|
||||
freebsd_crypt_session_t *input_sessionp,
|
||||
struct zio_crypt_info *c_info,
|
||||
const struct zio_crypt_info *c_info,
|
||||
zfs_uio_t *data_uio,
|
||||
crypto_key_t *key,
|
||||
uint8_t *ivbuf,
|
||||
@@ -241,7 +241,7 @@ freebsd_crypt_uio_debug_log(boolean_t encrypt,
|
||||
#if __FreeBSD_version >= 1300087
|
||||
int
|
||||
freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
|
||||
struct zio_crypt_info *c_info, crypto_key_t *key)
|
||||
const struct zio_crypt_info *c_info, crypto_key_t *key)
|
||||
{
|
||||
struct crypto_session_params csp;
|
||||
int error = 0;
|
||||
@@ -322,7 +322,7 @@ bad:
|
||||
int
|
||||
freebsd_crypt_uio(boolean_t encrypt,
|
||||
freebsd_crypt_session_t *input_sessionp,
|
||||
struct zio_crypt_info *c_info,
|
||||
const struct zio_crypt_info *c_info,
|
||||
zfs_uio_t *data_uio,
|
||||
crypto_key_t *key,
|
||||
uint8_t *ivbuf,
|
||||
@@ -382,7 +382,7 @@ out:
|
||||
#else
|
||||
int
|
||||
freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
|
||||
struct zio_crypt_info *c_info, crypto_key_t *key)
|
||||
const struct zio_crypt_info *c_info, crypto_key_t *key)
|
||||
{
|
||||
struct cryptoini cria, crie, *crip;
|
||||
struct enc_xform *xform;
|
||||
@@ -492,7 +492,7 @@ bad:
|
||||
int
|
||||
freebsd_crypt_uio(boolean_t encrypt,
|
||||
freebsd_crypt_session_t *input_sessionp,
|
||||
struct zio_crypt_info *c_info,
|
||||
const struct zio_crypt_info *c_info,
|
||||
zfs_uio_t *data_uio,
|
||||
crypto_key_t *key,
|
||||
uint8_t *ivbuf,
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
static taskq_t *vdev_file_taskq;
|
||||
|
||||
unsigned long vdev_file_logical_ashift = SPA_MINBLOCKSHIFT;
|
||||
unsigned long vdev_file_physical_ashift = SPA_MINBLOCKSHIFT;
|
||||
static unsigned long vdev_file_logical_ashift = SPA_MINBLOCKSHIFT;
|
||||
static unsigned long vdev_file_physical_ashift = SPA_MINBLOCKSHIFT;
|
||||
|
||||
void
|
||||
vdev_file_init(void)
|
||||
|
||||
@@ -171,7 +171,7 @@ zfs_ace_v0_data(void *acep, void **datap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static acl_ops_t zfs_acl_v0_ops = {
|
||||
static const acl_ops_t zfs_acl_v0_ops = {
|
||||
zfs_ace_v0_get_mask,
|
||||
zfs_ace_v0_set_mask,
|
||||
zfs_ace_v0_get_flags,
|
||||
@@ -307,7 +307,7 @@ zfs_ace_fuid_data(void *acep, void **datap)
|
||||
}
|
||||
}
|
||||
|
||||
static acl_ops_t zfs_acl_fuid_ops = {
|
||||
static const acl_ops_t zfs_acl_fuid_ops = {
|
||||
zfs_ace_fuid_get_mask,
|
||||
zfs_ace_fuid_set_mask,
|
||||
zfs_ace_fuid_get_flags,
|
||||
|
||||
@@ -33,11 +33,11 @@ typedef struct zfs_dbgmsg {
|
||||
char zdm_msg[1]; /* variable length allocation */
|
||||
} zfs_dbgmsg_t;
|
||||
|
||||
list_t zfs_dbgmsgs;
|
||||
int zfs_dbgmsg_size = 0;
|
||||
kmutex_t zfs_dbgmsgs_lock;
|
||||
static list_t zfs_dbgmsgs;
|
||||
static int zfs_dbgmsg_size = 0;
|
||||
static kmutex_t zfs_dbgmsgs_lock;
|
||||
int zfs_dbgmsg_maxsize = 4<<20; /* 4MB */
|
||||
kstat_t *zfs_dbgmsg_kstat;
|
||||
static kstat_t *zfs_dbgmsg_kstat;
|
||||
|
||||
/*
|
||||
* Internal ZFS debug messages are enabled by default.
|
||||
@@ -51,7 +51,7 @@ kstat_t *zfs_dbgmsg_kstat;
|
||||
* # Disable the kernel debug message log.
|
||||
* sysctl vfs.zfs.dbgmsg_enable=0
|
||||
*/
|
||||
int zfs_dbgmsg_enable = 1;
|
||||
int zfs_dbgmsg_enable = B_TRUE;
|
||||
|
||||
static int
|
||||
zfs_dbgmsg_headers(char *buf, size_t size)
|
||||
|
||||
@@ -185,13 +185,7 @@
|
||||
#define ZFS_KEY_MAX_SALT_USES_DEFAULT 400000000
|
||||
#define ZFS_CURRENT_MAX_SALT_USES \
|
||||
(MIN(zfs_key_max_salt_uses, ZFS_KEY_MAX_SALT_USES_DEFAULT))
|
||||
unsigned long zfs_key_max_salt_uses = ZFS_KEY_MAX_SALT_USES_DEFAULT;
|
||||
|
||||
/*
|
||||
* Set to a nonzero value to cause zio_do_crypt_uio() to fail 1/this many
|
||||
* calls, to test decryption error handling code paths.
|
||||
*/
|
||||
uint64_t zio_decrypt_fail_fraction = 0;
|
||||
static unsigned long zfs_key_max_salt_uses = ZFS_KEY_MAX_SALT_USES_DEFAULT;
|
||||
|
||||
typedef struct blkptr_auth_buf {
|
||||
uint64_t bab_prop; /* blk_prop - portable mask */
|
||||
@@ -199,7 +193,7 @@ typedef struct blkptr_auth_buf {
|
||||
uint64_t bab_pad; /* reserved for future use */
|
||||
} blkptr_auth_buf_t;
|
||||
|
||||
zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS] = {
|
||||
const zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS] = {
|
||||
{"", ZC_TYPE_NONE, 0, "inherit"},
|
||||
{"", ZC_TYPE_NONE, 0, "on"},
|
||||
{"", ZC_TYPE_NONE, 0, "off"},
|
||||
@@ -237,7 +231,7 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key)
|
||||
int ret;
|
||||
crypto_mechanism_t mech __unused;
|
||||
uint_t keydata_len;
|
||||
zio_crypt_info_t *ci = NULL;
|
||||
const zio_crypt_info_t *ci = NULL;
|
||||
|
||||
ASSERT3P(key, !=, NULL);
|
||||
ASSERT3U(crypt, <, ZIO_CRYPT_FUNCTIONS);
|
||||
@@ -406,16 +400,13 @@ zio_do_crypt_uio_opencrypto(boolean_t encrypt, freebsd_crypt_session_t *sess,
|
||||
uint64_t crypt, crypto_key_t *key, uint8_t *ivbuf, uint_t datalen,
|
||||
zfs_uio_t *uio, uint_t auth_len)
|
||||
{
|
||||
zio_crypt_info_t *ci;
|
||||
int ret;
|
||||
|
||||
ci = &zio_crypt_table[crypt];
|
||||
const zio_crypt_info_t *ci = &zio_crypt_table[crypt];
|
||||
if (ci->ci_crypt_type != ZC_TYPE_GCM &&
|
||||
ci->ci_crypt_type != ZC_TYPE_CCM)
|
||||
return (ENOTSUP);
|
||||
|
||||
|
||||
ret = freebsd_crypt_uio(encrypt, sess, ci, uio, key, ivbuf,
|
||||
int ret = freebsd_crypt_uio(encrypt, sess, ci, uio, key, ivbuf,
|
||||
datalen, auth_len);
|
||||
if (ret != 0) {
|
||||
#ifdef FCRYPTO_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user