aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMaxim Patlasov <MPatlasov@parallels.com>2013-10-10 09:11:25 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2014-04-02 09:38:49 -0400
commit482fce55d2809d639fd0d2e6249c89dedc20eeae (patch)
treec2c9df130d7805c4e8a7a5afe1cf8af5c89340d6 /fs/fuse
parente7cc133c370f541fa16723ad7df24de375c26fce (diff)
fuse: restructure fuse_readpage()
Move the code filling and sending read request to a separate function. Future patches will use it for .write_begin -- partial modification of a page requires reading the page from the storage very similarly to what fuse_readpage does. Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 530b1e804a32..b1873b510350 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -712,7 +712,7 @@ static void fuse_short_read(struct fuse_req *req, struct inode *inode,
712 } 712 }
713} 713}
714 714
715static int fuse_readpage(struct file *file, struct page *page) 715static int fuse_do_readpage(struct file *file, struct page *page)
716{ 716{
717 struct fuse_io_priv io = { .async = 0, .file = file }; 717 struct fuse_io_priv io = { .async = 0, .file = file };
718 struct inode *inode = page->mapping->host; 718 struct inode *inode = page->mapping->host;
@@ -724,10 +724,6 @@ static int fuse_readpage(struct file *file, struct page *page)
724 u64 attr_ver; 724 u64 attr_ver;
725 int err; 725 int err;
726 726
727 err = -EIO;
728 if (is_bad_inode(inode))
729 goto out;
730
731 /* 727 /*
732 * Page writeback can extend beyond the lifetime of the 728 * Page writeback can extend beyond the lifetime of the
733 * page-cache page, so make sure we read a properly synced 729 * page-cache page, so make sure we read a properly synced
@@ -736,9 +732,8 @@ static int fuse_readpage(struct file *file, struct page *page)
736 fuse_wait_on_page_writeback(inode, page->index); 732 fuse_wait_on_page_writeback(inode, page->index);
737 733
738 req = fuse_get_req(fc, 1); 734 req = fuse_get_req(fc, 1);
739 err = PTR_ERR(req);
740 if (IS_ERR(req)) 735 if (IS_ERR(req))
741 goto out; 736 return PTR_ERR(req);
742 737
743 attr_ver = fuse_get_attr_version(fc); 738 attr_ver = fuse_get_attr_version(fc);
744 739
@@ -761,6 +756,20 @@ static int fuse_readpage(struct file *file, struct page *page)
761 } 756 }
762 757
763 fuse_put_request(fc, req); 758 fuse_put_request(fc, req);
759
760 return err;
761}
762
763static int fuse_readpage(struct file *file, struct page *page)
764{
765 struct inode *inode = page->mapping->host;
766 int err;
767
768 err = -EIO;
769 if (is_bad_inode(inode))
770 goto out;
771
772 err = fuse_do_readpage(file, page);
764 fuse_invalidate_atime(inode); 773 fuse_invalidate_atime(inode);
765 out: 774 out:
766 unlock_page(page); 775 unlock_page(page);