diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:47 -0400 |
commit | 45323fb76465a9576220c7427dbac7b1e7ad3caf (patch) | |
tree | 5d3e5f9a01cdaf6aaabe38520d5bd5b2d744acd5 /fs/fuse/file.c | |
parent | 04730fef1f9c7277e5c730b193e681ac095b0507 (diff) |
[PATCH] fuse: more flexible caching
Make data caching behavior selectable on a per-open basis instead of
per-mount. Compatibility for the old mount options 'kernel_cache' and
'direct_io' is retained in the userspace library (version 2.4.0-pre1 or
later).
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 | } |