aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/adfs/file.c2
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/ext2/file.c2
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/fat/file.c2
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/libfs.c30
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/minix/file.c2
-rw-r--r--fs/omfs/file.c2
-rw-r--r--fs/qnx4/dir.c2
-rw-r--r--fs/ramfs/file-mmu.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/sysv/dir.c2
-rw-r--r--fs/sysv/file.c2
-rw-r--r--fs/udf/dir.c2
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/ufs/dir.c2
-rw-r--r--fs/ufs/file.c2
20 files changed, 40 insertions, 28 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 23aa52f548a0..f4287e4de744 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -197,7 +197,7 @@ const struct file_operations adfs_dir_operations = {
197 .read = generic_read_dir, 197 .read = generic_read_dir,
198 .llseek = generic_file_llseek, 198 .llseek = generic_file_llseek,
199 .readdir = adfs_readdir, 199 .readdir = adfs_readdir,
200 .fsync = simple_fsync, 200 .fsync = generic_file_fsync,
201}; 201};
202 202
203static int 203static int
diff --git a/fs/adfs/file.c b/fs/adfs/file.c
index 005ea34d1758..a36da5382b40 100644
--- a/fs/adfs/file.c
+++ b/fs/adfs/file.c
@@ -26,7 +26,7 @@ const struct file_operations adfs_file_operations = {
26 .read = do_sync_read, 26 .read = do_sync_read,
27 .aio_read = generic_file_aio_read, 27 .aio_read = generic_file_aio_read,
28 .mmap = generic_file_mmap, 28 .mmap = generic_file_mmap,
29 .fsync = simple_fsync, 29 .fsync = generic_file_fsync,
30 .write = do_sync_write, 30 .write = do_sync_write,
31 .aio_write = generic_file_aio_write, 31 .aio_write = generic_file_aio_write,
32 .splice_read = generic_file_splice_read, 32 .splice_read = generic_file_splice_read,
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 8f73841fc974..d967e052b779 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -78,7 +78,7 @@ static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
78const struct file_operations bfs_dir_operations = { 78const struct file_operations bfs_dir_operations = {
79 .read = generic_read_dir, 79 .read = generic_read_dir,
80 .readdir = bfs_readdir, 80 .readdir = bfs_readdir,
81 .fsync = simple_fsync, 81 .fsync = generic_file_fsync,
82 .llseek = generic_file_llseek, 82 .llseek = generic_file_llseek,
83}; 83};
84 84
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 48bcfc327014..d82e7ca93455 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -46,7 +46,7 @@ int ext2_fsync(struct file *file, int datasync)
46 struct super_block *sb = file->f_mapping->host->i_sb; 46 struct super_block *sb = file->f_mapping->host->i_sb;
47 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; 47 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
48 48
49 ret = simple_fsync(file, datasync); 49 ret = generic_file_fsync(file, datasync);
50 if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) { 50 if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) {
51 /* We don't really know where the IO error happened... */ 51 /* We don't really know where the IO error happened... */
52 ext2_error(sb, __func__, 52 ext2_error(sb, __func__,
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 40f345201737..592adf2e546e 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -91,7 +91,7 @@ int ext4_sync_file(struct file *file, int datasync)
91 return ret; 91 return ret;
92 92
93 if (!journal) { 93 if (!journal) {
94 ret = simple_fsync(file, datasync); 94 ret = generic_file_fsync(file, datasync);
95 if (!ret && !list_empty(&inode->i_dentry)) 95 if (!ret && !list_empty(&inode->i_dentry))
96 ext4_sync_parent(inode); 96 ext4_sync_parent(inode);
97 return ret; 97 return ret;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 29a576944374..8c13b8acfd2f 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -154,7 +154,7 @@ int fat_file_fsync(struct file *filp, int datasync)
154 struct inode *inode = filp->f_mapping->host; 154 struct inode *inode = filp->f_mapping->host;
155 int res, err; 155 int res, err;
156 156
157 res = simple_fsync(filp, datasync); 157 res = generic_file_fsync(filp, datasync);
158 err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping); 158 err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping);
159 159
160 return res ? res : err; 160 return res ? res : err;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index a0bbd3d1b41a..a4e9a7ec3691 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -688,7 +688,7 @@ static void init_once(void *foo)
688const struct file_operations hugetlbfs_file_operations = { 688const struct file_operations hugetlbfs_file_operations = {
689 .read = hugetlbfs_read, 689 .read = hugetlbfs_read,
690 .mmap = hugetlbfs_file_mmap, 690 .mmap = hugetlbfs_file_mmap,
691 .fsync = simple_sync_file, 691 .fsync = noop_fsync,
692 .get_unmapped_area = hugetlb_get_unmapped_area, 692 .get_unmapped_area = hugetlb_get_unmapped_area,
693}; 693};
694 694
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);
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 6198731d7fcd..aaab97ec5bc0 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -22,7 +22,7 @@ const struct file_operations minix_dir_operations = {
22 .llseek = generic_file_llseek, 22 .llseek = generic_file_llseek,
23 .read = generic_read_dir, 23 .read = generic_read_dir,
24 .readdir = minix_readdir, 24 .readdir = minix_readdir,
25 .fsync = simple_fsync, 25 .fsync = generic_file_fsync,
26}; 26};
27 27
28static inline void dir_put_page(struct page *page) 28static inline void dir_put_page(struct page *page)
diff --git a/fs/minix/file.c b/fs/minix/file.c
index 3eec3e607a87..d5320ff23faf 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -19,7 +19,7 @@ const struct file_operations minix_file_operations = {
19 .write = do_sync_write, 19 .write = do_sync_write,
20 .aio_write = generic_file_aio_write, 20 .aio_write = generic_file_aio_write,
21 .mmap = generic_file_mmap, 21 .mmap = generic_file_mmap,
22 .fsync = simple_fsync, 22 .fsync = generic_file_fsync,
23 .splice_read = generic_file_splice_read, 23 .splice_read = generic_file_splice_read,
24}; 24};
25 25
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index 399487c09364..6e7a3291bbe8 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -329,7 +329,7 @@ const struct file_operations omfs_file_operations = {
329 .aio_read = generic_file_aio_read, 329 .aio_read = generic_file_aio_read,
330 .aio_write = generic_file_aio_write, 330 .aio_write = generic_file_aio_write,
331 .mmap = generic_file_mmap, 331 .mmap = generic_file_mmap,
332 .fsync = simple_fsync, 332 .fsync = generic_file_fsync,
333 .splice_read = generic_file_splice_read, 333 .splice_read = generic_file_splice_read,
334}; 334};
335 335
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 3d3fd4692133..6e8fc62b40a8 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -80,7 +80,7 @@ const struct file_operations qnx4_dir_operations =
80 .llseek = generic_file_llseek, 80 .llseek = generic_file_llseek,
81 .read = generic_read_dir, 81 .read = generic_read_dir,
82 .readdir = qnx4_readdir, 82 .readdir = qnx4_readdir,
83 .fsync = simple_fsync, 83 .fsync = generic_file_fsync,
84}; 84};
85 85
86const struct inode_operations qnx4_dir_inode_operations = 86const struct inode_operations qnx4_dir_inode_operations =
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 78f613cb9c76..50020501c5eb 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -43,7 +43,7 @@ const struct file_operations ramfs_file_operations = {
43 .write = do_sync_write, 43 .write = do_sync_write,
44 .aio_write = generic_file_aio_write, 44 .aio_write = generic_file_aio_write,
45 .mmap = generic_file_mmap, 45 .mmap = generic_file_mmap,
46 .fsync = simple_sync_file, 46 .fsync = noop_fsync,
47 .splice_read = generic_file_splice_read, 47 .splice_read = generic_file_splice_read,
48 .splice_write = generic_file_splice_write, 48 .splice_write = generic_file_splice_write,
49 .llseek = generic_file_llseek, 49 .llseek = generic_file_llseek,
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 5ea4ad81a429..869f2d80183d 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -42,7 +42,7 @@ const struct file_operations ramfs_file_operations = {
42 .aio_read = generic_file_aio_read, 42 .aio_read = generic_file_aio_read,
43 .write = do_sync_write, 43 .write = do_sync_write,
44 .aio_write = generic_file_aio_write, 44 .aio_write = generic_file_aio_write,
45 .fsync = simple_sync_file, 45 .fsync = noop_fsync,
46 .splice_read = generic_file_splice_read, 46 .splice_read = generic_file_splice_read,
47 .splice_write = generic_file_splice_write, 47 .splice_write = generic_file_splice_write,
48 .llseek = generic_file_llseek, 48 .llseek = generic_file_llseek,
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 1dabed286b4c..79941e4964a4 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -24,7 +24,7 @@ const struct file_operations sysv_dir_operations = {
24 .llseek = generic_file_llseek, 24 .llseek = generic_file_llseek,
25 .read = generic_read_dir, 25 .read = generic_read_dir,
26 .readdir = sysv_readdir, 26 .readdir = sysv_readdir,
27 .fsync = simple_fsync, 27 .fsync = generic_file_fsync,
28}; 28};
29 29
30static inline void dir_put_page(struct page *page) 30static inline void dir_put_page(struct page *page)
diff --git a/fs/sysv/file.c b/fs/sysv/file.c
index 96340c01f4a7..750cc22349bd 100644
--- a/fs/sysv/file.c
+++ b/fs/sysv/file.c
@@ -26,7 +26,7 @@ const struct file_operations sysv_file_operations = {
26 .write = do_sync_write, 26 .write = do_sync_write,
27 .aio_write = generic_file_aio_write, 27 .aio_write = generic_file_aio_write,
28 .mmap = generic_file_mmap, 28 .mmap = generic_file_mmap,
29 .fsync = simple_fsync, 29 .fsync = generic_file_fsync,
30 .splice_read = generic_file_splice_read, 30 .splice_read = generic_file_splice_read,
31}; 31};
32 32
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 1660c81ffa3d..51552bf50225 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -211,5 +211,5 @@ const struct file_operations udf_dir_operations = {
211 .read = generic_read_dir, 211 .read = generic_read_dir,
212 .readdir = udf_readdir, 212 .readdir = udf_readdir,
213 .unlocked_ioctl = udf_ioctl, 213 .unlocked_ioctl = udf_ioctl,
214 .fsync = simple_fsync, 214 .fsync = generic_file_fsync,
215}; 215};
diff --git a/fs/udf/file.c b/fs/udf/file.c
index baae3a723946..0660280aa180 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -224,7 +224,7 @@ const struct file_operations udf_file_operations = {
224 .write = do_sync_write, 224 .write = do_sync_write,
225 .aio_write = udf_file_aio_write, 225 .aio_write = udf_file_aio_write,
226 .release = udf_release_file, 226 .release = udf_release_file,
227 .fsync = simple_fsync, 227 .fsync = generic_file_fsync,
228 .splice_read = generic_file_splice_read, 228 .splice_read = generic_file_splice_read,
229 .llseek = generic_file_llseek, 229 .llseek = generic_file_llseek,
230}; 230};
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 317a0d444f6b..ec784756dc65 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -666,6 +666,6 @@ not_empty:
666const struct file_operations ufs_dir_operations = { 666const struct file_operations ufs_dir_operations = {
667 .read = generic_read_dir, 667 .read = generic_read_dir,
668 .readdir = ufs_readdir, 668 .readdir = ufs_readdir,
669 .fsync = simple_fsync, 669 .fsync = generic_file_fsync,
670 .llseek = generic_file_llseek, 670 .llseek = generic_file_llseek,
671}; 671};
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index a8962cecde5b..d4c30d1bef86 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -42,6 +42,6 @@ const struct file_operations ufs_file_operations = {
42 .aio_write = generic_file_aio_write, 42 .aio_write = generic_file_aio_write,
43 .mmap = generic_file_mmap, 43 .mmap = generic_file_mmap,
44 .open = dquot_file_open, 44 .open = dquot_file_open,
45 .fsync = simple_fsync, 45 .fsync = generic_file_fsync,
46 .splice_read = generic_file_splice_read, 46 .splice_read = generic_file_splice_read,
47}; 47};