diff options
author | Christoph Hellwig <hch@lst.de> | 2010-05-26 11:53:41 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-05-27 22:06:06 -0400 |
commit | 1b061d9247f71cd15edc4c4c4600191a903642c0 (patch) | |
tree | 30d92ca82d8286e7a45fba108230ecd23e61673b /fs/libfs.c | |
parent | 7ea8085910ef3dd4f3cad6845aaa2b580d39b115 (diff) |
rename the generic fsync implementations
We don't name our generic fsync implementations very well currently.
The no-op implementation for in-memory filesystems currently is called
simple_sync_file which doesn't make too much sense to start with,
the the generic one for simple filesystems is called simple_fsync
which can lead to some confusion.
This patch renames the generic file fsync method to generic_file_fsync
to match the other generic_file_* routines it is supposed to be used
with, and the no-op implementation to noop_fsync to make it obvious
what to expect. In addition add some documentation for both methods.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index e57ea58bda68..b84d0a7a2204 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -58,11 +58,6 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct na | |||
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
60 | 60 | ||
61 | int simple_sync_file(struct file *file, int datasync) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | int dcache_dir_open(struct inode *inode, struct file *file) | 61 | int dcache_dir_open(struct inode *inode, struct file *file) |
67 | { | 62 | { |
68 | static struct qstr cursor_name = {.len = 1, .name = "."}; | 63 | static struct qstr cursor_name = {.len = 1, .name = "."}; |
@@ -190,7 +185,7 @@ const struct file_operations simple_dir_operations = { | |||
190 | .llseek = dcache_dir_lseek, | 185 | .llseek = dcache_dir_lseek, |
191 | .read = generic_read_dir, | 186 | .read = generic_read_dir, |
192 | .readdir = dcache_readdir, | 187 | .readdir = dcache_readdir, |
193 | .fsync = simple_sync_file, | 188 | .fsync = noop_fsync, |
194 | }; | 189 | }; |
195 | 190 | ||
196 | const struct inode_operations simple_dir_inode_operations = { | 191 | const struct inode_operations simple_dir_inode_operations = { |
@@ -851,7 +846,16 @@ struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, | |||
851 | } | 846 | } |
852 | EXPORT_SYMBOL_GPL(generic_fh_to_parent); | 847 | EXPORT_SYMBOL_GPL(generic_fh_to_parent); |
853 | 848 | ||
854 | int simple_fsync(struct file *file, int datasync) | 849 | /** |
850 | * generic_file_fsync - generic fsync implementation for simple filesystems | ||
851 | * @file: file to synchronize | ||
852 | * @datasync: only synchronize essential metadata if true | ||
853 | * | ||
854 | * This is a generic implementation of the fsync method for simple | ||
855 | * filesystems which track all non-inode metadata in the buffers list | ||
856 | * hanging off the address_space structure. | ||
857 | */ | ||
858 | int generic_file_fsync(struct file *file, int datasync) | ||
855 | { | 859 | { |
856 | struct writeback_control wbc = { | 860 | struct writeback_control wbc = { |
857 | .sync_mode = WB_SYNC_ALL, | 861 | .sync_mode = WB_SYNC_ALL, |
@@ -872,7 +876,15 @@ int simple_fsync(struct file *file, int datasync) | |||
872 | ret = err; | 876 | ret = err; |
873 | return ret; | 877 | return ret; |
874 | } | 878 | } |
875 | EXPORT_SYMBOL(simple_fsync); | 879 | EXPORT_SYMBOL(generic_file_fsync); |
880 | |||
881 | /* | ||
882 | * No-op implementation of ->fsync for in-memory filesystems. | ||
883 | */ | ||
884 | int noop_fsync(struct file *file, int datasync) | ||
885 | { | ||
886 | return 0; | ||
887 | } | ||
876 | 888 | ||
877 | EXPORT_SYMBOL(dcache_dir_close); | 889 | EXPORT_SYMBOL(dcache_dir_close); |
878 | EXPORT_SYMBOL(dcache_dir_lseek); | 890 | EXPORT_SYMBOL(dcache_dir_lseek); |
@@ -895,7 +907,7 @@ EXPORT_SYMBOL(simple_release_fs); | |||
895 | EXPORT_SYMBOL(simple_rename); | 907 | EXPORT_SYMBOL(simple_rename); |
896 | EXPORT_SYMBOL(simple_rmdir); | 908 | EXPORT_SYMBOL(simple_rmdir); |
897 | EXPORT_SYMBOL(simple_statfs); | 909 | EXPORT_SYMBOL(simple_statfs); |
898 | EXPORT_SYMBOL(simple_sync_file); | 910 | EXPORT_SYMBOL(noop_fsync); |
899 | EXPORT_SYMBOL(simple_unlink); | 911 | EXPORT_SYMBOL(simple_unlink); |
900 | EXPORT_SYMBOL(simple_read_from_buffer); | 912 | EXPORT_SYMBOL(simple_read_from_buffer); |
901 | EXPORT_SYMBOL(simple_write_to_buffer); | 913 | EXPORT_SYMBOL(simple_write_to_buffer); |