mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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:
+1
-1
@@ -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,
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)); \
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
#endif
|
||||
|
||||
/* Missing globals */
|
||||
extern char spl_gitrev[64];
|
||||
extern unsigned long spl_hostid;
|
||||
|
||||
/* Missing misc functions */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 *);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 *,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
+2
-1
@@ -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 *);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 *);
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-3
@@ -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);
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user