All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v2 10/13] NFSD: Refactor nfsd4_do_copy()
Date: Wed, 27 Jul 2022 14:40:59 -0400	[thread overview]
Message-ID: <165894725996.11193.11982832325337542326.stgit@manet.1015granger.net> (raw)
In-Reply-To: <165894669884.11193.6386905165076468843.stgit@manet.1015granger.net>

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 <chuck.lever@oracle.com>
---
 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(&copy->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:



  parent reply	other threads:[~2022-07-27 19:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 18:39 [PATCH v2 00/13] Put struct nfsd4_copy on a diet Chuck Lever
2022-07-27 18:40 ` [PATCH v2 01/13] NFSD: Fix strncpy() fortify warning Chuck Lever
2022-07-27 18:40 ` [PATCH v2 02/13] NFSD: nfserrno(-ENOMEM) is nfserr_jukebox Chuck Lever
2022-07-27 18:40 ` [PATCH v2 03/13] NFSD: Shrink size of struct nfsd4_copy_notify Chuck Lever
2022-07-27 18:40 ` [PATCH v2 04/13] NFSD: Shrink size of struct nfsd4_copy Chuck Lever
2022-07-27 18:40 ` [PATCH v2 05/13] NFSD: Reorder the fields in struct nfsd4_op Chuck Lever
2022-07-27 18:40 ` [PATCH v2 06/13] NFSD: Make nfs4_put_copy() static Chuck Lever
2022-07-27 18:40 ` [PATCH v2 07/13] NFSD: Make boolean fields in struct nfsd4_copy into atomic bit flags Chuck Lever
2022-07-27 18:40 ` [PATCH v2 08/13] NFSD: Refactor nfsd4_cleanup_inter_ssc() (1/2) Chuck Lever
2022-07-27 18:40 ` [PATCH v2 09/13] NFSD: Refactor nfsd4_cleanup_inter_ssc() (2/2) Chuck Lever
2022-07-27 18:40 ` Chuck Lever [this message]
2022-07-27 18:41 ` [PATCH v2 11/13] NFSD: Remove kmalloc from nfsd4_do_async_copy() Chuck Lever
2022-07-27 18:41 ` [PATCH v2 12/13] NFSD: Add nfsd4_send_cb_offload() Chuck Lever
2022-07-27 18:41 ` [PATCH v2 13/13] NFSD: Move copy offload callback arguments into a separate structure Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165894725996.11193.11982832325337542326.stgit@manet.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.