Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp139003rdb; Mon, 18 Sep 2023 10:17:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsjKIGkwvnJA7PCCTQdVOs0GfEHthEoDw3fLXFWeGfKBVXof4IK4SsShmkxRW+PdzpvSd5 X-Received: by 2002:a17:902:d386:b0:1c3:9b9b:8db0 with SMTP id e6-20020a170902d38600b001c39b9b8db0mr9509405pld.33.1695057470642; Mon, 18 Sep 2023 10:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695057470; cv=none; d=google.com; s=arc-20160816; b=SXA25XNBlGQiChkvPv3BCIO8XKuDlvFuk9CpGtzP0sDAJO6yU0iDMx17PfhZ1vxJZ2 k1tTfcL0Rz+EmkKqf69Kjbr9L8RYM2ZYXoP4G8Ae6ezATcD5ECgogCR5ap1OBq2o7du+ orD2auQe6uFG4vKGsJU/Wldf2BQvb58jjXhzhBTUqJcqqIeO2PDfb1tigftVouwk8yv3 oFi/fgDOx2yBs5V1wJRMV/SnAGgdMKFrnCZtmHm6y/y+OTbWC3iS4P7AwqKAGwEvptoI nte26GVwFvWagenUxhu3ZgSm5Wixg3iqFGZCb/O1rdLWcMmwim9WkEnWYLvTFi0q+bNc MdjQ== 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:cc:to:from :subject:dkim-signature; bh=JOEcuONjRuGh8/u5zBT2BSn+xjTzhJEWhu0TwBI5Yqo=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=oJ7veQ14gbVZVR6IfphJvNckzYJqDeht11BIOwlsgNElnFRpYp9e/Viq+aLxYdQUUv 3Fm1Sc9P7tJxdUVaqSWqKpV1Q99jP93jLtzF1hKPxhibe5EsY5ZIsKCB9VIzchpnkoQ5 qbgFZrwQxLMYGr0DLvhK4XRf35VhNlLc3hWyAG9YhK1g57FJS8vHSAvtQEbBDsSdsUpb NpAsEBxkSdM9nvBltZygAw/+7i/24VxBWg+iDiWX7hIiw8XzEUyc2E62rxiAlz8NWTHB l3ps2KeK3Q41RIxIY07mfRanDhRarecimSXZR4rv9o3Gsy30YcnqTcB2B7EJT/lPSDsj AKUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EV0fF/v3"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h8-20020a170902f54800b001c362510a4esi8717254plf.613.2023.09.18.10.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:17:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EV0fF/v3"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3F95E826EBA3; Mon, 18 Sep 2023 09:37:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjIRQhR (ORCPT + 99 others); Mon, 18 Sep 2023 12:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjIRQhG (ORCPT ); Mon, 18 Sep 2023 12:37:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3157171C for ; Mon, 18 Sep 2023 09:32:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 221B8C4166B; Mon, 18 Sep 2023 13:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695045479; bh=KHpYt6z3tDgpzHy2k6y8Y5rZ4ZCZLSs4BRcrSAwGlkc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EV0fF/v3jF+1DbB3Vs3UR40t/KIVW1IUytGrebEaBjjunleXLM8MbsbSoYXEl5Jug /P/3M0Y2IyGBKXTPKtiiTfDRlX9qeri2gRq4GkD+SVRPBhsITNCPOcD69G2tdfBZue BxE0LfBSTPaUUKAY+DWOpbWvVMACXXrbdtYiisGC+WJeQv4DFyG8p+xPQ3kuaL8Lzd +jcuCKgKToF4k+ssvu3jPzNVC1FvWJp6Qs+Uryxx8vitNBL917oh2UA3Jjrh2Y39cH nQRjbov0maclfk31O8L1IHOd3r8wXltOMkcJaXHW6AzXODMUV4Rau6gk2i9+dfOZXz aKy8/FQF2YMqQ== Subject: [PATCH v1 11/52] NFSD: Add nfsd4_encode_fattr4_size() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 18 Sep 2023 09:57:58 -0400 Message-ID: <169504547814.133720.4907073026998034966.stgit@manet.1015granger.net> In-Reply-To: <169504501081.133720.4162400017732492854.stgit@manet.1015granger.net> References: <169504501081.133720.4162400017732492854.stgit@manet.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 09:37:19 -0700 (PDT) From: Chuck Lever Refactor the encoder for FATTR4_SIZE into a helper. In a subsequent patch, this helper will be called from a bitmask loop. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 3149cfcdac35..601b3a0e61d4 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3024,6 +3024,12 @@ static __be32 nfsd4_encode_fattr4_change(struct xdr_stream *xdr, return nfsd4_encode_changeid4(xdr, c); } +static __be32 nfsd4_encode_fattr4_size(struct xdr_stream *xdr, + const struct nfsd4_fattr_args *args) +{ + return nfsd4_encode_uint64_t(xdr, args->stat.size); +} + /* * Note: @fhp can be NULL; in this case, we might have to compose the filehandle * ourselves. @@ -3169,10 +3175,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, goto out; } if (bmval0 & FATTR4_WORD0_SIZE) { - p = xdr_reserve_space(xdr, 8); - if (!p) - goto out_resource; - p = xdr_encode_hyper(p, args.stat.size); + status = nfsd4_encode_fattr4_size(xdr, &args); + if (status != nfs_ok) + goto out; } if (bmval0 & FATTR4_WORD0_LINK_SUPPORT) { status = nfsd4_encode_fattr4__true(xdr, &args);