From patchwork Wed Jan 28 20:43:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 5731091 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6ABDC9F38B for ; Wed, 28 Jan 2015 21:34:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 887BA200E3 for ; Wed, 28 Jan 2015 21:34:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96CA2201DD for ; Wed, 28 Jan 2015 21:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761554AbbA1UoE (ORCPT ); Wed, 28 Jan 2015 15:44:04 -0500 Received: from mx143.netapp.com ([216.240.21.24]:17204 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761503AbbA1UoD (ORCPT ); Wed, 28 Jan 2015 15:44:03 -0500 X-IronPort-AV: E=Sophos;i="5.09,482,1418112000"; d="scan'208";a="18873643" Received: from vmwexchts01-prd.hq.netapp.com ([10.122.105.12]) by mx143-out.netapp.com with ESMTP; 28 Jan 2015 12:43:55 -0800 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS01-PRD.hq.netapp.com (10.122.105.12) with Microsoft SMTP Server id 15.0.995.29; Wed, 28 Jan 2015 12:43:55 -0800 Received: from davros.com ([10.63.237.113]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id t0SKhpiN026948; Wed, 28 Jan 2015 12:43:55 -0800 (PST) From: Anna Schumaker To: , Subject: [PATCH v2 4/6] NFS: Add READ_PLUS support for hole segments Date: Wed, 28 Jan 2015 15:43:48 -0500 Message-ID: <1422477830-28090-5-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422477830-28090-1-git-send-email-Anna.Schumaker@Netapp.com> References: <1422477830-28090-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch adds support for decoding a single hole segment returned by the server. Signed-off-by: Anna Schumaker --- fs/nfs/nfs42xdr.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 3d7c01b..17126e8 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -212,6 +212,30 @@ out_overflow: return -EIO; } +static int decode_read_plus_hole(struct xdr_stream *xdr, struct nfs_pgio_res *res) +{ + __be32 *p; + uint64_t offset, length; + size_t recvd; + + p = xdr_inline_decode(xdr, 8 + 8); + if (unlikely(!p)) + goto out_overflow; + + p = xdr_decode_hyper(p, &offset); + p = xdr_decode_hyper(p, &length); + + recvd = xdr_expand_hole(xdr, 0, length); + if (recvd < length) + res->eof = 0; + + res->count = recvd; + return 0; +out_overflow: + print_overflow_msg(__func__, xdr); + return -EIO; +} + static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) { __be32 *p; @@ -240,7 +264,7 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) if (type == NFS4_CONTENT_DATA) status = decode_read_plus_data(xdr, res); else - status = -ENOTSUPP; + status = decode_read_plus_hole(xdr, res); if (segments > 1) res->eof = 0;