Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1050196pxm; Wed, 23 Feb 2022 16:52:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzN9VfEeOEHWtP5i01lXtvrGIZ/tqGO7l6GRlbxsPua3CwbQC12g/QsSEVVmReSYZxbE7Lf X-Received: by 2002:a63:e64a:0:b0:373:687a:9bce with SMTP id p10-20020a63e64a000000b00373687a9bcemr342517pgj.30.1645663930380; Wed, 23 Feb 2022 16:52:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645663930; cv=none; d=google.com; s=arc-20160816; b=x7k6EqDpLaInQN85EzWB7bXqoC3QM9gu7iIByn0TDZUId54TNjvJMvi5FtiR7NwLGT 7RQCCDhf/aAuqDhg8CGop4L13y5WG5gZPWOcrqpz7f/f9rA+Vcf0+VF7I9JJgRWsK44A +pmj9+wKwfRVJm9DehMhyCwFciHRpRpWEQ7ZSeAiCElcE7/0aQXbGhsIAm48UlEZFbsG UXDrs679v+Ua2OqpEBVxuXym4eRlHCvTjNLud0ur6pfPWPbTIYA30EOoFnsAS3+cx62L hKGDxOgr19BEZkhGiJZmP1CYwSKfjrYkCJXtaqJCTSk5wRD74X17WCzsDsInlZJsDNbl R3HQ== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZrgQhUr9T8JXJMFKtvDZxmm6e5DBTo1ujmUe2/85g4I=; b=Cpdv3fW6hipcUYfrYu2xTGDor59XduQxdwbzCcwOxwrxdJwWuXcF8OG608eYi5RVfe +KDFdIAEtduTu3inoRvphVs/WkMQ1qHYFlcgeO13yUV6exfRAynzcOvXFjfDkE8wnMSN mXC/7wYIiiwslfHnFoaWoILO5WGC9JvmrpkpHL9yE9Y+5z9K2Jz6b6kg/Xld8CZKYu8J uVED+OHfHiqUeuI/ca0XrBdO4b1/EzLScadFE9nrCqPyAjwqQW3H9aL6SswBH+/c2y3f JNHhphj2yrBvw5It2cNG3xAXNmj0yPYh8MRWxS5wwXQ67nhHlUFZvIpXdA8cBpL1udA6 /xTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RWm0ku+P; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h129si1039032pgc.336.2022.02.23.16.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:52:10 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RWm0ku+P; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43847B65F4; Wed, 23 Feb 2022 16:46:33 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242447AbiBWVUH (ORCPT + 99 others); Wed, 23 Feb 2022 16:20:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242403AbiBWVUF (ORCPT ); Wed, 23 Feb 2022 16:20:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDD84ECCD for ; Wed, 23 Feb 2022 13:19:37 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 4B70C618A0 for ; Wed, 23 Feb 2022 21:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01782C340E7 for ; Wed, 23 Feb 2022 21:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645651177; bh=h+cJYvOB7K5QBDul+/hHIKM5aBG0kujRFDwNLhZJAu0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RWm0ku+P+5TqYZRZ8YPWN4WDRLLWl2Ybf4TSaSxmoFQ0+IHHtLx1KtVarb67FlTf9 8EZCSCIiGAsX1imB5MoZ4XxIyKFUzIIG/Gk5rcDw1V2dkyDe4DnQ/bHXP6s/4iTqWS 9D5SrjGsWHPgfpbb3JO5JUMvQLaPZZsxjM/RmcgqSI/ovgomcgHLeGC7F8E9gVo6k0 sjBbkLZ8o10Nuz9apY+Bh0L9ML/ccTbTdqQ83x7BpUhjb3KMydX5l18prkHI0iNd+J iPfVDIr4C5wJboiMh/Wl4cXuWaKXEXQ2xkuESKME8sBdI0YCS7XRwuA9hv2CYbmDtQ FfqX7MC2M8WeQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v7 13/21] NFSv4: Ask for a full XDR buffer of readdir goodness Date: Wed, 23 Feb 2022 16:12:57 -0500 Message-Id: <20220223211305.296816-14-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220223211305.296816-13-trondmy@kernel.org> References: <20220223211305.296816-1-trondmy@kernel.org> <20220223211305.296816-2-trondmy@kernel.org> <20220223211305.296816-3-trondmy@kernel.org> <20220223211305.296816-4-trondmy@kernel.org> <20220223211305.296816-5-trondmy@kernel.org> <20220223211305.296816-6-trondmy@kernel.org> <20220223211305.296816-7-trondmy@kernel.org> <20220223211305.296816-8-trondmy@kernel.org> <20220223211305.296816-9-trondmy@kernel.org> <20220223211305.296816-10-trondmy@kernel.org> <20220223211305.296816-11-trondmy@kernel.org> <20220223211305.296816-12-trondmy@kernel.org> <20220223211305.296816-13-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Trond Myklebust Instead of pretending that we know the ratio of directory info vs readdirplus attribute info, just set the 'dircount' field to the same value as the 'maxcount' field. Signed-off-by: Trond Myklebust --- fs/nfs/nfs3xdr.c | 7 ++++--- fs/nfs/nfs4xdr.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 54a1d21cbcc6..296320f91579 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c @@ -1261,6 +1261,8 @@ static void nfs3_xdr_enc_readdir3args(struct rpc_rqst *req, static void encode_readdirplus3args(struct xdr_stream *xdr, const struct nfs3_readdirargs *args) { + uint32_t dircount = args->count; + uint32_t maxcount = args->count; __be32 *p; encode_nfs_fh3(xdr, args->fh); @@ -1273,9 +1275,8 @@ static void encode_readdirplus3args(struct xdr_stream *xdr, * readdirplus: need dircount + buffer size. * We just make sure we make dircount big enough */ - *p++ = cpu_to_be32(args->count >> 3); - - *p = cpu_to_be32(args->count); + *p++ = cpu_to_be32(dircount); + *p = cpu_to_be32(maxcount); } static void nfs3_xdr_enc_readdirplus3args(struct rpc_rqst *req, diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 8e70b92df4cc..b7780b97dc4d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -1605,7 +1605,8 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg FATTR4_WORD0_RDATTR_ERROR, FATTR4_WORD1_MOUNTED_ON_FILEID, }; - uint32_t dircount = readdir->count >> 1; + uint32_t dircount = readdir->count; + uint32_t maxcount = readdir->count; __be32 *p, verf[2]; uint32_t attrlen = 0; unsigned int i; @@ -1618,7 +1619,6 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS| FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; attrs[2] |= FATTR4_WORD2_SECURITY_LABEL; - dircount >>= 1; } /* Use mounted_on_fileid only if the server supports it */ if (!(readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) @@ -1634,7 +1634,7 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg encode_nfs4_verifier(xdr, &readdir->verifier); p = reserve_space(xdr, 12 + (attrlen << 2)); *p++ = cpu_to_be32(dircount); - *p++ = cpu_to_be32(readdir->count); + *p++ = cpu_to_be32(maxcount); *p++ = cpu_to_be32(attrlen); for (i = 0; i < attrlen; i++) *p++ = cpu_to_be32(attrs[i]); -- 2.35.1