diff options
author | Maxim Patlasov <MPatlasov@parallels.com> | 2013-10-10 17:11:25 +0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-04-02 15:38:49 +0200 |
commit | 482fce55d2809d639fd0d2e6249c89dedc20eeae (patch) | |
tree | c2c9df130d7805c4e8a7a5afe1cf8af5c89340d6 /fs/fuse | |
parent | e7cc133c370f541fa16723ad7df24de375c26fce (diff) | |
download | linux-next-482fce55d2809d639fd0d2e6249c89dedc20eeae.tar.gz |
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.c | 23 |
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, } } -static int fuse_readpage(struct file *file, struct page *page) +static int fuse_do_readpage(struct file *file, struct page *page) { struct fuse_io_priv io = { .async = 0, .file = file }; struct inode *inode = page->mapping->host; @@ -724,10 +724,6 @@ static int fuse_readpage(struct file *file, struct page *page) u64 attr_ver; int err; - err = -EIO; - if (is_bad_inode(inode)) - goto out; - /* * Page writeback can extend beyond the lifetime of the * 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) fuse_wait_on_page_writeback(inode, page->index); req = fuse_get_req(fc, 1); - err = PTR_ERR(req); if (IS_ERR(req)) - goto out; + return PTR_ERR(req); attr_ver = fuse_get_attr_version(fc); @@ -761,6 +756,20 @@ static int fuse_readpage(struct file *file, struct page *page) } fuse_put_request(fc, req); + + return err; +} + +static int fuse_readpage(struct file *file, struct page *page) +{ + struct inode *inode = page->mapping->host; + int err; + + err = -EIO; + if (is_bad_inode(inode)) + goto out; + + err = fuse_do_readpage(file, page); fuse_invalidate_atime(inode); out: unlock_page(page); |