Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4393439pxb; Mon, 21 Feb 2022 20:07:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlMirBzC7tX4E5a7uerZAblejrzNx9n3Ews6cHS184IesiIFzjq4AjNOANFjcWLejJOMeH X-Received: by 2002:a63:4c0d:0:b0:373:9b10:886e with SMTP id z13-20020a634c0d000000b003739b10886emr18301596pga.307.1645502857311; Mon, 21 Feb 2022 20:07:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645502857; cv=none; d=google.com; s=arc-20160816; b=D7Fs87n/7Djn0cSEUhqiUAMSWdpcc8NhqBjRjnyOS+dyqbtkZsSub68p3Ke+zhGeep IqhTWzacHeaTy8txFPNO3gI+QDvMP0Jsz+C20SiE/cAIXZjloI4xT9Brbgc30l2eLgZg wfBSsmH6le/kOm9M/n476JKtViyx5F5qiaK4vZNa6jZ8lSd5XaD4tY9dpsFehnLLuS90 XLRVTYkk/hK3pyeReh0cEXZPIgv8xoiEPN1+V2SYvpvFbv1Q9Rv3GS1v9I4P0EvZQvYO C9MqcxUUjvLP1XCa1dtiFTC08qm3izineuyzTqJglkO+HJUKtg0r+BBGnQ9Al87kDSSZ 1kZQ== 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=+EQAu6/JZZI4LlgaIWtI3TqryfLPflDV7aWi8ajn/D4=; b=OM4RC6hl9on27c1ZHO/gM03XK94MTKB61z1xUJryg+1C9cKkFt99W7zYnw5vZpgRi/ axIvdD92bbtsiUvMqwQNlzK73lkRnfTw0M2R4ZZpBHGAsDfyzTrXpm8xBTnDjxKgrOU5 TeGXyiCJQQRJLQbXbq/QUxCc+QqLaU+ZxMQFFpRqvZLE5Mp5LSRIwwDCQgufxGnCGZGl LbLWJ0uGjPg2ja4yrOMDjO3ZtTxYEUzwlqm6JSND1mC1O+psLZ7aljDjqHVwAph5hRZ4 +R+btnpiXJocIz2HnLrFpWlbFuakgZjy4Q6htABZGhOp/PXCFvq2lT8SfVVVl+B8iUd/ ad1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GsSIQ35O; 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 c18si35794275plh.208.2022.02.21.20.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:07:37 -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=GsSIQ35O; 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 C81376CA40; Mon, 21 Feb 2022 20:07:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379992AbiBUQPd (ORCPT + 99 others); Mon, 21 Feb 2022 11:15:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379993AbiBUQP2 (ORCPT ); Mon, 21 Feb 2022 11:15:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30167275E4 for ; Mon, 21 Feb 2022 08:15:05 -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 ams.source.kernel.org (Postfix) with ESMTPS id DEF1AB811B3 for ; Mon, 21 Feb 2022 16:15:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED4AC340EC for ; Mon, 21 Feb 2022 16:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645460102; bh=tK4kLGD9Ao8B+ZWXFvklTqxQZ7QmUcoqdW968PZIu7w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GsSIQ35OdFwVzCKWOwpnDcKyzuJI/uwDw1LLZ8NY7bfFIxECSaEM7a4AnzdCdjDnv VRjqTgbEA84JWq71mLEfZE+9f23Zv4YsorMLXmgnavVNhLLG3N4m0AFXUgkOmh74VX +VIU2srVQDFSgtReTxZP/vdrUmG1Yz+NLvyLsIzwpAJ+air/oG48XHUDVah4qp+sge OH6SGn2cOJYke9r3GFvyYz2c7DWWPi+EhH1XSYxGCcdJMjAY7cr6Ienps3jtVBiFRM eUXbxOMywLvZ3/STQkW++Js/DHCtrOAW5A9rBhFiGti4UEjaqeWJixgRjZcklLiuAu ppmqeVcjUFz3g== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v6 08/13] NFSv4: Ask for a full XDR buffer of readdir goodness Date: Mon, 21 Feb 2022 11:08:46 -0500 Message-Id: <20220221160851.15508-9-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221160851.15508-8-trondmy@kernel.org> References: <20220221160851.15508-1-trondmy@kernel.org> <20220221160851.15508-2-trondmy@kernel.org> <20220221160851.15508-3-trondmy@kernel.org> <20220221160851.15508-4-trondmy@kernel.org> <20220221160851.15508-5-trondmy@kernel.org> <20220221160851.15508-6-trondmy@kernel.org> <20220221160851.15508-7-trondmy@kernel.org> <20220221160851.15508-8-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 9274c9c5efea..feb6e2e36138 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