diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2013-10-10 15:12:18 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-04-02 15:38:50 +0200 |
commit | 4d99ff8f12eb20c6cde292f185cb1c8c334ba0ed (patch) | |
tree | a0668c9f45b4065ee935c1f653d32a11ae6ef788 /fs/fuse/file.c | |
parent | fuse: Fix O_DIRECT operations vs cached writeback misorder (diff) | |
download | linux-4d99ff8f12eb20c6cde292f185cb1c8c334ba0ed.tar.xz linux-4d99ff8f12eb20c6cde292f185cb1c8c334ba0ed.zip |
fuse: Turn writeback cache on
Introduce a bit kernel and userspace exchange between each-other on
the init stage and turn writeback on if the userspace want this and
mount option 'allow_wbcache' is present (controlled by fusermount).
Also add each writable file into per-inode write list and call the
generic_file_aio_write to make use of the Linux page cache engine.
Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 276433021561..d03a35d3197e 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -224,6 +224,8 @@ void fuse_finish_open(struct inode *inode, struct file *file) spin_unlock(&fc->lock); fuse_invalidate_attr(inode); } + if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache) + fuse_link_write_file(file); } int fuse_open_common(struct inode *inode, struct file *file, bool isdir) @@ -1197,6 +1199,15 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, struct iov_iter i; loff_t endbyte = 0; + if (get_fuse_conn(inode)->writeback_cache) { + /* Update size (EOF optimization) and mode (SUID clearing) */ + err = fuse_update_attributes(mapping->host, NULL, file, NULL); + if (err) + return err; + + return generic_file_aio_write(iocb, iov, nr_segs, pos); + } + WARN_ON(iocb->ki_pos != pos); ocount = 0; |