Commit 68279f9c authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Andrew Morton
Browse files

treewide: mark stuff as __ro_after_init

__read_mostly predates __ro_after_init. Many variables which are marked
__read_mostly should have been __ro_after_init from day 1.

Also, mark some stuff as "const" and "__init" while I'm at it.

[akpm@linux-foundation.org: revert sysctl_nr_open_min, sysctl_nr_open_max changes due to arm warning]
[akpm@linux-foundation.org: coding-style cleanups]
Link: https://lkml.kernel.org/r/4f6bb9c0-abba-4ee4-a7aa-89265e886817@p183


Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 1b13a703
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ EXPORT_SYMBOL(thaw_bdev);
 */

static  __cacheline_aligned_in_smp DEFINE_MUTEX(bdev_lock);
static struct kmem_cache * bdev_cachep __read_mostly;
static struct kmem_cache *bdev_cachep __ro_after_init;

static struct inode *bdev_alloc_inode(struct super_block *sb)
{
@@ -361,13 +361,13 @@ static struct file_system_type bd_type = {
	.kill_sb	= kill_anon_super,
};

struct super_block *blockdev_superblock __read_mostly;
struct super_block *blockdev_superblock __ro_after_init;
EXPORT_SYMBOL_GPL(blockdev_superblock);

void __init bdev_cache_init(void)
{
	int err;
	static struct vfsmount *bd_mnt;
	static struct vfsmount *bd_mnt __ro_after_init;

	bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
			0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
+2 −2
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@

#include <linux/uaccess.h>

static struct vfsmount *anon_inode_mnt __read_mostly;
static struct inode *anon_inode_inode;
static struct vfsmount *anon_inode_mnt __ro_after_init;
static struct inode *anon_inode_inode __ro_after_init;

/*
 * anon_inodefs_dname() is called from d_path().
+2 −2
Original line number Diff line number Diff line
@@ -2988,13 +2988,13 @@ EXPORT_SYMBOL(try_to_free_buffers);
/*
 * Buffer-head allocation
 */
static struct kmem_cache *bh_cachep __read_mostly;
static struct kmem_cache *bh_cachep __ro_after_init;

/*
 * Once the number of bh's in the machine exceeds this level, we start
 * stripping them in writeback.
 */
static unsigned long max_buffer_heads;
static unsigned long max_buffer_heads __ro_after_init;

int buffer_heads_over_limit;

+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@

#include "internal.h"

static struct kobj_map *cdev_map;
static struct kobj_map *cdev_map __ro_after_init;

static DEFINE_MUTEX(chrdevs_lock);

+4 −4
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);

EXPORT_SYMBOL(rename_lock);

static struct kmem_cache *dentry_cache __read_mostly;
static struct kmem_cache *dentry_cache __ro_after_init;

const struct qstr empty_name = QSTR_INIT("", 0);
EXPORT_SYMBOL(empty_name);
@@ -96,9 +96,9 @@ EXPORT_SYMBOL(dotdot_name);
 * information, yet avoid using a prime hash-size or similar.
 */

static unsigned int d_hash_shift __read_mostly;
static unsigned int d_hash_shift __ro_after_init;

static struct hlist_bl_head *dentry_hashtable __read_mostly;
static struct hlist_bl_head *dentry_hashtable __ro_after_init;

static inline struct hlist_bl_head *d_hash(unsigned int hash)
{
@@ -3324,7 +3324,7 @@ static void __init dcache_init(void)
}

/* SLAB cache for __getname() consumers */
struct kmem_cache *names_cachep __read_mostly;
struct kmem_cache *names_cachep __ro_after_init;
EXPORT_SYMBOL(names_cachep);

void __init vfs_caches_init_early(void)
Loading