提交 577a8275 编写于 作者: E Evgeniy Dushistov 提交者: Linus Torvalds

[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: NEvgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 647b7e87
...@@ -25,6 +25,26 @@ ...@@ -25,6 +25,26 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/ufs_fs.h> #include <linux/ufs_fs.h>
#include <linux/buffer_head.h> /* for sync_mapping_buffers() */
static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
{
struct inode *inode = dentry->d_inode;
int err;
int ret;
ret = sync_mapping_buffers(inode->i_mapping);
if (!(inode->i_state & I_DIRTY))
return ret;
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
return ret;
err = ufs_sync_inode(inode);
if (ret == 0)
ret = err;
return ret;
}
/* /*
* We have mostly NULL's here: the current defaults are ok for * We have mostly NULL's here: the current defaults are ok for
...@@ -37,6 +57,7 @@ const struct file_operations ufs_file_operations = { ...@@ -37,6 +57,7 @@ const struct file_operations ufs_file_operations = {
.write = generic_file_write, .write = generic_file_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.open = generic_file_open, .open = generic_file_open,
.fsync = ufs_sync_file,
.sendfile = generic_file_sendfile, .sendfile = generic_file_sendfile,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册