aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2013-10-10 09:10:04 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2014-04-02 09:38:47 -0400
commit650b22b941fa03590c4a3671e79ec2c96ea59e9a (patch)
tree700045af763d8dad41138d55f1f83a02af36cfd3 /fs/fuse
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
fuse: Linking file to inode helper
When writeback is ON every writeable file should be in per-inode write list, not only mmap-ed ones. Thus introduce a helper for this linkage. Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 77bcc303c3ae..2489aca4d1a6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -188,6 +188,22 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
188} 188}
189EXPORT_SYMBOL_GPL(fuse_do_open); 189EXPORT_SYMBOL_GPL(fuse_do_open);
190 190
191static void fuse_link_write_file(struct file *file)
192{
193 struct inode *inode = file_inode(file);
194 struct fuse_conn *fc = get_fuse_conn(inode);
195 struct fuse_inode *fi = get_fuse_inode(inode);
196 struct fuse_file *ff = file->private_data;
197 /*
198 * file may be written through mmap, so chain it onto the
199 * inodes's write_file list
200 */
201 spin_lock(&fc->lock);
202 if (list_empty(&ff->write_entry))
203 list_add(&ff->write_entry, &fi->write_files);
204 spin_unlock(&fc->lock);
205}
206
191void fuse_finish_open(struct inode *inode, struct file *file) 207void fuse_finish_open(struct inode *inode, struct file *file)
192{ 208{
193 struct fuse_file *ff = file->private_data; 209 struct fuse_file *ff = file->private_data;
@@ -1946,20 +1962,9 @@ static const struct vm_operations_struct fuse_file_vm_ops = {
1946 1962
1947static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma) 1963static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
1948{ 1964{
1949 if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) { 1965 if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE))
1950 struct inode *inode = file_inode(file); 1966 fuse_link_write_file(file);
1951 struct fuse_conn *fc = get_fuse_conn(inode); 1967
1952 struct fuse_inode *fi = get_fuse_inode(inode);
1953 struct fuse_file *ff = file->private_data;
1954 /*
1955 * file may be written through mmap, so chain it onto the
1956 * inodes's write_file list
1957 */
1958 spin_lock(&fc->lock);
1959 if (list_empty(&ff->write_entry))
1960 list_add(&ff->write_entry, &fi->write_files);
1961 spin_unlock(&fc->lock);
1962 }
1963 file_accessed(file); 1968 file_accessed(file);
1964 vma->vm_ops = &fuse_file_vm_ops; 1969 vma->vm_ops = &fuse_file_vm_ops;
1965 return 0; 1970 return 0;