Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp943711imi; Fri, 22 Jul 2022 13:11:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZ/pxq6OpVi9XuiMKCRRTodcB4zRbMfzBBPxPczFvfYA9LarUPWxTvFOvB1L360JvQm+o6 X-Received: by 2002:a17:906:8448:b0:72b:5659:9873 with SMTP id e8-20020a170906844800b0072b56599873mr1227085ejy.117.1658520666664; Fri, 22 Jul 2022 13:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658520666; cv=none; d=google.com; s=arc-20160816; b=zR06xvAVTaJH+/qN7gI2UV5XPG8K7LWOTT7/tUEpx3Jfi0rMumBxWpI5QVqFJxbdgq EBN1IjlByIn6ZPN+dGSCXV2od/POFCN91Y4U7mXx6bBCSSc6VUMd375m9IbsX/Uds+a/ FoUZTFSRs9UXZ82RyC9oYdiKq1Q/kS9WP2IN0MmO3wnVLACNstnCbLeMub0Tqb3BexDm HKBbOScv+4DeFZvUlKeFmFOf8VT4L/zWL+gvnVkxedjyYBlY9jw+0ITMmtqyq0aKe3dm AomKt8CilJBesQOsAMRMG2m2/0nlUruJCzefRENgkA/k6CP5/VDyzjN8FP7z7DwZz0D/ mP/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=ZoRpaJVaxiwLN9y/bn6KOueiJdIVn4wQfKUm0K+xysI=; b=eYmsOw8UpcEptk3mma5/QogUJmT7pVNv0jaDjCftHlCDSzR78+MkgRlZaHshb3yu44 wWildKKBtp6Aue5uc9d1XQ/pzQGQ4bXuAsl3IMvsaBvchwNoH2FGY9BBX1k/peu0Oobj mIMs+WOtHBzlVAzitZis3z6tXHr7ui0OAxq+jRZT7HeO6UejpeRDkzADWz/qBZm735hg mGjZTk12WeiVf5PwgaQQBHmEKmP6cTVrFy+H1GcHLW4WZxBBs2FIX/XbOB40ZyMuIPAW gNIbBvf0xOGCry6FXWUpUn41PzsATrzSHuv/D7KasJbKWxgSiCAK+YuIPVVHPfj19c6F TbTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot15-20020a170906cccf00b0072ab9f8a4b9si6186214ejb.191.2022.07.22.13.10.42; Fri, 22 Jul 2022 13:11:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236569AbiGVUJV (ORCPT + 99 others); Fri, 22 Jul 2022 16:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236814AbiGVUJP (ORCPT ); Fri, 22 Jul 2022 16:09:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F11AF867 for ; Fri, 22 Jul 2022 13:09:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF58AB81EDB for ; Fri, 22 Jul 2022 20:09:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BFB3C341C6 for ; Fri, 22 Jul 2022 20:09:11 +0000 (UTC) Subject: [PATCH v1 6/8] NFSD: Simplify starting_len From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Fri, 22 Jul 2022 16:09:10 -0400 Message-ID: <165852055039.11198.3834750353256141137.stgit@manet.1015granger.net> In-Reply-To: <165852051841.11198.2929614302983292322.stgit@manet.1015granger.net> References: <165852051841.11198.2929614302983292322.stgit@manet.1015granger.net> User-Agent: StGit/1.5.dev2+g9ce680a5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Clean-up: Now that nfsd4_encode_readv() does not have to encode the EOF or rd_length values, it no longer needs to subtract 8 from @starting_len. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1e59d4ce529f..32f4f48458e6 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3939,7 +3939,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, struct file *file, unsigned long maxcount) { struct xdr_stream *xdr = resp->xdr; - int starting_len = xdr->buf->len - 8; + unsigned int starting_len = xdr->buf->len; __be32 nfserr; __be32 tmp; int pad; @@ -3954,14 +3954,13 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, read->rd_length = maxcount; if (nfserr) return nfserr; - if (svc_encode_result_payload(resp->rqstp, starting_len + 8, maxcount)) + if (svc_encode_result_payload(resp->rqstp, starting_len, maxcount)) return nfserr_io; - xdr_truncate_encode(xdr, starting_len + 8 + xdr_align_size(maxcount)); + xdr_truncate_encode(xdr, starting_len + xdr_align_size(maxcount)); tmp = xdr_zero; pad = (maxcount&3) ? 4 - (maxcount&3) : 0; - write_bytes_to_xdr_buf(xdr->buf, starting_len + 8 + maxcount, - &tmp, pad); + write_bytes_to_xdr_buf(xdr->buf, starting_len + maxcount, &tmp, pad); return 0; }