Skip to content

Commit 754661f

Browse files
fenrus75Linus Torvalds
authored andcommitted
[PATCH] mark struct inode_operations const 1
Many struct inode_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9c2e08c commit 754661f

57 files changed

Lines changed: 100 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/powerpc/platforms/cell/spufs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int spufs_dir_close(struct inode *inode, struct file *file)
220220
return dcache_dir_close(inode, file);
221221
}
222222

223-
struct inode_operations spufs_dir_inode_operations = {
223+
const struct inode_operations spufs_dir_inode_operations = {
224224
.lookup = simple_lookup,
225225
};
226226

‎fs/9p/vfs_inode.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
#include "v9fs_vfs.h"
4242
#include "fid.h"
4343

44-
static struct inode_operations v9fs_dir_inode_operations;
45-
static struct inode_operations v9fs_dir_inode_operations_ext;
46-
static struct inode_operations v9fs_file_inode_operations;
47-
static struct inode_operations v9fs_symlink_inode_operations;
44+
static const struct inode_operations v9fs_dir_inode_operations;
45+
static const struct inode_operations v9fs_dir_inode_operations_ext;
46+
static const struct inode_operations v9fs_file_inode_operations;
47+
static const struct inode_operations v9fs_symlink_inode_operations;
4848

4949
/**
5050
* unixmode2p9mode - convert unix mode bits to plan 9
@@ -1303,7 +1303,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
13031303
return retval;
13041304
}
13051305

1306-
static struct inode_operations v9fs_dir_inode_operations_ext = {
1306+
static const struct inode_operations v9fs_dir_inode_operations_ext = {
13071307
.create = v9fs_vfs_create,
13081308
.lookup = v9fs_vfs_lookup,
13091309
.symlink = v9fs_vfs_symlink,
@@ -1318,7 +1318,7 @@ static struct inode_operations v9fs_dir_inode_operations_ext = {
13181318
.setattr = v9fs_vfs_setattr,
13191319
};
13201320

1321-
static struct inode_operations v9fs_dir_inode_operations = {
1321+
static const struct inode_operations v9fs_dir_inode_operations = {
13221322
.create = v9fs_vfs_create,
13231323
.lookup = v9fs_vfs_lookup,
13241324
.unlink = v9fs_vfs_unlink,
@@ -1330,12 +1330,12 @@ static struct inode_operations v9fs_dir_inode_operations = {
13301330
.setattr = v9fs_vfs_setattr,
13311331
};
13321332

1333-
static struct inode_operations v9fs_file_inode_operations = {
1333+
static const struct inode_operations v9fs_file_inode_operations = {
13341334
.getattr = v9fs_vfs_getattr,
13351335
.setattr = v9fs_vfs_setattr,
13361336
};
13371337

1338-
static struct inode_operations v9fs_symlink_inode_operations = {
1338+
static const struct inode_operations v9fs_symlink_inode_operations = {
13391339
.readlink = v9fs_vfs_readlink,
13401340
.follow_link = v9fs_vfs_follow_link,
13411341
.put_link = v9fs_vfs_put_link,

‎fs/adfs/adfs.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void __adfs_error(struct super_block *sb, const char *function,
8484
*/
8585

8686
/* dir_*.c */
87-
extern struct inode_operations adfs_dir_inode_operations;
87+
extern const struct inode_operations adfs_dir_inode_operations;
8888
extern const struct file_operations adfs_dir_operations;
8989
extern struct dentry_operations adfs_dentry_operations;
9090
extern struct adfs_dir_ops adfs_f_dir_ops;
@@ -93,7 +93,7 @@ extern struct adfs_dir_ops adfs_fplus_dir_ops;
9393
extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
9494

9595
/* file.c */
96-
extern struct inode_operations adfs_file_inode_operations;
96+
extern const struct inode_operations adfs_file_inode_operations;
9797
extern const struct file_operations adfs_file_operations;
9898

9999
static inline __u32 signed_asl(__u32 val, signed int shift)

‎fs/adfs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
295295
/*
296296
* directories can handle most operations...
297297
*/
298-
struct inode_operations adfs_dir_inode_operations = {
298+
const struct inode_operations adfs_dir_inode_operations = {
299299
.lookup = adfs_lookup,
300300
.setattr = adfs_notify_change,
301301
};

‎fs/adfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ const struct file_operations adfs_file_operations = {
3636
.sendfile = generic_file_sendfile,
3737
};
3838

39-
struct inode_operations adfs_file_inode_operations = {
39+
const struct inode_operations adfs_file_inode_operations = {
4040
.setattr = adfs_notify_change,
4141
};

‎fs/affs/affs.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ extern void affs_dir_truncate(struct inode *);
188188

189189
/* jump tables */
190190

191-
extern struct inode_operations affs_file_inode_operations;
192-
extern struct inode_operations affs_dir_inode_operations;
193-
extern struct inode_operations affs_symlink_inode_operations;
191+
extern const struct inode_operations affs_file_inode_operations;
192+
extern const struct inode_operations affs_dir_inode_operations;
193+
extern const struct inode_operations affs_symlink_inode_operations;
194194
extern const struct file_operations affs_file_operations;
195195
extern const struct file_operations affs_file_operations_ofs;
196196
extern const struct file_operations affs_dir_operations;

‎fs/affs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const struct file_operations affs_dir_operations = {
2626
/*
2727
* directories can handle most operations...
2828
*/
29-
struct inode_operations affs_dir_inode_operations = {
29+
const struct inode_operations affs_dir_inode_operations = {
3030
.create = affs_create,
3131
.lookup = affs_lookup,
3232
.link = affs_link,

‎fs/affs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const struct file_operations affs_file_operations = {
3838
.sendfile = generic_file_sendfile,
3939
};
4040

41-
struct inode_operations affs_file_inode_operations = {
41+
const struct inode_operations affs_file_inode_operations = {
4242
.truncate = affs_truncate,
4343
.setattr = affs_notify_change,
4444
};

‎fs/affs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "affs.h"
1414

15-
extern struct inode_operations affs_symlink_inode_operations;
15+
extern const struct inode_operations affs_symlink_inode_operations;
1616
extern struct timezone sys_tz;
1717

1818
void

‎fs/affs/symlink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const struct address_space_operations affs_symlink_aops = {
7070
.readpage = affs_symlink_readpage,
7171
};
7272

73-
struct inode_operations affs_symlink_inode_operations = {
73+
const struct inode_operations affs_symlink_inode_operations = {
7474
.readlink = generic_readlink,
7575
.follow_link = page_follow_link_light,
7676
.put_link = page_put_link,

0 commit comments

Comments
 (0)