@@ -1390,6 +1390,7 @@ static int _nfsd_copy_file_range(struct nfsd4_copy *copy)
dst_pos += bytes_copied;
spin_lock(©->cps->cp_lock);
cancelled = copy->cps->cp_cancelled;
+ copy->cps->cp_bytes_copied = copy->cp_res.wr_bytes_written;
spin_unlock(©->cps->cp_lock);
} while (bytes_total > 0 && !cancelled);
return bytes_copied;
@@ -1630,7 +1631,18 @@ static void nfsd4_do_async_copy(struct work_struct *work)
struct nfsd4_compound_state *cstate,
struct nfsd4_offload_status *os)
{
- return nfserr_notsupp;
+ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
+ __be32 status;
+ struct nfs4_cp_state *state = NULL;
+
+ status = find_cp_state(nn, &os->stateid, &state);
+
+ if (state) {
+ spin_lock(&state->cp_lock);
+ os->count = state->cp_bytes_copied;
+ spin_unlock(&state->cp_lock);
+ }
+ return status;
}
static __be32
@@ -117,6 +117,7 @@ struct nfs4_cp_state {
bool cp_dst_async; /* async copy on dst server */
bool cp_cancelled; /* copy cancelled */
spinlock_t cp_lock;
+ ssize_t cp_bytes_copied;/* copy progress */
};
/*
Update number of bytes copied in the copy state and query that value under lock if OFFLOAD_STATUS operation received. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> --- fs/nfsd/nfs4proc.c | 14 +++++++++++++- fs/nfsd/state.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)