Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp944380pxp; Wed, 16 Mar 2022 22:10:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhQn/s8Ydba25aDPNS8VePY7yVkqTycqWnkeAUAJprMOvJVSt/aByBKlDhWJ0qAvZMGFJR X-Received: by 2002:a05:6a00:140f:b0:4e0:6995:9c48 with SMTP id l15-20020a056a00140f00b004e069959c48mr3184036pfu.59.1647493815082; Wed, 16 Mar 2022 22:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647493815; cv=none; d=google.com; s=arc-20160816; b=y2MlAVyJ6xJfPwHIsXcM+ivo/PgMk9lygkRVWSof5CXylM1lCvaP/VtNt3mqO3R2+3 gR0WVmkZATHs9ZUNF/yJ0VyDFyP2Frbuu6bOE0YINGWoBAkm5j3xOE/WwPsIIueQHgyW ZwE15qZNbpukueSOMvhDOmEp17UelMbwmqoYHOGlp+zJPApiSAmVDUDJV5VOshFzp/vw 7+7DIs1Tyy+//yg/MaCawA6Ms/xD2UygZvG8fFi1ip83qZ3UnRSbtrYiKvPW7PddDBxn pnK4Acw3IJr6blJLqzpc44UmfGx/TSdolXeTFSAxyV6PeH0RvBsyTYJpvbQ0vVoTXHZt /wRg== 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=+ze39oURpRBZxNIBItl+oEdaxJKHLPIRArFnpLFwzgw=; b=c3jR3IqEG6T7qIYDgNp7yaG5zqIijMdX4BsbIW+aFox7DTAxHPemQlzr2jylwnm93a qdc4VHcWIDWMl3uoufzesqUu6c7rvoeuPb82+i6wZHDh9ZhVC32YOYsnzrWXiFLScfrg 9ds8+nX9hwU51LSjmWgEQOxTDPJY8aXrJkpWCa9AzihLq7Aph31rP0kBpDPLgsMLqUdQ n4/Axwnnfo+vT8EoKyuCQtZDmpAog/+tsHMMxHXGjZNKUpkSHPIE8rXY4KXLkR+N9K3G 8HgH1z+BH+OFH31zgdwgztXYlAPDYsGXRtnPU2PCYo/aUPypCW3fxX1iBQFjqTeRKUWk 9YAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tkZfC8wv; 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 v9-20020a170902e8c900b00151eb7e66e6si4053797plg.338.2022.03.16.22.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:10:15 -0700 (PDT) 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=tkZfC8wv; 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 09CA11C7EB4; Wed, 16 Mar 2022 21:20:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235113AbiCMRNW (ORCPT + 99 others); Sun, 13 Mar 2022 13:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235096AbiCMRNT (ORCPT ); Sun, 13 Mar 2022 13:13:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D67D13A1C5 for ; Sun, 13 Mar 2022 10:12:11 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B967760FDD for ; Sun, 13 Mar 2022 17:12:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F155BC340E8 for ; Sun, 13 Mar 2022 17:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647191530; bh=Pi6QQmcZUZFhmZaJYFwgo7fNTcZupt9kMXmORg1j7EY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tkZfC8wvQ6z6m0IjxyizBM8VEEwKY9jZRbxVh0k7wqWbCGHMjoq9Y2Z1rm+umdrhj 46K2dDgP+t1otq884Zy9pfPcp4MwoQCUAonFkIJMD4ZUT0A4GtMMcx49oPySBwQTpE D631Fklv4VPFUeLoCBD1gPs2NBB/vYcTCdWp0nPXzhYl6/pq6I0rPYYWKfoUYEIBWc ABmVUEqjE83R4NedTt1fW3kqqQ7ckqu/BkfgaprLjftDUEQmyWe5jnGbXCr47K5bZU x1V+jIs/EWNGhsbV+aCXvYMG27WovUpDj1PwKbju6NpQsEu+3H/QmsuwY9moFeNMHW WQZpV3huD3Nag== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v10 16/26] NFSv4: Ask for a full XDR buffer of readdir goodness Date: Sun, 13 Mar 2022 13:05:47 -0400 Message-Id: <20220313170557.5940-17-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220313170557.5940-16-trondmy@kernel.org> References: <20220313170557.5940-1-trondmy@kernel.org> <20220313170557.5940-2-trondmy@kernel.org> <20220313170557.5940-3-trondmy@kernel.org> <20220313170557.5940-4-trondmy@kernel.org> <20220313170557.5940-5-trondmy@kernel.org> <20220313170557.5940-6-trondmy@kernel.org> <20220313170557.5940-7-trondmy@kernel.org> <20220313170557.5940-8-trondmy@kernel.org> <20220313170557.5940-9-trondmy@kernel.org> <20220313170557.5940-10-trondmy@kernel.org> <20220313170557.5940-11-trondmy@kernel.org> <20220313170557.5940-12-trondmy@kernel.org> <20220313170557.5940-13-trondmy@kernel.org> <20220313170557.5940-14-trondmy@kernel.org> <20220313170557.5940-15-trondmy@kernel.org> <20220313170557.5940-16-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 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 7ab60ad98776..d6779ceeb39e 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