mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47: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:
+11
-12
@@ -141,7 +141,7 @@ static int sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
|
||||
sa_data_op_t action, sa_data_locator_t *locator, void *datastart,
|
||||
uint16_t buflen, dmu_tx_t *tx);
|
||||
|
||||
arc_byteswap_func_t sa_bswap_table[] = {
|
||||
static const arc_byteswap_func_t sa_bswap_table[] = {
|
||||
byteswap_uint64_array,
|
||||
byteswap_uint32_array,
|
||||
byteswap_uint16_array,
|
||||
@@ -178,7 +178,7 @@ do { \
|
||||
* won't have the registry. Only objsets of type ZFS_TYPE_FILESYSTEM will
|
||||
* use this static table.
|
||||
*/
|
||||
sa_attr_reg_t sa_legacy_attrs[] = {
|
||||
static const sa_attr_reg_t sa_legacy_attrs[] = {
|
||||
{"ZPL_ATIME", sizeof (uint64_t) * 2, SA_UINT64_ARRAY, 0},
|
||||
{"ZPL_MTIME", sizeof (uint64_t) * 2, SA_UINT64_ARRAY, 1},
|
||||
{"ZPL_CTIME", sizeof (uint64_t) * 2, SA_UINT64_ARRAY, 2},
|
||||
@@ -200,16 +200,16 @@ sa_attr_reg_t sa_legacy_attrs[] = {
|
||||
/*
|
||||
* This is only used for objects of type DMU_OT_ZNODE
|
||||
*/
|
||||
sa_attr_type_t sa_legacy_zpl_layout[] = {
|
||||
static const sa_attr_type_t sa_legacy_zpl_layout[] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||||
};
|
||||
|
||||
/*
|
||||
* Special dummy layout used for buffers with no attributes.
|
||||
*/
|
||||
sa_attr_type_t sa_dummy_zpl_layout[] = { 0 };
|
||||
static const sa_attr_type_t sa_dummy_zpl_layout[] = { 0 };
|
||||
|
||||
static int sa_legacy_attr_count = ARRAY_SIZE(sa_legacy_attrs);
|
||||
static const size_t sa_legacy_attr_count = ARRAY_SIZE(sa_legacy_attrs);
|
||||
static kmem_cache_t *sa_cache = NULL;
|
||||
|
||||
static int
|
||||
@@ -285,12 +285,11 @@ sa_layout_equal(sa_lot_t *tbf, sa_attr_type_t *attrs, int count)
|
||||
#define SA_ATTR_HASH(attr) (zfs_crc64_table[(-1ULL ^ attr) & 0xFF])
|
||||
|
||||
static uint64_t
|
||||
sa_layout_info_hash(sa_attr_type_t *attrs, int attr_count)
|
||||
sa_layout_info_hash(const sa_attr_type_t *attrs, int attr_count)
|
||||
{
|
||||
int i;
|
||||
uint64_t crc = -1ULL;
|
||||
|
||||
for (i = 0; i != attr_count; i++)
|
||||
for (int i = 0; i != attr_count; i++)
|
||||
crc ^= SA_ATTR_HASH(attrs[i]);
|
||||
|
||||
return (crc);
|
||||
@@ -402,7 +401,7 @@ sa_attr_op(sa_handle_t *hdl, sa_bulk_attr_t *bulk, int count,
|
||||
}
|
||||
|
||||
static sa_lot_t *
|
||||
sa_add_layout_entry(objset_t *os, sa_attr_type_t *attrs, int attr_count,
|
||||
sa_add_layout_entry(objset_t *os, const sa_attr_type_t *attrs, int attr_count,
|
||||
uint64_t lot_num, uint64_t hash, boolean_t zapadd, dmu_tx_t *tx)
|
||||
{
|
||||
sa_os_t *sa = os->os_sa;
|
||||
@@ -831,7 +830,7 @@ sa_free_attr_table(sa_os_t *sa)
|
||||
}
|
||||
|
||||
static int
|
||||
sa_attr_table_setup(objset_t *os, sa_attr_reg_t *reg_attrs, int count)
|
||||
sa_attr_table_setup(objset_t *os, const sa_attr_reg_t *reg_attrs, int count)
|
||||
{
|
||||
sa_os_t *sa = os->os_sa;
|
||||
uint64_t sa_attr_count = 0;
|
||||
@@ -992,8 +991,8 @@ bail:
|
||||
}
|
||||
|
||||
int
|
||||
sa_setup(objset_t *os, uint64_t sa_obj, sa_attr_reg_t *reg_attrs, int count,
|
||||
sa_attr_type_t **user_table)
|
||||
sa_setup(objset_t *os, uint64_t sa_obj, const sa_attr_reg_t *reg_attrs,
|
||||
int count, sa_attr_type_t **user_table)
|
||||
{
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
|
||||
Reference in New Issue
Block a user