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/zcommon/zfs_comutil.c | |
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/zcommon/zfs_comutil.c')
-rw-r--r-- | module/zcommon/zfs_comutil.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c index 886167759..020e7e86c 100644 --- a/module/zcommon/zfs_comutil.c +++ b/module/zcommon/zfs_comutil.c @@ -158,13 +158,11 @@ static zfs_version_spa_map_t zfs_version_table[] = { int zfs_zpl_version_map(int spa_version) { - int i; int version = -1; - for (i = 0; zfs_version_table[i].version_spa; i++) { + for (int i = 0; zfs_version_table[i].version_spa; i++) if (spa_version >= zfs_version_table[i].version_spa) version = zfs_version_table[i].version_zpl; - } return (version); } @@ -176,22 +174,18 @@ zfs_zpl_version_map(int spa_version) int zfs_spa_version_map(int zpl_version) { - int i; - int version = -1; - - for (i = 0; zfs_version_table[i].version_zpl; i++) { + for (int i = 0; zfs_version_table[i].version_zpl; i++) if (zfs_version_table[i].version_zpl >= zpl_version) return (zfs_version_table[i].version_spa); - } - return (version); + return (-1); } /* * This is the table of legacy internal event names; it should not be modified. * The internal events are now stored in the history log as strings. */ -const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = { +const char *const zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = { "invalid event", "pool create", "vdev add", @@ -243,9 +237,7 @@ zfs_dataset_name_hidden(const char *name) * internal datasets (which have a $ in their name), and * temporary datasets (which have a % in their name). */ - if (strchr(name, '$') != NULL) - return (B_TRUE); - if (strchr(name, '%') != NULL) + if (strpbrk(name, "$%") != NULL) return (B_TRUE); if (!INGLOBALZONE(curproc) && !zone_dataset_visible(name, NULL)) return (B_TRUE); |