diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:04 -0400 |
commit | 577a82752f95a5680d7c14569ffd3fd630d9fb22 (patch) | |
tree | de2edd4f9f0126d8799bbbe9926290c94cb14eee /fs | |
parent | 647b7e87b56f594daf648f44abfbeeb5eb6a9457 (diff) |
[PATCH] ufs: fsync implementation
Presently ufs doesn't support "fsync", this make some applications unhappy,
for example vim. This patch fixes this situation.
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ufs/file.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 312fd3f86313..0e5001512a9d 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -25,6 +25,26 @@ | |||
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/ufs_fs.h> | 27 | #include <linux/ufs_fs.h> |
28 | #include <linux/buffer_head.h> /* for sync_mapping_buffers() */ | ||
29 | |||
30 | static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) | ||
31 | { | ||
32 | struct inode *inode = dentry->d_inode; | ||
33 | int err; | ||
34 | int ret; | ||
35 | |||
36 | ret = sync_mapping_buffers(inode->i_mapping); | ||
37 | if (!(inode->i_state & I_DIRTY)) | ||
38 | return ret; | ||
39 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | ||
40 | return ret; | ||
41 | |||
42 | err = ufs_sync_inode(inode); | ||
43 | if (ret == 0) | ||
44 | ret = err; | ||
45 | return ret; | ||
46 | } | ||
47 | |||
28 | 48 | ||
29 | /* | 49 | /* |
30 | * We have mostly NULL's here: the current defaults are ok for | 50 | * We have mostly NULL's here: the current defaults are ok for |
@@ -37,6 +57,7 @@ const struct file_operations ufs_file_operations = { | |||
37 | .write = generic_file_write, | 57 | .write = generic_file_write, |
38 | .mmap = generic_file_mmap, | 58 | .mmap = generic_file_mmap, |
39 | .open = generic_file_open, | 59 | .open = generic_file_open, |
60 | .fsync = ufs_sync_file, | ||
40 | .sendfile = generic_file_sendfile, | 61 | .sendfile = generic_file_sendfile, |
41 | }; | 62 | }; |
42 | 63 | ||