From patchwork Tue May 20 18:08:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 4212431 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B54909F32A for ; Tue, 20 May 2014 18:08:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34ECB201DE for ; Tue, 20 May 2014 18:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BD58201F2 for ; Tue, 20 May 2014 18:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751532AbaETSIe (ORCPT ); Tue, 20 May 2014 14:08:34 -0400 Received: from mx11.netapp.com ([216.240.18.76]:53894 "EHLO mx11.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244AbaETSIe (ORCPT ); Tue, 20 May 2014 14:08:34 -0400 X-IronPort-AV: E=Sophos;i="4.98,875,1392192000"; d="scan'208";a="124239570" Received: from vmwexceht02-prd.hq.netapp.com ([10.106.76.240]) by mx11-out.netapp.com with ESMTP; 20 May 2014 11:08:34 -0700 Received: from VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) by vmwexceht02-prd.hq.netapp.com (10.106.76.240) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 20 May 2014 11:08:33 -0700 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.847.32; Tue, 20 May 2014 11:08:33 -0700 Received: from davros.com (davros.ocarinaproject.vpn.netapp.com [10.63.224.110]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id s4KI8LYq029501; Tue, 20 May 2014 11:08:32 -0700 (PDT) From: Anna Schumaker To: , CC: , Subject: [RFC 10/12] nfs: Split up generic_pg_pgios Date: Tue, 20 May 2014 14:08:17 -0400 Message-ID: <1400609299-32558-11-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1400609299-32558-1-git-send-email-Anna.Schumaker@Netapp.com> References: <1400609299-32558-1-git-send-email-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pnfs will need a way to use a different function to initiate IO and to free the pgio_header. The common function now expects a function pointer for each. Signed-off-by: Anna Schumaker --- fs/nfs/internal.h | 4 ++++ fs/nfs/pagelist.c | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 5b64177..3a5abf0 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -242,6 +242,10 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *); void nfs_pgio_header_free(struct nfs_pgio_header *); int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); void nfs_generic_pgio_reset(struct nfs_pgio_header *); +int nfs_generic_pgios_common(struct nfs_pageio_descriptor *, + void (*)(struct nfs_pgio_header *), + int (*)(struct nfs_pageio_descriptor *, + struct nfs_pgio_header *)); int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_header *, const struct rpc_call_ops *, int, int); diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index d1670a2..fc01c5b 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -722,8 +722,18 @@ void nfs_generic_pgio_reset(struct nfs_pgio_header *hdr) } EXPORT_SYMBOL_GPL(nfs_generic_pgio_reset); +static int nfs_do_pgio(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr) +{ + return nfs_initiate_pgio(NFS_CLIENT(hdr->inode), + hdr, desc->pg_rpc_callops, + desc->pg_ioflags, 0); +} -static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) +int nfs_generic_pgios_common(struct nfs_pageio_descriptor *desc, + void (*free_header)(struct nfs_pgio_header *), + int (*do_pgio)(struct nfs_pageio_descriptor *, + struct nfs_pgio_header *)) { struct nfs_pgio_header *hdr; int ret; @@ -733,14 +743,18 @@ static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) desc->pg_completion_ops->error_cleanup(&desc->pg_list); return -ENOMEM; } - nfs_pgheader_init(desc, hdr, nfs_pgio_header_free); + nfs_pgheader_init(desc, hdr, free_header); ret = nfs_generic_pgio(desc, hdr); if (ret == 0) - ret = nfs_initiate_pgio(NFS_CLIENT(hdr->inode), - hdr, desc->pg_rpc_callops, - desc->pg_ioflags, 0); + ret = do_pgio(desc, hdr); return ret; } +EXPORT_SYMBOL_GPL(nfs_generic_pgios_common); + +static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) +{ + return nfs_generic_pgios_common(desc, nfs_pgio_header_free, nfs_do_pgio); +} static bool nfs_match_open_context(const struct nfs_open_context *ctx1, const struct nfs_open_context *ctx2)