mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +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:
@@ -325,7 +325,7 @@ zfeature_register(spa_feature_t fid, const char *guid, const char *name,
|
||||
const struct zfs_mod_supported_features *sfeatures)
|
||||
{
|
||||
zfeature_info_t *feature = &spa_feature_table[fid];
|
||||
static spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
|
||||
static const spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
|
||||
|
||||
ASSERT(name != NULL);
|
||||
ASSERT(desc != NULL);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "zfs_deleg.h"
|
||||
#include "zfs_namecheck.h"
|
||||
|
||||
zfs_deleg_perm_tab_t zfs_deleg_perm_tab[] = {
|
||||
const zfs_deleg_perm_tab_t zfs_deleg_perm_tab[] = {
|
||||
{ZFS_DELEG_PERM_ALLOW},
|
||||
{ZFS_DELEG_PERM_BOOKMARK},
|
||||
{ZFS_DELEG_PERM_CLONE},
|
||||
@@ -89,15 +89,12 @@ zfs_valid_permission_name(const char *perm)
|
||||
const char *
|
||||
zfs_deleg_canonicalize_perm(const char *perm)
|
||||
{
|
||||
int i;
|
||||
zfs_prop_t prop;
|
||||
|
||||
for (i = 0; zfs_deleg_perm_tab[i].z_perm != NULL; i++) {
|
||||
for (int i = 0; zfs_deleg_perm_tab[i].z_perm != NULL; i++) {
|
||||
if (strcmp(perm, zfs_deleg_perm_tab[i].z_perm) == 0)
|
||||
return (perm);
|
||||
}
|
||||
|
||||
prop = zfs_name_to_prop(perm);
|
||||
zfs_prop_t prop = zfs_name_to_prop(perm);
|
||||
if (prop != ZPROP_INVAL && zfs_prop_delegatable(prop))
|
||||
return (zfs_prop_to_name(prop));
|
||||
return (NULL);
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
static zprop_desc_t zfs_prop_table[ZFS_NUM_PROPS];
|
||||
|
||||
/* Note this is indexed by zfs_userquota_prop_t, keep the order the same */
|
||||
const char *zfs_userquota_prop_prefixes[] = {
|
||||
const char *const zfs_userquota_prop_prefixes[] = {
|
||||
"userused@",
|
||||
"userquota@",
|
||||
"groupused@",
|
||||
|
||||
Reference in New Issue
Block a user