Lines Matching refs:copy
58 "Enable inter server to server copy offload. Default: false");
408 * field isn't set for some reason, throw warning and just copy
966 * If we do a zero copy read, then a client will see read data
970 * To ensure proper ordering, we therefore turn off zero copy if
1281 static void nfs4_put_copy(struct nfsd4_copy *copy)
1283 if (!refcount_dec_and_test(©->refcount))
1285 kfree(copy->cp_src);
1286 kfree(copy);
1289 static void nfsd4_stop_copy(struct nfsd4_copy *copy)
1291 if (!test_and_set_bit(NFSD4_COPY_F_STOPPED, ©->cp_flags))
1292 kthread_stop(copy->copy_task);
1293 nfs4_put_copy(copy);
1298 struct nfsd4_copy *copy = NULL;
1302 copy = list_first_entry(&clp->async_copies, struct nfsd4_copy,
1304 refcount_inc(©->refcount);
1307 return copy;
1312 struct nfsd4_copy *copy;
1314 while ((copy = nfsd4_get_copy(clp)) != NULL)
1315 nfsd4_stop_copy(copy);
1405 * Support one copy source server for now.
1510 struct nfsd4_copy *copy)
1513 stateid_t *s_stid = ©->cp_src_stateid;
1518 ©->cp_dst_stateid,
1519 WR_STATE, ©->nf_dst, NULL);
1523 status = nfsd4_interssc_connect(copy->cp_src, rqstp, ©->ss_nsui);
1529 copy->c_fh.size = s_fh->fh_handle.fh_size;
1530 memcpy(copy->c_fh.data, &s_fh->fh_handle.fh_raw, copy->c_fh.size);
1531 copy->stateid.seqid = cpu_to_be32(s_stid->si_generation);
1532 memcpy(copy->stateid.other, (void *)&s_stid->si_opaque,
1568 struct nfsd4_copy *copy)
1590 struct nfsd4_copy *copy)
1592 return nfsd4_verify_copy(rqstp, cstate, ©->cp_src_stateid,
1593 ©->nf_src, ©->cp_dst_stateid,
1594 ©->nf_dst);
1620 static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)
1622 copy->cp_res.wr_stable_how =
1623 test_bit(NFSD4_COPY_F_COMMITTED, ©->cp_flags) ?
1625 nfsd4_copy_set_sync(copy, sync);
1626 gen_boot_verifier(©->cp_res.wr_verifier, copy->cp_clp->net);
1629 static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
1635 u64 bytes_total = copy->cp_count;
1636 u64 src_pos = copy->cp_src_pos;
1637 u64 dst_pos = copy->cp_dst_pos;
1652 copy->cp_res.wr_bytes_written += bytes_copied;
1655 } while (bytes_total > 0 && nfsd4_copy_is_async(copy));
1656 /* for a non-zero asynchronous copy do a commit of data */
1657 if (nfsd4_copy_is_async(copy) && copy->cp_res.wr_bytes_written > 0) {
1659 end = copy->cp_dst_pos + copy->cp_res.wr_bytes_written - 1;
1660 status = vfs_fsync_range(dst, copy->cp_dst_pos, end, 0);
1664 set_bit(NFSD4_COPY_F_COMMITTED, ©->cp_flags);
1669 static __be32 nfsd4_do_copy(struct nfsd4_copy *copy,
1676 bytes = _nfsd_copy_file_range(copy, dst, src);
1678 /* for async copy, we ignore the error, client can always retry
1681 if (bytes < 0 && !copy->cp_res.wr_bytes_written)
1684 nfsd4_init_copy_res(copy, sync);
1711 static void release_copy_files(struct nfsd4_copy *copy)
1713 if (copy->nf_src)
1714 nfsd_file_put(copy->nf_src);
1715 if (copy->nf_dst)
1716 nfsd_file_put(copy->nf_dst);
1719 static void cleanup_async_copy(struct nfsd4_copy *copy)
1721 nfs4_free_copy_state(copy);
1722 release_copy_files(copy);
1723 if (copy->cp_clp) {
1724 spin_lock(©->cp_clp->async_lock);
1725 if (!list_empty(©->copies))
1726 list_del_init(©->copies);
1727 spin_unlock(©->cp_clp->async_lock);
1729 nfs4_put_copy(copy);
1732 static void nfsd4_send_cb_offload(struct nfsd4_copy *copy, __be32 nfserr)
1740 memcpy(&cbo->co_res, ©->cp_res, sizeof(copy->cp_res));
1741 memcpy(&cbo->co_fh, ©->fh, sizeof(copy->fh));
1744 nfsd4_init_cb(&cbo->co_cb, copy->cp_clp, &nfsd4_cb_offload_ops,
1746 trace_nfsd_cb_offload(copy->cp_clp, &cbo->co_res.cb_stateid,
1747 &cbo->co_fh, copy->cp_count, nfserr);
1760 struct nfsd4_copy *copy = (struct nfsd4_copy *)data;
1763 if (nfsd4_ssc_is_inter(copy)) {
1766 filp = nfs42_ssc_open(copy->ss_nsui->nsui_vfsmount,
1767 ©->c_fh, ©->stateid);
1779 nfserr = nfsd4_do_copy(copy, filp, copy->nf_dst->nf_file,
1781 nfsd4_cleanup_inter_ssc(copy->ss_nsui, filp, copy->nf_dst);
1783 nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file,
1784 copy->nf_dst->nf_file, false);
1788 nfsd4_send_cb_offload(copy, nfserr);
1789 cleanup_async_copy(copy);
1797 struct nfsd4_copy *copy = &u->copy;
1801 if (nfsd4_ssc_is_inter(copy)) {
1802 if (!inter_copy_offload_enable || nfsd4_copy_is_sync(copy)) {
1806 status = nfsd4_setup_inter_ssc(rqstp, cstate, copy);
1810 status = nfsd4_setup_intra_ssc(rqstp, cstate, copy);
1815 copy->cp_clp = cstate->clp;
1816 memcpy(©->fh, &cstate->current_fh.fh_handle,
1818 if (nfsd4_copy_is_async(copy)) {
1830 if (!nfs4_init_copy_state(nn, copy))
1832 memcpy(©->cp_res.cb_stateid, ©->cp_stateid.cs_stid,
1833 sizeof(copy->cp_res.cb_stateid));
1834 dup_copy_fields(copy, async_copy);
1836 async_copy, "%s", "copy thread");
1846 status = nfsd4_do_copy(copy, copy->nf_src->nf_file,
1847 copy->nf_dst->nf_file, true);
1850 release_copy_files(copy);
1853 if (nfsd4_ssc_is_inter(copy)) {
1855 * Source's vfsmount of inter-copy will be unmounted
1856 * by the laundromat. Use copy instead of async_copy
1859 refcount_dec(©->ss_nsui->nsui_refcnt);
1870 struct nfsd4_copy *copy;
1874 list_for_each_entry(copy, &clp->async_copies, copies) {
1875 if (memcmp(©->cp_stateid.cs_stid, stateid, NFS4_STATEID_SIZE))
1877 return copy;
1885 struct nfsd4_copy *copy;
1888 copy = find_async_copy_locked(clp, stateid);
1889 if (copy)
1890 refcount_inc(©->refcount);
1892 return copy;
1901 struct nfsd4_copy *copy;
1904 copy = find_async_copy(clp, &os->stateid);
1905 if (!copy) {
1910 nfsd4_stop_copy(copy);
1987 struct nfsd4_copy *copy;
1991 copy = find_async_copy_locked(clp, &os->stateid);
1992 if (copy)
1993 os->count = copy->cp_res.wr_bytes_written;
2445 * Get the entire list, then copy out only the user attributes
2578 struct nfsd4_copy *copy;
2594 copy = (struct nfsd4_copy *)&op->u;
2600 if (nfsd4_ssc_is_inter(copy))