summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2013-06-29 21:42:20 +0400
committerMiklos Szeredi <mszeredi@suse.cz>2013-10-01 16:44:50 +0200
commitadcadfa8f373f301e9f622fbf45957adf2d98622 (patch)
tree16e9e14e4dfe3aeafb6e1d1f055c20b518deb35f /fs
parent698fa1d163c560343b8012a0a916440d076b6c8a (diff)
downloadlinux-stable-adcadfa8f373f301e9f622fbf45957adf2d98622.tar.gz
linux-stable-adcadfa8f373f301e9f622fbf45957adf2d98622.tar.bz2
linux-stable-adcadfa8f373f301e9f622fbf45957adf2d98622.zip
fuse: Getting file for writeback helper
There will be a .writepageS callback implementation which will need to get a fuse_file out of a fuse_inode, thus make a helper for this. 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')
-rw-r--r--fs/fuse/file.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 4598345ab87d..aab6d05355e4 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1494,6 +1494,20 @@ static void fuse_writepage_end(struct fuse_conn *fc, struct fuse_req *req)
fuse_writepage_free(fc, req);
}
+static struct fuse_file *fuse_write_file(struct fuse_conn *fc,
+ struct fuse_inode *fi)
+{
+ struct fuse_file *ff;
+
+ spin_lock(&fc->lock);
+ BUG_ON(list_empty(&fi->write_files));
+ ff = list_entry(fi->write_files.next, struct fuse_file, write_entry);
+ fuse_file_get(ff);
+ spin_unlock(&fc->lock);
+
+ return ff;
+}
+
static int fuse_writepage_locked(struct page *page)
{
struct address_space *mapping = page->mapping;
@@ -1501,7 +1515,6 @@ static int fuse_writepage_locked(struct page *page)
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
struct fuse_req *req;
- struct fuse_file *ff;
struct page *tmp_page;
set_page_writeback(page);
@@ -1515,13 +1528,8 @@ static int fuse_writepage_locked(struct page *page)
if (!tmp_page)
goto err_free;
- spin_lock(&fc->lock);
- BUG_ON(list_empty(&fi->write_files));
- ff = list_entry(fi->write_files.next, struct fuse_file, write_entry);
- req->ff = fuse_file_get(ff);
- spin_unlock(&fc->lock);
-
- fuse_write_fill(req, ff, page_offset(page), 0);
+ req->ff = fuse_write_file(fc, fi);
+ fuse_write_fill(req, req->ff, page_offset(page), 0);
copy_highpage(tmp_page, page);
req->misc.write.in.write_flags |= FUSE_WRITE_CACHE;