Skip to content

Commit

Permalink
module/*.ko: prune .data, global .rodata
Browse files Browse the repository at this point in the history
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
  • Loading branch information
nabijaczleweli committed Jan 6, 2022
1 parent f5bd431 commit fe04531
Show file tree
Hide file tree
Showing 153 changed files with 837 additions and 961 deletions.
13 changes: 6 additions & 7 deletions cmd/zhack/zhack.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#include <zfeature_common.h>
#include <libzutil.h>

const char cmdname[] = "zhack";
static importargs_t g_importargs;
static char *g_pool;
static boolean_t g_readonly;
Expand All @@ -62,9 +61,9 @@ static __attribute__((noreturn)) void
usage(void)
{
(void) fprintf(stderr,
"Usage: %s [-c cachefile] [-d dir] <subcommand> <args> ...\n"
"Usage: zhack [-c cachefile] [-d dir] <subcommand> <args> ...\n"
"where <subcommand> <args> is one of the following:\n"
"\n", cmdname);
"\n");

(void) fprintf(stderr,
" feature stat <pool>\n"
Expand Down Expand Up @@ -99,10 +98,10 @@ fatal(spa_t *spa, void *tag, const char *fmt, ...)
}

va_start(ap, fmt);
(void) fprintf(stderr, "%s: ", cmdname);
(void) fputs("zhack: ", stderr);
(void) vfprintf(stderr, fmt, ap);
va_end(ap);
(void) fprintf(stderr, "\n");
(void) fputc('\n', stderr);

exit(1);
}
Expand Down Expand Up @@ -277,7 +276,7 @@ zhack_do_feature_enable(int argc, char **argv)
spa_t *spa;
objset_t *mos;
zfeature_info_t feature;
spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
const spa_feature_t nodeps[] = { SPA_FEATURE_NONE };

/*
* Features are not added to the pool's label until their refcounts
Expand Down Expand Up @@ -374,7 +373,7 @@ zhack_do_feature_ref(int argc, char **argv)
spa_t *spa;
objset_t *mos;
zfeature_info_t feature;
spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
const spa_feature_t nodeps[] = { SPA_FEATURE_NONE };

/*
* fi_desc does not matter here because it was written to disk
Expand Down
2 changes: 1 addition & 1 deletion cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ extern uint64_t metaslab_force_ganging;
extern uint64_t metaslab_df_alloc_threshold;
extern unsigned long zfs_deadman_synctime_ms;
extern int metaslab_preload_limit;
extern boolean_t zfs_compressed_arc_enabled;
extern int zfs_compressed_arc_enabled;
extern int zfs_abd_scatter_enabled;
extern int dmu_object_alloc_chunk_shift;
extern boolean_t zfs_force_some_double_word_sm_entries;
Expand Down
2 changes: 1 addition & 1 deletion include/libzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions include/os/freebsd/zfs/sys/freebsd_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/zfs_context_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)); \
Expand Down
3 changes: 1 addition & 2 deletions include/os/freebsd/zfs/sys/zfs_znode_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion include/os/linux/spl/rpc/xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion include/os/linux/spl/sys/sysmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
#endif

/* Missing globals */
extern char spl_gitrev[64];
extern unsigned long spl_hostid;

/* Missing misc functions */
Expand Down
3 changes: 2 additions & 1 deletion include/os/linux/spl/sys/taskq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions include/os/linux/zfs/sys/zfs_znode_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion include/os/linux/zfs/sys/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/sys/crypto/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion include/sys/dmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down
2 changes: 1 addition & 1 deletion include/sys/dmu_recv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions include/sys/dsl_dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
extern "C" {
#endif

extern int zfs_allow_redacted_dataset_mount;
struct dsl_dataset;
struct dsl_dir;
struct dsl_pool;
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion include/sys/dsl_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/sys/metaslab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 **);
Expand Down Expand Up @@ -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 *);
Expand Down
2 changes: 1 addition & 1 deletion include/sys/metaslab_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions include/sys/nvpair.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *,
Expand Down
10 changes: 5 additions & 5 deletions include/sys/range_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion include/sys/sa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
3 changes: 3 additions & 0 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/sys/vdev_raidz_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/zfs_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion include/sys/zfs_ioctl_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
3 changes: 1 addition & 2 deletions include/sys/zfs_sa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions include/sys/zil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit fe04531

Please sign in to comment.