Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp508932imn; Wed, 27 Jul 2022 12:09:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1up+g626rnDIrgQp4idRVlX3hi3Rk0kJZ/3dJ/IkkBBvE/bJvAwxNRSeJedyeFjiOIgfxqC X-Received: by 2002:a17:907:6285:b0:72f:a3b9:9666 with SMTP id nd5-20020a170907628500b0072fa3b99666mr18212798ejc.455.1658948964490; Wed, 27 Jul 2022 12:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658948964; cv=none; d=google.com; s=arc-20160816; b=oc9D+/BwLyqXiIriLglqhADVpsWmAZu6WLiy2sDi57gUgo1ZerWUf0jdL3sP0qfkOZ NX7pLvwxqwiCqHPkiesQo6VHClya3nTWVxaQ+OJika+m5JW4+7IKqAN9cpvKtKmwQGZD HEVOUkJrLpbVQncYimx6f5n3nTsPpBJp+z7KzcxMUqGazDKf6er/5dKVlR3elJuTEKbE ba7WxpM76He0GoMVQ4elKsf0KG4hhjrJhE16mWXxXGcVJNBT5PrXlYbDpzTRAulVOrL3 hDozh6h9ifUeXT63kzUFrveI8aZBNbagjpQEoir9W08voKPCSy6qqPOVQImxmk4qnmVm Zzaw== 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=aio23iahu8ln391oZwsgKFHWZQUFvculKMApjE4gfVI=; b=c3w0lEPwUYCeMt+30yevqp8NLH+jftCPUIcfUxp/KPFeXJc4Gapx4RdHR5XsT1P/qp ydWiJKizfBDTF4+7mlKvUQLQ6cxL7L3lp/asxd6n8mrbxgSFS94jwOXlzcWir+KzudXS NsrsmLbfHALBiGix/CozHTPRUPegqpN6xdkPAciwU3Dhq3GD1Nl3I2GqbeCRl1iyyFAF jiwo9ukcp0mgKJIvNp77WgVWs2C5yf7csks+3n+RDhaU2K/N7WtiV4Fe3dGX28ZjlDVO MiWMDAiWP92iMvfU5hzuVl+k6UfyBcaLxAYRKQuikdcE+apcI5FkdUBzQCaMH5/TZhtb /9EA== 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 27-20020a17090601db00b0072b7fa15683si18513858ejj.312.2022.07.27.12.08.58; Wed, 27 Jul 2022 12:09:24 -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 S235452AbiG0THk (ORCPT + 99 others); Wed, 27 Jul 2022 15:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235484AbiG0THQ (ORCPT ); Wed, 27 Jul 2022 15:07:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 014DAD7 for ; Wed, 27 Jul 2022 11:41:02 -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 92E61619D7 for ; Wed, 27 Jul 2022 18:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB04CC433D6 for ; Wed, 27 Jul 2022 18:41:00 +0000 (UTC) Subject: [PATCH v2 10/13] NFSD: Refactor nfsd4_do_copy() From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Wed, 27 Jul 2022 14:40:59 -0400 Message-ID: <165894725996.11193.11982832325337542326.stgit@manet.1015granger.net> In-Reply-To: <165894669884.11193.6386905165076468843.stgit@manet.1015granger.net> References: <165894669884.11193.6386905165076468843.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 Refactor: Now that nfsd4_do_copy() no longer calls the cleanup helpers, plumb the use of struct file pointers all the way down to _nfsd_copy_file_range(). Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index bb0f8d094530..d00d517f8c7d 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1670,10 +1670,10 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync) gen_boot_verifier(©->cp_res.wr_verifier, copy->cp_clp->net); } -static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy) +static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy, + struct file *dst, + struct file *src) { - struct file *dst = copy->nf_dst->nf_file; - struct file *src = copy->nf_src->nf_file; errseq_t since; ssize_t bytes_copied = 0; u64 bytes_total = copy->cp_count; @@ -1709,12 +1709,15 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy) return bytes_copied; } -static __be32 nfsd4_do_copy(struct nfsd4_copy *copy, bool sync) +static __be32 nfsd4_do_copy(struct nfsd4_copy *copy, + struct file *src, struct file *dst, + bool sync) { __be32 status; ssize_t bytes; - bytes = _nfsd_copy_file_range(copy); + bytes = _nfsd_copy_file_range(copy, dst, src); + /* for async copy, we ignore the error, client can always retry * to get the error */ @@ -1779,11 +1782,13 @@ static int nfsd4_do_async_copy(void *data) nfsd4_interssc_disconnect(copy->ss_mnt); goto do_callback; } - copy->nfserr = nfsd4_do_copy(copy, 0); + copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file, + copy->nf_dst->nf_file, false); nfsd4_cleanup_inter_ssc(copy->ss_mnt, copy->nf_src->nf_file, copy->nf_dst); } else { - copy->nfserr = nfsd4_do_copy(copy, 0); + copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file, + copy->nf_dst->nf_file, false); nfsd4_cleanup_intra_ssc(copy->nf_src, copy->nf_dst); } @@ -1861,7 +1866,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, wake_up_process(async_copy->copy_task); status = nfs_ok; } else { - status = nfsd4_do_copy(copy, 1); + status = nfsd4_do_copy(copy, copy->nf_src->nf_file, + copy->nf_dst->nf_file, true); nfsd4_cleanup_intra_ssc(copy->nf_src, copy->nf_dst); } out: