diff options
author | наб <[email protected]> | 2022-01-15 00:37:55 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-01-14 15:37:55 -0800 |
commit | 18168da727427e28914235137daebe06c23069cd (patch) | |
tree | 71a8769a2a12dd4add4f7abfb5a1e4f51f09cf18 /module/nvpair | |
parent | 7adc19009817303af10c8b3b7617850994cfb9e2 (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 'module/nvpair')
-rw-r--r-- | module/nvpair/nvpair.c | 6 | ||||
-rw-r--r-- | module/nvpair/nvpair_alloc_fixed.c | 4 | ||||
-rw-r--r-- | module/nvpair/nvpair_alloc_spl.c | 18 |
3 files changed, 14 insertions, 14 deletions
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c index 8230cca20..b4463dd73 100644 --- a/module/nvpair/nvpair.c +++ b/module/nvpair/nvpair.c @@ -146,12 +146,12 @@ static int nvlist_add_common(nvlist_t *nvl, const char *name, data_type_t type, ((i_nvp_t *)((size_t)(nvp) - offsetof(i_nvp_t, nvi_nvp))) #ifdef _KERNEL -int nvpair_max_recursion = 20; +static const int nvpair_max_recursion = 20; #else -int nvpair_max_recursion = 100; +static const int nvpair_max_recursion = 100; #endif -uint64_t nvlist_hashtable_init_size = (1 << 4); +static const uint64_t nvlist_hashtable_init_size = (1 << 4); int nv_alloc_init(nv_alloc_t *nva, const nv_alloc_ops_t *nvo, /* args */ ...) diff --git a/module/nvpair/nvpair_alloc_fixed.c b/module/nvpair/nvpair_alloc_fixed.c index ca3f68676..d7d3e7afd 100644 --- a/module/nvpair/nvpair_alloc_fixed.c +++ b/module/nvpair/nvpair_alloc_fixed.c @@ -100,7 +100,7 @@ nv_fixed_reset(nv_alloc_t *nva) nvb->nvb_cur = (uintptr_t)&nvb[1]; } -const nv_alloc_ops_t nv_fixed_ops_def = { +static const nv_alloc_ops_t nv_fixed_ops_def = { .nv_ao_init = nv_fixed_init, .nv_ao_fini = NULL, .nv_ao_alloc = nv_fixed_alloc, @@ -108,7 +108,7 @@ const nv_alloc_ops_t nv_fixed_ops_def = { .nv_ao_reset = nv_fixed_reset }; -const nv_alloc_ops_t *nv_fixed_ops = &nv_fixed_ops_def; +const nv_alloc_ops_t *const nv_fixed_ops = &nv_fixed_ops_def; #if defined(_KERNEL) EXPORT_SYMBOL(nv_fixed_ops); diff --git a/module/nvpair/nvpair_alloc_spl.c b/module/nvpair/nvpair_alloc_spl.c index ed8fa4d09..aa344b642 100644 --- a/module/nvpair/nvpair_alloc_spl.c +++ b/module/nvpair/nvpair_alloc_spl.c @@ -52,7 +52,7 @@ nv_free_spl(nv_alloc_t *nva, void *buf, size_t size) kmem_free(buf, size); } -const nv_alloc_ops_t spl_sleep_ops_def = { +static const nv_alloc_ops_t spl_sleep_ops_def = { .nv_ao_init = NULL, .nv_ao_fini = NULL, .nv_ao_alloc = nv_alloc_sleep_spl, @@ -60,7 +60,7 @@ const nv_alloc_ops_t spl_sleep_ops_def = { .nv_ao_reset = NULL }; -const nv_alloc_ops_t spl_pushpage_ops_def = { +static const nv_alloc_ops_t spl_pushpage_ops_def = { .nv_ao_init = NULL, .nv_ao_fini = NULL, .nv_ao_alloc = nv_alloc_pushpage_spl, @@ -68,7 +68,7 @@ const nv_alloc_ops_t spl_pushpage_ops_def = { .nv_ao_reset = NULL }; -const nv_alloc_ops_t spl_nosleep_ops_def = { +static const nv_alloc_ops_t spl_nosleep_ops_def = { .nv_ao_init = NULL, .nv_ao_fini = NULL, .nv_ao_alloc = nv_alloc_nosleep_spl, @@ -76,21 +76,21 @@ const nv_alloc_ops_t spl_nosleep_ops_def = { .nv_ao_reset = NULL }; -nv_alloc_t nv_alloc_sleep_def = { +static nv_alloc_t nv_alloc_sleep_def = { &spl_sleep_ops_def, NULL }; -nv_alloc_t nv_alloc_pushpage_def = { +static nv_alloc_t nv_alloc_pushpage_def = { &spl_pushpage_ops_def, NULL }; -nv_alloc_t nv_alloc_nosleep_def = { +static nv_alloc_t nv_alloc_nosleep_def = { &spl_nosleep_ops_def, NULL }; -nv_alloc_t *nv_alloc_sleep = &nv_alloc_sleep_def; -nv_alloc_t *nv_alloc_pushpage = &nv_alloc_pushpage_def; -nv_alloc_t *nv_alloc_nosleep = &nv_alloc_nosleep_def; +nv_alloc_t *const nv_alloc_sleep = &nv_alloc_sleep_def; +nv_alloc_t *const nv_alloc_pushpage = &nv_alloc_pushpage_def; +nv_alloc_t *const nv_alloc_nosleep = &nv_alloc_nosleep_def; |