[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>
此提交包含在:
@@ -583,7 +583,7 @@ struct inode_operations cifs_symlink_inode_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct file_operations cifs_file_ops = {
|
||||
const struct file_operations cifs_file_ops = {
|
||||
.read = do_sync_read,
|
||||
.write = do_sync_write,
|
||||
.readv = generic_file_readv,
|
||||
@@ -607,7 +607,7 @@ struct file_operations cifs_file_ops = {
|
||||
#endif /* CONFIG_CIFS_EXPERIMENTAL */
|
||||
};
|
||||
|
||||
struct file_operations cifs_file_direct_ops = {
|
||||
const struct file_operations cifs_file_direct_ops = {
|
||||
/* no mmap, no aio, no readv -
|
||||
BB reevaluate whether they can be done with directio, no cache */
|
||||
.read = cifs_user_read,
|
||||
@@ -626,7 +626,7 @@ struct file_operations cifs_file_direct_ops = {
|
||||
.dir_notify = cifs_dir_notify,
|
||||
#endif /* CONFIG_CIFS_EXPERIMENTAL */
|
||||
};
|
||||
struct file_operations cifs_file_nobrl_ops = {
|
||||
const struct file_operations cifs_file_nobrl_ops = {
|
||||
.read = do_sync_read,
|
||||
.write = do_sync_write,
|
||||
.readv = generic_file_readv,
|
||||
@@ -649,7 +649,7 @@ struct file_operations cifs_file_nobrl_ops = {
|
||||
#endif /* CONFIG_CIFS_EXPERIMENTAL */
|
||||
};
|
||||
|
||||
struct file_operations cifs_file_direct_nobrl_ops = {
|
||||
const struct file_operations cifs_file_direct_nobrl_ops = {
|
||||
/* no mmap, no aio, no readv -
|
||||
BB reevaluate whether they can be done with directio, no cache */
|
||||
.read = cifs_user_read,
|
||||
@@ -668,7 +668,7 @@ struct file_operations cifs_file_direct_nobrl_ops = {
|
||||
#endif /* CONFIG_CIFS_EXPERIMENTAL */
|
||||
};
|
||||
|
||||
struct file_operations cifs_dir_ops = {
|
||||
const struct file_operations cifs_dir_ops = {
|
||||
.readdir = cifs_readdir,
|
||||
.release = cifs_closedir,
|
||||
.read = generic_read_dir,
|
||||
|
新增問題並參考
封鎖使用者