aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/file.c')
-rw-r--r--fs/ext2/file.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index a2f3afd1a1c1..5d198d0697fb 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -19,6 +19,8 @@
19 */ 19 */
20 20
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/pagemap.h>
23#include <linux/quotaops.h>
22#include "ext2.h" 24#include "ext2.h"
23#include "xattr.h" 25#include "xattr.h"
24#include "acl.h" 26#include "acl.h"
@@ -38,6 +40,22 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
38 return 0; 40 return 0;
39} 41}
40 42
43int ext2_fsync(struct file *file, struct dentry *dentry, int datasync)
44{
45 int ret;
46 struct super_block *sb = dentry->d_inode->i_sb;
47 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
48
49 ret = simple_fsync(file, dentry, datasync);
50 if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) {
51 /* We don't really know where the IO error happened... */
52 ext2_error(sb, __func__,
53 "detected IO error when writing metadata buffers");
54 ret = -EIO;
55 }
56 return ret;
57}
58
41/* 59/*
42 * We have mostly NULL's here: the current defaults are ok for 60 * We have mostly NULL's here: the current defaults are ok for
43 * the ext2 filesystem. 61 * the ext2 filesystem.
@@ -53,9 +71,9 @@ const struct file_operations ext2_file_operations = {
53 .compat_ioctl = ext2_compat_ioctl, 71 .compat_ioctl = ext2_compat_ioctl,
54#endif 72#endif
55 .mmap = generic_file_mmap, 73 .mmap = generic_file_mmap,
56 .open = generic_file_open, 74 .open = dquot_file_open,
57 .release = ext2_release_file, 75 .release = ext2_release_file,
58 .fsync = simple_fsync, 76 .fsync = ext2_fsync,
59 .splice_read = generic_file_splice_read, 77 .splice_read = generic_file_splice_read,
60 .splice_write = generic_file_splice_write, 78 .splice_write = generic_file_splice_write,
61}; 79};
@@ -70,9 +88,9 @@ const struct file_operations ext2_xip_file_operations = {
70 .compat_ioctl = ext2_compat_ioctl, 88 .compat_ioctl = ext2_compat_ioctl,
71#endif 89#endif
72 .mmap = xip_file_mmap, 90 .mmap = xip_file_mmap,
73 .open = generic_file_open, 91 .open = dquot_file_open,
74 .release = ext2_release_file, 92 .release = ext2_release_file,
75 .fsync = simple_fsync, 93 .fsync = ext2_fsync,
76}; 94};
77#endif 95#endif
78 96