summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2021-01-28 09:55:02 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2021-02-01 13:32:48 -0500
commit0c119e3a18f994251c74c751e1657e4ef8da0c00 (patch)
treec36d5ae8258a35e26bc70d5562d5754e0ce27811 /fs/nfs
parent1af7e7f8c12f521c111bd7cf0d138be7e15b51a5 (diff)
NFS: Call readpage_async_filler() from nfs_readpage_async()
Refactor slightly so nfs_readpage_async() calls into readpage_async_filler(). Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/read.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 8c05e56dab65..0ed79e6bc486 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -119,31 +119,22 @@ struct nfs_readdesc {
struct nfs_open_context *ctx;
};
+static int readpage_async_filler(void *data, struct page *page);
+
int nfs_readpage_async(void *data, struct inode *inode,
struct page *page)
{
struct nfs_readdesc *desc = data;
- struct nfs_page *new;
- unsigned int len;
struct nfs_pgio_mirror *pgm;
-
- len = nfs_page_length(page);
- if (len == 0)
- return nfs_return_empty_page(page);
- new = nfs_create_request(desc->ctx, page, 0, len);
- if (IS_ERR(new)) {
- unlock_page(page);
- return PTR_ERR(new);
- }
- if (len < PAGE_SIZE)
- zero_user_segment(page, len, PAGE_SIZE);
+ int error;
nfs_pageio_init_read(&desc->pgio, inode, false,
&nfs_async_read_completion_ops);
- if (!nfs_pageio_add_request(&desc->pgio, new)) {
- nfs_list_remove_request(new);
- nfs_readpage_release(new, desc->pgio.pg_error);
- }
+
+ error = readpage_async_filler(desc, page);
+ if (error)
+ goto out;
+
nfs_pageio_complete(&desc->pgio);
/* It doesn't make sense to do mirrored reads! */
@@ -153,6 +144,9 @@ int nfs_readpage_async(void *data, struct inode *inode,
NFS_I(inode)->read_io += pgm->pg_bytes_written;
return desc->pgio.pg_error < 0 ? desc->pgio.pg_error : 0;
+
+out:
+ return error;
}
static void nfs_page_group_set_uptodate(struct nfs_page *req)