diff options
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 224453557cf6..a8dc88527fbe 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | 14 | ||
15 | static struct file_operations fuse_direct_io_file_operations; | ||
16 | |||
15 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) | 17 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) |
16 | { | 18 | { |
17 | struct fuse_conn *fc = get_fuse_conn(inode); | 19 | struct fuse_conn *fc = get_fuse_conn(inode); |
@@ -70,12 +72,14 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) | |||
70 | else | 72 | else |
71 | request_send(fc, req); | 73 | request_send(fc, req); |
72 | err = req->out.h.error; | 74 | err = req->out.h.error; |
73 | if (!err && !(fc->flags & FUSE_KERNEL_CACHE)) | ||
74 | invalidate_inode_pages(inode->i_mapping); | ||
75 | if (err) { | 75 | if (err) { |
76 | fuse_request_free(ff->release_req); | 76 | fuse_request_free(ff->release_req); |
77 | kfree(ff); | 77 | kfree(ff); |
78 | } else { | 78 | } else { |
79 | if (!isdir && (outarg.open_flags & FOPEN_DIRECT_IO)) | ||
80 | file->f_op = &fuse_direct_io_file_operations; | ||
81 | if (!(outarg.open_flags & FOPEN_KEEP_CACHE)) | ||
82 | invalidate_inode_pages(inode->i_mapping); | ||
79 | ff->fh = outarg.fh; | 83 | ff->fh = outarg.fh; |
80 | file->private_data = ff; | 84 | file->private_data = ff; |
81 | } | 85 | } |
@@ -544,12 +548,6 @@ static struct address_space_operations fuse_file_aops = { | |||
544 | 548 | ||
545 | void fuse_init_file_inode(struct inode *inode) | 549 | void fuse_init_file_inode(struct inode *inode) |
546 | { | 550 | { |
547 | struct fuse_conn *fc = get_fuse_conn(inode); | 551 | inode->i_fop = &fuse_file_operations; |
548 | 552 | inode->i_data.a_ops = &fuse_file_aops; | |
549 | if (fc->flags & FUSE_DIRECT_IO) | ||
550 | inode->i_fop = &fuse_direct_io_file_operations; | ||
551 | else { | ||
552 | inode->i_fop = &fuse_file_operations; | ||
553 | inode->i_data.a_ops = &fuse_file_aops; | ||
554 | } | ||
555 | } | 553 | } |