Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2205922pxa; Mon, 3 Aug 2020 10:01:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzT0AQj/+VZ5g1oXOaJJp9wnm3TEDwJLh2kSFsafowaOKiskQ5Vcg71BlltcgLrYaH0ghti X-Received: by 2002:a17:906:12cd:: with SMTP id l13mr17143305ejb.385.1596474084702; Mon, 03 Aug 2020 10:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596474084; cv=none; d=google.com; s=arc-20160816; b=EyQ6UNOuwYixZ0pTw0CizOfhR3DDWB0WBnB7c0kjTQn1EVHB65e5h/Z1ikTnMmMrbs yqJObUKnE7Rj2amzX4e/5LYJEXJTGTc3oGrL6lAtkkHr4ErkwZTj/776D0qG08ZhEA6C A16VsmPecPeJBqJA3M/9uBHVlkqekYPUkXZjxsupy7Dzj4lFR8cN+V3rwv4KABa3SSmh sYapmySeSPLaUUD7uf1uOkpm2+GzxVLv/kG8Kt599onZzrlOb3hz7lySj1zSKRWw4Zle VIe1BuLW4AGzmu31ulddtewNtFHetTeYu+zBi8j3nlLWf9uKqw0G4Yq1LXasmaC2ZJEK Sl1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3XKKgP0H0vf+KZtXz13oZQXMZRxws2V9QHF/uSVmIjA=; b=UjKpxmiBC89ZrIwe+wxVvPaazizu8Q0+cFWh2xuINlv0mNj0b7DcR5sZSNoNbTxKMc AI/InZsjwn2HVL/ucB8mxhlow7gztGFE2RDjY9x1KAWiIF62QHqJP4LbOgGLPjsR8tZO pIv5yOzdfXSSVpaflc7shmyYyLfaetxMD/vJKLLRhW3biZix77wJNgtO4tNMkF+uVUrV WwzG0L/kogP2OocX5n0JxNmugjlR+hlUUGWYNzqyrZCbYQw7K7c+qJHdr6+iNPQJqwKu RCQ+egxpdvMohClQpLPrPgLelA6YcVO7f166u+TRY0EGFBjvctgMlVBP9aFgPkvck+7k RKsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EsJnnXbN; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si8237794eja.41.2020.08.03.10.01.01; Mon, 03 Aug 2020 10:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EsJnnXbN; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728156AbgHCRAZ (ORCPT + 99 others); Mon, 3 Aug 2020 13:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbgHCRAY (ORCPT ); Mon, 3 Aug 2020 13:00:24 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59500C06174A for ; Mon, 3 Aug 2020 10:00:24 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id t15so30319296iob.3 for ; Mon, 03 Aug 2020 10:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3XKKgP0H0vf+KZtXz13oZQXMZRxws2V9QHF/uSVmIjA=; b=EsJnnXbNOatiZBi1Z7DIp4IYrYgDQ/9O6ADdLFsh3IjIZIdpyvzcnU0jQxcU5astmW jVBIUy7XYnPZDGvlE4XSg58dav63awhr0ADTHwkQSM0UBVa0goBVddhipmRcO2qx+nPK xdSlNPA3P0D3G3ZWzcpx68S8DN/uhCXozC0e8aZqV1+i0rv3R/jIyQIcoYo2HElURWwj S61AUELtFPRktPOtv835WgBfmJB/8EBYOKgpM7jSZmVnVjpwiKuQafC041DgwP+/RlLM x7Ewf79Y9nNT43ZnQwEUnyucs9FoFEdyKZGUn1ohKNFDRvIaeuNhEmZCz5W8GPWtdzja OGpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3XKKgP0H0vf+KZtXz13oZQXMZRxws2V9QHF/uSVmIjA=; b=WuwPda5YNAnkV3UICjkya8eM0b2KPTMo6hXqOAdjLupGZCGVxJnmt7S78b2cGoLa7h +9PFBSnHoWc8b1Osjsdu7mfnvOvyo83PHdQbvEu9NzgrlJI6yCn3gdGDs0dI07PajvUP e8irqnA5qo2HwG+W//HanGeunTHxXjQFTKC5hc5i6pxy8nadAmwcEBwx2o2rUojNcZq4 M39C4vLid+sWhLzp2K/W3CZPlVbpnXVPqwKXV2hISB8p6uWgHkv0kz6e1QyOkTz/TXV/ 5g1E3L+SaRPNlRK6JQ5z67FhZDV4fsXbu6oqxSnIQuv37MumhmeF119wM7LGkulSpJn4 XB2w== X-Gm-Message-State: AOAM530wXiWtpS4ri9qssd8Ctg/5QZxwVSNoaLNXsGfhGxlf6iZUAjmj 6Wo6KodQUgNM/HpYhlOZuHqYCt4c X-Received: by 2002:a5e:8408:: with SMTP id h8mr757269ioj.137.1596474023466; Mon, 03 Aug 2020 10:00:23 -0700 (PDT) Received: from gouda.nowheycreamery.com (c-68-32-74-190.hsd1.mi.comcast.net. [68.32.74.190]) by smtp.gmail.com with ESMTPSA id a6sm10498040ioo.44.2020.08.03.10.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 10:00:22 -0700 (PDT) From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v3 08/10] NFS: Add READ_PLUS hole segment decoding Date: Mon, 3 Aug 2020 13:00:11 -0400 Message-Id: <20200803170013.1348350-9-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200803170013.1348350-1-Anna.Schumaker@Netapp.com> References: <20200803170013.1348350-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker We keep things simple for now by only decoding a single hole or data segment returned by the server, even if they returned more to us. Signed-off-by: Anna Schumaker --- fs/nfs/nfs42xdr.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 9a1e18295e55..791e90353bc2 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -53,7 +53,7 @@ #define decode_read_plus_maxsz (op_decode_hdr_maxsz + \ 1 /* rpr_eof */ + \ 1 /* rpr_contents count */ + \ - NFS42_READ_PLUS_SEGMENT_SIZE) + 2 * NFS42_READ_PLUS_SEGMENT_SIZE) #define encode_seek_maxsz (op_encode_hdr_maxsz + \ encode_stateid_maxsz + \ 2 /* offset */ + \ @@ -768,6 +768,29 @@ static int decode_read_plus_data(struct xdr_stream *xdr, struct nfs_pgio_res *re return 0; } +static int decode_read_plus_hole(struct xdr_stream *xdr, struct nfs_pgio_res *res, + uint32_t *eof) +{ + uint64_t offset, length, recvd; + __be32 *p; + + p = xdr_inline_decode(xdr, 8 + 8); + if (unlikely(!p)) + return -EIO; + + p = xdr_decode_hyper(p, &offset); + p = xdr_decode_hyper(p, &length); + + recvd = xdr_expand_hole(xdr, 0, length); + if (recvd < length) { + *eof = 0; + length = recvd; + } + + res->count += length; + return 0; +} + static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) { uint32_t eof, segments, type; @@ -794,6 +817,8 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) type = be32_to_cpup(p++); if (type == NFS4_CONTENT_DATA) status = decode_read_plus_data(xdr, res, &eof); + else if (type == NFS4_CONTENT_HOLE) + status = decode_read_plus_hole(xdr, res, &eof); else return -EINVAL; -- 2.27.0