aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-01-15 00:37:55 +0100
committerGitHub <[email protected]>2022-01-14 15:37:55 -0800
commit18168da727427e28914235137daebe06c23069cd (patch)
tree71a8769a2a12dd4add4f7abfb5a1e4f51f09cf18 /include
parent7adc19009817303af10c8b3b7617850994cfb9e2 (diff)
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 <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12899
Diffstat (limited to 'include')
-rw-r--r--include/libzfs.h2
-rw-r--r--include/os/freebsd/zfs/sys/freebsd_crypto.h4
-rw-r--r--include/os/freebsd/zfs/sys/zfs_context_os.h2
-rw-r--r--include/os/freebsd/zfs/sys/zfs_znode_impl.h3
-rw-r--r--include/os/linux/spl/rpc/xdr.h3
-rw-r--r--include/os/linux/spl/sys/sysmacros.h1
-rw-r--r--include/os/linux/spl/sys/taskq.h3
-rw-r--r--include/os/linux/zfs/sys/zfs_znode_impl.h3
-rw-r--r--include/os/linux/zfs/sys/zpl.h1
-rw-r--r--include/sys/crypto/api.h2
-rw-r--r--include/sys/dmu.h1
-rw-r--r--include/sys/dmu_recv.h2
-rw-r--r--include/sys/dsl_dataset.h5
-rw-r--r--include/sys/dsl_pool.h1
-rw-r--r--include/sys/fs/zfs.h3
-rw-r--r--include/sys/metaslab.h4
-rw-r--r--include/sys/metaslab_impl.h2
-rw-r--r--include/sys/nvpair.h8
-rw-r--r--include/sys/range_tree.h10
-rw-r--r--include/sys/sa.h3
-rw-r--r--include/sys/spa.h3
-rw-r--r--include/sys/spa_impl.h2
-rw-r--r--include/sys/vdev_impl.h2
-rw-r--r--include/sys/vdev_raidz_impl.h4
-rw-r--r--include/sys/zfs_acl.h2
-rw-r--r--include/sys/zfs_context.h2
-rw-r--r--include/sys/zfs_ioctl_impl.h1
-rw-r--r--include/sys/zfs_sa.h3
-rw-r--r--include/sys/zil.h4
-rw-r--r--include/sys/zio.h2
-rw-r--r--include/sys/zio_crypt.h2
-rw-r--r--include/sys/zvol_impl.h3
-rw-r--r--include/zfs_comutil.h2
-rw-r--r--include/zfs_deleg.h2
34 files changed, 45 insertions, 52 deletions
diff --git a/include/libzfs.h b/include/libzfs.h
index e135ae2ee..fe70a5b3a 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -452,7 +452,7 @@ _LIBZFS_H void zpool_print_unsup_feat(nvlist_t *config);
*/
struct zfs_cmd;
-_LIBZFS_H const char *zfs_history_event_names[];
+_LIBZFS_H const char *const zfs_history_event_names[];
typedef enum {
VDEV_NAME_PATH = 1 << 0,
diff --git a/include/os/freebsd/zfs/sys/freebsd_crypto.h b/include/os/freebsd/zfs/sys/freebsd_crypto.h
index e240f5b0d..a3ed41826 100644
--- a/include/os/freebsd/zfs/sys/freebsd_crypto.h
+++ b/include/os/freebsd/zfs/sys/freebsd_crypto.h
@@ -88,11 +88,11 @@ void crypto_mac_final(struct hmac_ctx *ctx, void *out_data,
size_t out_data_size);
int freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
- struct zio_crypt_info *, crypto_key_t *);
+ const struct zio_crypt_info *, crypto_key_t *);
void freebsd_crypt_freesession(freebsd_crypt_session_t *sessp);
int freebsd_crypt_uio(boolean_t, freebsd_crypt_session_t *,
- struct zio_crypt_info *, zfs_uio_t *, crypto_key_t *, uint8_t *,
+ const struct zio_crypt_info *, zfs_uio_t *, crypto_key_t *, uint8_t *,
size_t, size_t);
#endif /* _ZFS_FREEBSD_CRYPTO_H */
diff --git a/include/os/freebsd/zfs/sys/zfs_context_os.h b/include/os/freebsd/zfs/sys/zfs_context_os.h
index a32eb52c5..867199501 100644
--- a/include/os/freebsd/zfs/sys/zfs_context_os.h
+++ b/include/os/freebsd/zfs/sys/zfs_context_os.h
@@ -48,7 +48,7 @@
#define cond_resched() kern_yield(PRI_USER)
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
- (taskq_create(a, b, maxclsyspri, d, e, f))
+ ((void) sizeof (dc), taskq_create(a, b, maxclsyspri, d, e, f))
#define tsd_create(keyp, destructor) do { \
*(keyp) = osd_thread_register((destructor)); \
diff --git a/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
index 4456046e6..096c9e16d 100644
--- a/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+++ b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
@@ -175,8 +175,7 @@ extern void zfs_tstamp_update_setup_ext(struct znode *,
uint_t, uint64_t [2], uint64_t [2], boolean_t have_tx);
extern void zfs_znode_free(struct znode *);
-extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
-extern int zfsfstype;
+extern zil_replay_func_t *const zfs_replay_vector[TX_MAX_TYPE];
extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp,
char *buf);
diff --git a/include/os/linux/spl/rpc/xdr.h b/include/os/linux/spl/rpc/xdr.h
index c62080a11..1c03a42a9 100644
--- a/include/os/linux/spl/rpc/xdr.h
+++ b/include/os/linux/spl/rpc/xdr.h
@@ -36,7 +36,8 @@ enum xdr_op {
struct xdr_ops;
typedef struct {
- struct xdr_ops *x_ops; /* Let caller know xdrmem_create() succeeds */
+ const struct xdr_ops *x_ops;
+ /* Let caller know xdrmem_create() succeeds */
caddr_t x_addr; /* Current buffer addr */
caddr_t x_addr_end; /* End of the buffer */
enum xdr_op x_op; /* Stream direction */
diff --git a/include/os/linux/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h
index 98d1ab1d7..be1f77e43 100644
--- a/include/os/linux/spl/sys/sysmacros.h
+++ b/include/os/linux/spl/sys/sysmacros.h
@@ -113,7 +113,6 @@
#endif
/* Missing globals */
-extern char spl_gitrev[64];
extern unsigned long spl_hostid;
/* Missing misc functions */
diff --git a/include/os/linux/spl/sys/taskq.h b/include/os/linux/spl/sys/taskq.h
index b50175a10..2a6cd8283 100644
--- a/include/os/linux/spl/sys/taskq.h
+++ b/include/os/linux/spl/sys/taskq.h
@@ -160,7 +160,8 @@ extern taskq_t *taskq_of_curthread(void);
#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \
taskq_create(name, nthreads, pri, min, max, flags)
#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \
- taskq_create(name, nthreads, maxclsyspri, min, max, flags)
+ ((void) sizeof (dc), \
+ taskq_create(name, nthreads, maxclsyspri, min, max, flags))
int spl_taskq_init(void);
void spl_taskq_fini(void);
diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h
index de46fc8f2..2e1bd8576 100644
--- a/include/os/linux/zfs/sys/zfs_znode_impl.h
+++ b/include/os/linux/zfs/sys/zfs_znode_impl.h
@@ -173,8 +173,7 @@ extern caddr_t zfs_map_page(page_t *, enum seg_rw);
extern void zfs_unmap_page(page_t *, caddr_t);
#endif /* HAVE_UIO_RW */
-extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
-extern int zfsfstype;
+extern zil_replay_func_t *const zfs_replay_vector[TX_MAX_TYPE];
#ifdef __cplusplus
}
diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
index ff86e027b..afb16e5c7 100644
--- a/include/os/linux/zfs/sys/zpl.h
+++ b/include/os/linux/zfs/sys/zpl.h
@@ -99,7 +99,6 @@ extern const struct inode_operations zpl_ops_root;
extern const struct file_operations zpl_fops_snapdir;
extern const struct inode_operations zpl_ops_snapdir;
-extern const struct dentry_operations zpl_dops_snapdirs;
extern const struct file_operations zpl_fops_shares;
extern const struct inode_operations zpl_ops_shares;
diff --git a/include/sys/crypto/api.h b/include/sys/crypto/api.h
index 8aecfeaff..17c9a6459 100644
--- a/include/sys/crypto/api.h
+++ b/include/sys/crypto/api.h
@@ -58,7 +58,7 @@ typedef struct {
*/
#define CRYPTO_MECH_INVALID ((uint64_t)-1)
-extern crypto_mech_type_t crypto_mech2id(char *name);
+extern crypto_mech_type_t crypto_mech2id(const char *name);
/*
* Create and destroy context templates.
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index b9e6731bd..1ddff0d4e 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -862,7 +862,6 @@ int dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset,
int dmu_assign_arcbuf_by_dbuf(dmu_buf_t *handle, uint64_t offset,
struct arc_buf *buf, dmu_tx_t *tx);
#define dmu_assign_arcbuf dmu_assign_arcbuf_by_dbuf
-extern int zfs_prefetch_disable;
extern int zfs_max_recordsize;
/*
diff --git a/include/sys/dmu_recv.h b/include/sys/dmu_recv.h
index 7188b2a02..1fdb986e2 100644
--- a/include/sys/dmu_recv.h
+++ b/include/sys/dmu_recv.h
@@ -35,7 +35,7 @@
#include <sys/spa.h>
#include <sys/objlist.h>
-extern const char *recv_clone_name;
+extern const char *const recv_clone_name;
typedef struct dmu_recv_cookie {
struct dsl_dataset *drc_ds;
diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h
index 3c9199b86..29bbf7e18 100644
--- a/include/sys/dsl_dataset.h
+++ b/include/sys/dsl_dataset.h
@@ -45,7 +45,6 @@
extern "C" {
#endif
-extern int zfs_allow_redacted_dataset_mount;
struct dsl_dataset;
struct dsl_dir;
struct dsl_pool;
@@ -441,8 +440,8 @@ int dsl_dataset_set_compression(const char *dsname, zprop_source_t source,
boolean_t dsl_dataset_is_before(dsl_dataset_t *later, dsl_dataset_t *earlier,
uint64_t earlier_txg);
-void dsl_dataset_long_hold(dsl_dataset_t *ds, void *tag);
-void dsl_dataset_long_rele(dsl_dataset_t *ds, void *tag);
+void dsl_dataset_long_hold(dsl_dataset_t *ds, const void *tag);
+void dsl_dataset_long_rele(dsl_dataset_t *ds, const void *tag);
boolean_t dsl_dataset_long_held(dsl_dataset_t *ds);
int dsl_dataset_clone_swap_check_impl(dsl_dataset_t *clone,
diff --git a/include/sys/dsl_pool.h b/include/sys/dsl_pool.h
index 44900f8ce..0283a8c58 100644
--- a/include/sys/dsl_pool.h
+++ b/include/sys/dsl_pool.h
@@ -60,7 +60,6 @@ struct dsl_deadlist;
extern unsigned long zfs_dirty_data_max;
extern unsigned long zfs_dirty_data_max_max;
extern unsigned long zfs_wrlog_data_max;
-extern int zfs_dirty_data_sync_percent;
extern int zfs_dirty_data_max_percent;
extern int zfs_dirty_data_max_max_percent;
extern int zfs_delay_min_dirty_percent;
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 287b3beae..6bc82198d 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -206,7 +206,8 @@ typedef enum {
ZFS_NUM_USERQUOTA_PROPS
} zfs_userquota_prop_t;
-_SYS_FS_ZFS_H const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
+_SYS_FS_ZFS_H const char *const zfs_userquota_prop_prefixes[
+ ZFS_NUM_USERQUOTA_PROPS];
/*
* Pool properties are identified by these constants and must be added to the
diff --git a/include/sys/metaslab.h b/include/sys/metaslab.h
index ecff65f13..129a68be4 100644
--- a/include/sys/metaslab.h
+++ b/include/sys/metaslab.h
@@ -43,7 +43,7 @@ typedef struct metaslab_ops {
} metaslab_ops_t;
-extern metaslab_ops_t *zfs_metaslab_ops;
+extern const metaslab_ops_t zfs_metaslab_ops;
int metaslab_init(metaslab_group_t *, uint64_t, uint64_t, uint64_t,
metaslab_t **);
@@ -101,7 +101,7 @@ void metaslab_stat_fini(void);
void metaslab_trace_init(zio_alloc_list_t *);
void metaslab_trace_fini(zio_alloc_list_t *);
-metaslab_class_t *metaslab_class_create(spa_t *, metaslab_ops_t *);
+metaslab_class_t *metaslab_class_create(spa_t *, const metaslab_ops_t *);
void metaslab_class_destroy(metaslab_class_t *);
int metaslab_class_validate(metaslab_class_t *);
void metaslab_class_histogram_verify(metaslab_class_t *);
diff --git a/include/sys/metaslab_impl.h b/include/sys/metaslab_impl.h
index adf4c03a2..3dbee4c17 100644
--- a/include/sys/metaslab_impl.h
+++ b/include/sys/metaslab_impl.h
@@ -179,7 +179,7 @@ typedef struct metaslab_class_allocator {
struct metaslab_class {
kmutex_t mc_lock;
spa_t *mc_spa;
- metaslab_ops_t *mc_ops;
+ const metaslab_ops_t *mc_ops;
/*
* Track the number of metaslab groups that have been initialized
diff --git a/include/sys/nvpair.h b/include/sys/nvpair.h
index 340b0d79c..81494b62d 100644
--- a/include/sys/nvpair.h
+++ b/include/sys/nvpair.h
@@ -135,12 +135,12 @@ struct nv_alloc_ops {
void (*nv_ao_reset)(nv_alloc_t *);
};
-_SYS_NVPAIR_H const nv_alloc_ops_t *nv_fixed_ops;
-_SYS_NVPAIR_H nv_alloc_t *nv_alloc_nosleep;
+_SYS_NVPAIR_H const nv_alloc_ops_t *const nv_fixed_ops;
+_SYS_NVPAIR_H nv_alloc_t *const nv_alloc_nosleep;
#if defined(_KERNEL)
-_SYS_NVPAIR_H nv_alloc_t *nv_alloc_sleep;
-_SYS_NVPAIR_H nv_alloc_t *nv_alloc_pushpage;
+_SYS_NVPAIR_H nv_alloc_t *const nv_alloc_sleep;
+_SYS_NVPAIR_H nv_alloc_t *const nv_alloc_pushpage;
#endif
_SYS_NVPAIR_H int nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *,
diff --git a/include/sys/range_tree.h b/include/sys/range_tree.h
index fef3d4d7b..895d80257 100644
--- a/include/sys/range_tree.h
+++ b/include/sys/range_tree.h
@@ -63,7 +63,7 @@ typedef struct range_tree {
*/
uint8_t rt_shift;
uint64_t rt_start;
- range_tree_ops_t *rt_ops;
+ const range_tree_ops_t *rt_ops;
/* rt_btree_compare should only be set if rt_arg is a b-tree */
void *rt_arg;
@@ -278,11 +278,11 @@ rs_set_fill(range_seg_t *rs, range_tree_t *rt, uint64_t fill)
typedef void range_tree_func_t(void *arg, uint64_t start, uint64_t size);
-range_tree_t *range_tree_create_impl(range_tree_ops_t *ops,
+range_tree_t *range_tree_create_impl(const range_tree_ops_t *ops,
range_seg_type_t type, void *arg, uint64_t start, uint64_t shift,
int (*zfs_btree_compare) (const void *, const void *), uint64_t gap);
-range_tree_t *range_tree_create(range_tree_ops_t *ops, range_seg_type_t type,
- void *arg, uint64_t start, uint64_t shift);
+range_tree_t *range_tree_create(const range_tree_ops_t *ops,
+ range_seg_type_t type, void *arg, uint64_t start, uint64_t shift);
void range_tree_destroy(range_tree_t *rt);
boolean_t range_tree_contains(range_tree_t *rt, uint64_t start, uint64_t size);
range_seg_t *range_tree_find(range_tree_t *rt, uint64_t start, uint64_t size);
@@ -321,7 +321,7 @@ void rt_btree_destroy(range_tree_t *rt, void *arg);
void rt_btree_add(range_tree_t *rt, range_seg_t *rs, void *arg);
void rt_btree_remove(range_tree_t *rt, range_seg_t *rs, void *arg);
void rt_btree_vacate(range_tree_t *rt, void *arg);
-extern range_tree_ops_t rt_btree_ops;
+extern const range_tree_ops_t rt_btree_ops;
#ifdef __cplusplus
}
diff --git a/include/sys/sa.h b/include/sys/sa.h
index 98eb8f9cd..32f6bd0cc 100644
--- a/include/sys/sa.h
+++ b/include/sys/sa.h
@@ -143,7 +143,8 @@ uint64_t sa_handle_object(sa_handle_t *);
boolean_t sa_attr_would_spill(sa_handle_t *, sa_attr_type_t, int size);
void sa_spill_rele(sa_handle_t *);
void sa_register_update_callback(objset_t *, sa_update_cb_t *);
-int sa_setup(objset_t *, uint64_t, sa_attr_reg_t *, int, sa_attr_type_t **);
+int sa_setup(objset_t *, uint64_t, const sa_attr_reg_t *, int,
+ sa_attr_type_t **);
void sa_tear_down(objset_t *);
int sa_replace_all_by_template(sa_handle_t *, sa_bulk_attr_t *,
int, dmu_tx_t *);
diff --git a/include/sys/spa.h b/include/sys/spa.h
index 2e365eabe..896b0f956 100644
--- a/include/sys/spa.h
+++ b/include/sys/spa.h
@@ -1208,6 +1208,9 @@ extern unsigned long zfs_deadman_synctime_ms;
extern unsigned long zfs_deadman_ziotime_ms;
extern unsigned long zfs_deadman_checktime_ms;
+extern kmem_cache_t *zio_buf_cache[];
+extern kmem_cache_t *zio_data_buf_cache[];
+
#ifdef __cplusplus
}
#endif
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
index eee4783fe..9946c4e3c 100644
--- a/include/sys/spa_impl.h
+++ b/include/sys/spa_impl.h
@@ -444,7 +444,7 @@ struct spa {
};
extern char *spa_config_path;
-extern char *zfs_deadman_failmode;
+extern const char *zfs_deadman_failmode;
extern int spa_slop_shift;
extern void spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent);
diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
index 86959725a..1567182a7 100644
--- a/include/sys/vdev_impl.h
+++ b/include/sys/vdev_impl.h
@@ -626,8 +626,6 @@ extern uint64_t vdev_get_ndisks(vdev_t *vd);
* Global variables
*/
extern int zfs_vdev_standard_sm_blksz;
-/* zdb uses this tunable, so it must be declared here to make lint happy. */
-extern int zfs_vdev_cache_size;
/*
* Functions from vdev_indirect.c
diff --git a/include/sys/vdev_raidz_impl.h b/include/sys/vdev_raidz_impl.h
index 908723da0..890e725e1 100644
--- a/include/sys/vdev_raidz_impl.h
+++ b/include/sys/vdev_raidz_impl.h
@@ -70,8 +70,8 @@ enum raidz_rec_op {
RAIDZ_REC_NUM = 7
};
-extern const char *raidz_gen_name[RAIDZ_GEN_NUM];
-extern const char *raidz_rec_name[RAIDZ_REC_NUM];
+extern const char *const raidz_gen_name[RAIDZ_GEN_NUM];
+extern const char *const raidz_rec_name[RAIDZ_REC_NUM];
/*
* Methods used to define raidz implementation
diff --git a/include/sys/zfs_acl.h b/include/sys/zfs_acl.h
index 010686a91..98387a49a 100644
--- a/include/sys/zfs_acl.h
+++ b/include/sys/zfs_acl.h
@@ -166,7 +166,7 @@ typedef struct zfs_acl {
uint64_t z_hints; /* ACL hints (ZFS_INHERIT_ACE ...) */
zfs_acl_node_t *z_curr_node; /* current node iterator is handling */
list_t z_acl; /* chunks of ACE data */
- acl_ops_t *z_ops; /* ACL operations */
+ const acl_ops_t *z_ops; /* ACL operations */
} zfs_acl_t;
typedef struct acl_locator_cb {
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index b1df9f3f3..6d1fd83df 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -492,7 +492,7 @@ extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
#define taskq_create_proc(a, b, c, d, e, p, f) \
(taskq_create(a, b, c, d, e, f))
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
- (taskq_create(a, b, maxclsyspri, d, e, f))
+ ((void) sizeof (dc), taskq_create(a, b, maxclsyspri, d, e, f))
extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *, uint_t,
clock_t);
diff --git a/include/sys/zfs_ioctl_impl.h b/include/sys/zfs_ioctl_impl.h
index 3db67ae98..f9e4f6e6c 100644
--- a/include/sys/zfs_ioctl_impl.h
+++ b/include/sys/zfs_ioctl_impl.h
@@ -24,7 +24,6 @@
#define _ZFS_IOCTL_IMPL_H_
extern kmutex_t zfsdev_state_lock;
-extern zfsdev_state_t *zfsdev_state_list;
extern unsigned long zfs_max_nvlist_src_size;
typedef int zfs_ioc_legacy_func_t(zfs_cmd_t *);
diff --git a/include/sys/zfs_sa.h b/include/sys/zfs_sa.h
index 1ca7ced33..a0c383807 100644
--- a/include/sys/zfs_sa.h
+++ b/include/sys/zfs_sa.h
@@ -91,8 +91,7 @@ typedef enum zpl_attr {
#define SA_FLAGS_OFFSET 48
#define SA_PROJID_OFFSET 128
-extern sa_attr_reg_t zfs_attr_table[ZPL_END + 1];
-extern sa_attr_reg_t zfs_legacy_attr_table[ZPL_END + 1];
+extern const sa_attr_reg_t zfs_attr_table[ZPL_END + 1];
/*
* This is a deprecated data structure that only exists for
diff --git a/include/sys/zil.h b/include/sys/zil.h
index cefbccb32..8e5a49da2 100644
--- a/include/sys/zil.h
+++ b/include/sys/zil.h
@@ -456,8 +456,6 @@ typedef struct zil_stats {
kstat_named_t zil_itx_metaslab_slog_bytes;
} zil_stats_t;
-extern zil_stats_t zil_stats;
-
#define ZIL_STAT_INCR(stat, val) \
atomic_add_64(&zil_stats.stat.value.ui64, (val));
#define ZIL_STAT_BUMP(stat) \
@@ -485,7 +483,7 @@ extern zilog_t *zil_open(objset_t *os, zil_get_data_t *get_data);
extern void zil_close(zilog_t *zilog);
extern void zil_replay(objset_t *os, void *arg,
- zil_replay_func_t *replay_func[TX_MAX_TYPE]);
+ zil_replay_func_t *const replay_func[TX_MAX_TYPE]);
extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
extern void zil_destroy(zilog_t *zilog, boolean_t keep_first);
extern void zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx);
diff --git a/include/sys/zio.h b/include/sys/zio.h
index 121b58dea..07135d1e2 100644
--- a/include/sys/zio.h
+++ b/include/sys/zio.h
@@ -264,7 +264,7 @@ typedef void zio_done_func_t(zio_t *zio);
extern int zio_exclude_metadata;
extern int zio_dva_throttle_enabled;
-extern const char *zio_type_name[ZIO_TYPES];
+extern const char *const zio_type_name[ZIO_TYPES];
/*
* A bookmark is a four-tuple <objset, object, level, blkid> that uniquely
diff --git a/include/sys/zio_crypt.h b/include/sys/zio_crypt.h
index d7a63d695..f1edd76f0 100644
--- a/include/sys/zio_crypt.h
+++ b/include/sys/zio_crypt.h
@@ -70,7 +70,7 @@ typedef struct zio_crypt_info {
char *ci_name;
} zio_crypt_info_t;
-extern zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS];
+extern const zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS];
/* in memory representation of an unwrapped key that is loaded into memory */
typedef struct zio_crypt_key {
diff --git a/include/sys/zvol_impl.h b/include/sys/zvol_impl.h
index 89fe59800..223393de7 100644
--- a/include/sys/zvol_impl.h
+++ b/include/sys/zvol_impl.h
@@ -61,12 +61,11 @@ typedef struct zvol_state {
} zvol_state_t;
-extern list_t zvol_state_list;
extern krwlock_t zvol_state_lock;
#define ZVOL_HT_SIZE 1024
extern struct hlist_head *zvol_htable;
#define ZVOL_HT_HEAD(hash) (&zvol_htable[(hash) & (ZVOL_HT_SIZE-1)])
-extern zil_replay_func_t *zvol_replay_vector[TX_MAX_TYPE];
+extern zil_replay_func_t *const zvol_replay_vector[TX_MAX_TYPE];
extern unsigned int zvol_volmode;
extern unsigned int zvol_inhibit_dev;
diff --git a/include/zfs_comutil.h b/include/zfs_comutil.h
index 3e4716224..ea2da4a15 100644
--- a/include/zfs_comutil.h
+++ b/include/zfs_comutil.h
@@ -43,7 +43,7 @@ _ZFS_COMUTIL_H int zfs_spa_version_map(int zpl_version);
_ZFS_COMUTIL_H boolean_t zfs_dataset_name_hidden(const char *);
#define ZFS_NUM_LEGACY_HISTORY_EVENTS 41
-_ZFS_COMUTIL_H const char *
+_ZFS_COMUTIL_H const char *const
zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS];
#ifdef __cplusplus
diff --git a/include/zfs_deleg.h b/include/zfs_deleg.h
index 1ae08850f..77f64786b 100644
--- a/include/zfs_deleg.h
+++ b/include/zfs_deleg.h
@@ -85,7 +85,7 @@ typedef struct zfs_deleg_perm_tab {
zfs_deleg_note_t z_note;
} zfs_deleg_perm_tab_t;
-_ZFS_DELEG_H zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
+_ZFS_DELEG_H const zfs_deleg_perm_tab_t zfs_deleg_perm_tab[];
_ZFS_DELEG_H int zfs_deleg_verify_nvlist(nvlist_t *nvlist);
_ZFS_DELEG_H void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,