From 18168da727427e28914235137daebe06c23069cd Mon Sep 17 00:00:00 2001 From: наб Date: Sat, 15 Jan 2022 00:37:55 +0100 Subject: module/*.ko: prune .data, global .rodata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Ahelenia Ziemiańska Closes #12899 --- cmd/zhack/zhack.c | 13 ++++++------- cmd/ztest/ztest.c | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'cmd') diff --git a/cmd/zhack/zhack.c b/cmd/zhack/zhack.c index 96871d2aa..73ce888c0 100644 --- a/cmd/zhack/zhack.c +++ b/cmd/zhack/zhack.c @@ -53,7 +53,6 @@ #include #include -const char cmdname[] = "zhack"; static importargs_t g_importargs; static char *g_pool; static boolean_t g_readonly; @@ -62,9 +61,9 @@ static __attribute__((noreturn)) void usage(void) { (void) fprintf(stderr, - "Usage: %s [-c cachefile] [-d dir] ...\n" + "Usage: zhack [-c cachefile] [-d dir] ...\n" "where is one of the following:\n" - "\n", cmdname); + "\n"); (void) fprintf(stderr, " feature stat \n" @@ -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); } @@ -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 @@ -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 diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index a99f60964..bb2f14298 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -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; -- cgit v1.2.3