[PATCH] Make most file operations structs in fs/ const
This is a conversion to make the various file_operations structs in fs/ const. Basically a regexp job, with a few manual fixups The goal is both to increase correctness (harder to accidentally write to shared datastructures) and reducing the false sharing of cachelines with things that get dirty in .data (while .rodata is nicely read only and thus cache clean) Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
99ac48f54a
commit
4b6f5d20b0
@@ -856,14 +856,14 @@ static int devfsd_close(struct inode *inode, struct file *file);
|
||||
#ifdef CONFIG_DEVFS_DEBUG
|
||||
static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
|
||||
loff_t * ppos);
|
||||
static struct file_operations stat_fops = {
|
||||
static const struct file_operations stat_fops = {
|
||||
.open = nonseekable_open,
|
||||
.read = stat_read,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Devfs daemon file operations */
|
||||
static struct file_operations devfsd_fops = {
|
||||
static const struct file_operations devfsd_fops = {
|
||||
.open = nonseekable_open,
|
||||
.read = devfsd_read,
|
||||
.ioctl = devfsd_ioctl,
|
||||
@@ -1842,8 +1842,8 @@ static int try_modload(struct devfs_entry *parent, struct fs_info *fs_info,
|
||||
|
||||
static struct inode_operations devfs_iops;
|
||||
static struct inode_operations devfs_dir_iops;
|
||||
static struct file_operations devfs_fops;
|
||||
static struct file_operations devfs_dir_fops;
|
||||
static const struct file_operations devfs_fops;
|
||||
static const struct file_operations devfs_dir_fops;
|
||||
static struct inode_operations devfs_symlink_iops;
|
||||
|
||||
static int devfs_notify_change(struct dentry *dentry, struct iattr *iattr)
|
||||
@@ -2061,11 +2061,11 @@ static int devfs_open(struct inode *inode, struct file *file)
|
||||
return err;
|
||||
} /* End Function devfs_open */
|
||||
|
||||
static struct file_operations devfs_fops = {
|
||||
static const struct file_operations devfs_fops = {
|
||||
.open = devfs_open,
|
||||
};
|
||||
|
||||
static struct file_operations devfs_dir_fops = {
|
||||
static const struct file_operations devfs_dir_fops = {
|
||||
.read = generic_read_dir,
|
||||
.readdir = devfs_readdir,
|
||||
};
|
||||
|
Reference in New Issue
Block a user