aboutsummaryrefslogtreecommitdiffstats
path: root/fs/libfs.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-05-26 11:53:41 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-27 22:06:06 -0400
commit1b061d9247f71cd15edc4c4c4600191a903642c0 (patch)
tree30d92ca82d8286e7a45fba108230ecd23e61673b /fs/libfs.c
parent7ea8085910ef3dd4f3cad6845aaa2b580d39b115 (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.c30
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
61int simple_sync_file(struct file *file, int datasync)
62{
63 return 0;
64}
65
66int dcache_dir_open(struct inode *inode, struct file *file) 61int 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
196const struct inode_operations simple_dir_inode_operations = { 191const 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}
852EXPORT_SYMBOL_GPL(generic_fh_to_parent); 847EXPORT_SYMBOL_GPL(generic_fh_to_parent);
853 848
854int 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 */
858int 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}
875EXPORT_SYMBOL(simple_fsync); 879EXPORT_SYMBOL(generic_file_fsync);
880
881/*
882 * No-op implementation of ->fsync for in-memory filesystems.
883 */
884int noop_fsync(struct file *file, int datasync)
885{
886 return 0;
887}
876 888
877EXPORT_SYMBOL(dcache_dir_close); 889EXPORT_SYMBOL(dcache_dir_close);
878EXPORT_SYMBOL(dcache_dir_lseek); 890EXPORT_SYMBOL(dcache_dir_lseek);
@@ -895,7 +907,7 @@ EXPORT_SYMBOL(simple_release_fs);
895EXPORT_SYMBOL(simple_rename); 907EXPORT_SYMBOL(simple_rename);
896EXPORT_SYMBOL(simple_rmdir); 908EXPORT_SYMBOL(simple_rmdir);
897EXPORT_SYMBOL(simple_statfs); 909EXPORT_SYMBOL(simple_statfs);
898EXPORT_SYMBOL(simple_sync_file); 910EXPORT_SYMBOL(noop_fsync);
899EXPORT_SYMBOL(simple_unlink); 911EXPORT_SYMBOL(simple_unlink);
900EXPORT_SYMBOL(simple_read_from_buffer); 912EXPORT_SYMBOL(simple_read_from_buffer);
901EXPORT_SYMBOL(simple_write_to_buffer); 913EXPORT_SYMBOL(simple_write_to_buffer);