Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4067189pxk; Tue, 8 Sep 2020 09:50:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzedOe80J4vnSg2pkff7bU0MId5LBAuHEtkN6zHMmJI40UCzzXWr/iNL3zLkruSfGc8C1Fn X-Received: by 2002:a17:906:5f96:: with SMTP id a22mr28155727eju.335.1599583810061; Tue, 08 Sep 2020 09:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599583810; cv=none; d=google.com; s=arc-20160816; b=A/OhouMJcJajj/kaYGJMSeIM+2O5My/FV96nIp4s856dSN4A/6ZwlKVRBqsRX0SG4K VPoRVZ4Tw8PpX+0fUjKGjnehhApYDt8VeONFmnQboXaQy0Ml23Cp8fFP0J7VPQG4gdK0 tF9YzNpIy8edxx1abWJ84Ogt2q16rohq/X2WkxjeNHfhjkxeRDUmMlC2qR/THyQyuWlR EXdWhOL3YA1t/v96n0PrEzthivUZiUU0Elg3nbNLsaaqgEf35m3lEb95bjV35XF+vsOB 5uPJqvzb1KkXBaWZzTDMWBwj2XAMnYWNGuSGQI3nnJqKAJrZ2ALEEkPUnWeyL4stxziA uCQw== 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=wp5SKBozu7cWhnGG7XLzLGXTHYmhOkgCPiKlw5Gsgd0=; b=xxPJI+19zCXXUkR8lh2WLlOUM2o/83YDkBsgErhJ//OaMGBoV85hVkXW3Z++vucY79 5DVWgXHZAlcHYifRCDxDXUcmRYKpI8DalOssxoR/XUU3K7JJiFicFzEjSA5S9FCDTCpN DANexPodn7+DSjKCdL/0uZIXiPh8JzPLy7Lx0qek2+V9qP2Sr/qzd9eNfCSX4q5d7J0H PyjhCuAiKgBrRobfUWX08K4TICcjZa5hssAYKvjyAK4oX53sNxmUT/yzyU5VKRl3KKWs DEjFNSxiGqEb/RgK3iMFtyv4t1S4IPPXE4mmrgGT9MtfrIdbLljmiPs224uaucKhV8Gk 2bUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Uxdn9ra0; 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 h19si11388458edv.301.2020.09.08.09.49.46; Tue, 08 Sep 2020 09:50:10 -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=Uxdn9ra0; 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 S1731442AbgIHQ0S (ORCPT + 99 others); Tue, 8 Sep 2020 12:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731901AbgIHQZj (ORCPT ); Tue, 8 Sep 2020 12:25:39 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980D2C061797 for ; Tue, 8 Sep 2020 09:25:23 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id d190so17754353iof.3 for ; Tue, 08 Sep 2020 09:25:23 -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=wp5SKBozu7cWhnGG7XLzLGXTHYmhOkgCPiKlw5Gsgd0=; b=Uxdn9ra0AWYEIBz4HcLQ8Lnk4Ylh5IoGNYwirAoQUkvx0VW6Jj1jHuWwjAlb0QaYMS FFhofH1X2jfdQ5lRL1brgI0sqM8wkFQGKRu67+pkyGZJ9o4ITkTJNkMnhapMoS61tjQL cPTi3AusDF1xBixQ/nSzChpb3arIViJFzls+HWuMkz6JqphGQkBnDz7TJ7jEQd1cGtpc EALCZUfOmNxO7TVnpOfWtYAYmS4KEUVw+rIxZdwCOy9V8OknqbX9+9/gK6fkWfgnxGDz gESI3Aiv762Jli8ru3JQJWDOwB3e32aS4P0m28+sFOatXbMqHYb8n+LfczHaUDoVsSUR lyAw== 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=wp5SKBozu7cWhnGG7XLzLGXTHYmhOkgCPiKlw5Gsgd0=; b=W9mlpRQuCd7+tuRP9ReowWk0HiJEDdke0Y0Bttrcs1TiYMgtgC0lQQr/uYTLk/7erI 8RRvF5SqEIFBKsuWZf/BWLqph+GjUYZyHJESn+RBmkwKcm7NaeGnqJjdLcWaF9U9nSSP YoRJyXOEO+4dNkElOR+UTs2X6Pw6CoO9ofa3uaGHZsaFA+44bkCNMpOmBJYN7MR60l5x 1YHviSO9ZSNcbTkDoLR1Ijx3IExdWGzDwHl0SQ7mNpa/eatL3rEkFleJXVvaMduS+J2p RZLOoMahc8GPKSnnFWmNNZNuC3sDUzMcI2Ou67RxNAEO6sC+ub1vQB5cWVzA0KpTKVO6 TDPA== X-Gm-Message-State: AOAM530Km6etHceLK8QDYQveiRwZNNpp8x5VIKbv+BAqWJe2Dfyubcps DQDZFaCOq+CDdCkib5Tx+N+CpBe1hSM= X-Received: by 2002:a02:a1d3:: with SMTP id o19mr25321233jah.90.1599582322635; Tue, 08 Sep 2020 09:25:22 -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 2sm10291375ilj.24.2020.09.08.09.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 09:25: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 v5 08/10] NFS: Add READ_PLUS hole segment decoding Date: Tue, 8 Sep 2020 12:25:11 -0400 Message-Id: <20200908162513.508991-9-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908162513.508991-1-Anna.Schumaker@Netapp.com> References: <20200908162513.508991-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 | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 930b4ca212c1..9720fedd2e57 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 */ + \ @@ -1045,6 +1045,28 @@ 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); + res->count += recvd; + + if (recvd < length) { + *eof = 0; + return 1; + } + return 0; +} + static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) { uint32_t eof, segments, type; @@ -1071,6 +1093,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.28.0