From patchwork Wed Jul 15 15:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wysochanski X-Patchwork-Id: 11665747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70C2813B1 for ; Wed, 15 Jul 2020 15:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50C612065D for ; Wed, 15 Jul 2020 15:11:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="abeXD5+9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726794AbgGOPL5 (ORCPT ); Wed, 15 Jul 2020 11:11:57 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38031 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726617AbgGOPLz (ORCPT ); Wed, 15 Jul 2020 11:11:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594825914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=U8+8KfiKkKyFnWj9Q70SrH2dBP9qoCu1/bqk3PEKvz8=; b=abeXD5+9GYMkmQa1eg9npHm7+4fz62iOt8gDGpJzINtTPSB8mR3cBy4poB0Dcg363ckhpZ PcgNbLCf6XG+MB9CFAPE96+CH0GrhSvA4ERt+YRjQWOhbGMEM0oxSgXrgsGH6t+IdWbFEO YVyjbzwRTXk6+htRJM9dfKs0Yz4XxVk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-oloViQuSNHOXIJFvpVrPAA-1; Wed, 15 Jul 2020 11:11:52 -0400 X-MC-Unique: oloViQuSNHOXIJFvpVrPAA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD85618C899E; Wed, 15 Jul 2020 15:10:53 +0000 (UTC) Received: from dwysocha.rdu.csb (ovpn-118-79.rdu2.redhat.com [10.10.118.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F83860BF1; Wed, 15 Jul 2020 15:10:53 +0000 (UTC) From: Dave Wysochanski To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, linux-cachefs@redhat.com Subject: [RFC PATCH v1 04/13] NFS: Call readpage_async_filler() from nfs_readpage_async() Date: Wed, 15 Jul 2020 11:10:40 -0400 Message-Id: <1594825849-24991-5-git-send-email-dwysocha@redhat.com> In-Reply-To: <1594825849-24991-1-git-send-email-dwysocha@redhat.com> References: <1594825849-24991-1-git-send-email-dwysocha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Refactor slightly so nfs_readpage_async() calls into readpage_async_filler(). Signed-off-by: Dave Wysochanski --- fs/nfs/read.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index d635f635d8e3..600c17c2b409 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 = (struct nfs_readdesc *)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)