diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2022-07-27 21:41:12 +0300 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2022-07-30 03:16:59 +0300 |
commit | e72f9bc006c08841c46d27747a4debc747a8fe13 (patch) | |
tree | 4dd90cb21e7bba39ac5f4b65a5f44fffa713fda1 /fs/nfsd/nfs4proc.c | |
parent | ad1e46c9b07b13659635ee5405f83ad0df143116 (diff) | |
download | linux-e72f9bc006c08841c46d27747a4debc747a8fe13.tar.xz |
NFSD: Add nfsd4_send_cb_offload()
Refactor for legibility.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index cbdbe1e9de89..baea3d39d5ce 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1763,6 +1763,27 @@ static void cleanup_async_copy(struct nfsd4_copy *copy) nfs4_put_copy(copy); } +static void nfsd4_send_cb_offload(struct nfsd4_copy *copy) +{ + struct nfsd4_copy *cb_copy; + + cb_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL); + if (!cb_copy) + return; + + refcount_set(&cb_copy->refcount, 1); + memcpy(&cb_copy->cp_res, ©->cp_res, sizeof(copy->cp_res)); + cb_copy->cp_clp = copy->cp_clp; + cb_copy->nfserr = copy->nfserr; + memcpy(&cb_copy->fh, ©->fh, sizeof(copy->fh)); + + nfsd4_init_cb(&cb_copy->cp_cb, cb_copy->cp_clp, + &nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD); + trace_nfsd_cb_offload(copy->cp_clp, ©->cp_res.cb_stateid, + ©->fh, copy->cp_count, copy->nfserr); + nfsd4_run_cb(&cb_copy->cp_cb); +} + /** * nfsd4_do_async_copy - kthread function for background server-side COPY * @data: arguments for COPY operation @@ -1773,7 +1794,6 @@ static void cleanup_async_copy(struct nfsd4_copy *copy) static int nfsd4_do_async_copy(void *data) { struct nfsd4_copy *copy = (struct nfsd4_copy *)data; - struct nfsd4_copy *cb_copy; if (nfsd4_ssc_is_inter(copy)) { struct file *filp; @@ -1795,20 +1815,7 @@ static int nfsd4_do_async_copy(void *data) } do_callback: - cb_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL); - if (!cb_copy) - goto out; - refcount_set(&cb_copy->refcount, 1); - memcpy(&cb_copy->cp_res, ©->cp_res, sizeof(copy->cp_res)); - cb_copy->cp_clp = copy->cp_clp; - cb_copy->nfserr = copy->nfserr; - memcpy(&cb_copy->fh, ©->fh, sizeof(copy->fh)); - nfsd4_init_cb(&cb_copy->cp_cb, cb_copy->cp_clp, - &nfsd4_cb_offload_ops, NFSPROC4_CLNT_CB_OFFLOAD); - trace_nfsd_cb_offload(copy->cp_clp, ©->cp_res.cb_stateid, - ©->fh, copy->cp_count, copy->nfserr); - nfsd4_run_cb(&cb_copy->cp_cb); -out: + nfsd4_send_cb_offload(copy); cleanup_async_copy(copy); return 0; } |