Skip to content

Commit 3b7bf59

Browse files
committed
NFSD: Refactor nfsd4_do_copy()
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 <[email protected]>
1 parent 478ed7b commit 3b7bf59

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,10 +1670,10 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)
16701670
gen_boot_verifier(&copy->cp_res.wr_verifier, copy->cp_clp->net);
16711671
}
16721672

1673-
static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
1673+
static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
1674+
struct file *dst,
1675+
struct file *src)
16741676
{
1675-
struct file *dst = copy->nf_dst->nf_file;
1676-
struct file *src = copy->nf_src->nf_file;
16771677
errseq_t since;
16781678
ssize_t bytes_copied = 0;
16791679
u64 bytes_total = copy->cp_count;
@@ -1709,12 +1709,15 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
17091709
return bytes_copied;
17101710
}
17111711

1712-
static __be32 nfsd4_do_copy(struct nfsd4_copy *copy, bool sync)
1712+
static __be32 nfsd4_do_copy(struct nfsd4_copy *copy,
1713+
struct file *src, struct file *dst,
1714+
bool sync)
17131715
{
17141716
__be32 status;
17151717
ssize_t bytes;
17161718

1717-
bytes = _nfsd_copy_file_range(copy);
1719+
bytes = _nfsd_copy_file_range(copy, dst, src);
1720+
17181721
/* for async copy, we ignore the error, client can always retry
17191722
* to get the error
17201723
*/
@@ -1779,11 +1782,13 @@ static int nfsd4_do_async_copy(void *data)
17791782
nfsd4_interssc_disconnect(copy->ss_mnt);
17801783
goto do_callback;
17811784
}
1782-
copy->nfserr = nfsd4_do_copy(copy, 0);
1785+
copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file,
1786+
copy->nf_dst->nf_file, false);
17831787
nfsd4_cleanup_inter_ssc(copy->ss_mnt, copy->nf_src->nf_file,
17841788
copy->nf_dst);
17851789
} else {
1786-
copy->nfserr = nfsd4_do_copy(copy, 0);
1790+
copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file,
1791+
copy->nf_dst->nf_file, false);
17871792
nfsd4_cleanup_intra_ssc(copy->nf_src, copy->nf_dst);
17881793
}
17891794

@@ -1861,7 +1866,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
18611866
wake_up_process(async_copy->copy_task);
18621867
status = nfs_ok;
18631868
} else {
1864-
status = nfsd4_do_copy(copy, 1);
1869+
status = nfsd4_do_copy(copy, copy->nf_src->nf_file,
1870+
copy->nf_dst->nf_file, true);
18651871
nfsd4_cleanup_intra_ssc(copy->nf_src, copy->nf_dst);
18661872
}
18671873
out:

0 commit comments

Comments
 (0)