From: <andros@netapp.com>
To: <Trond.Myklebust@primarydata.com>
Cc: <Anna.Schumaker@netapp.com>, <bfields@fieldses.org>,
<linux-nfs@vger.kernel.org>, Andy Adamson <andros@netapp.com>
Subject: [PATCH 10/16] NFS add ca_source_server<> to COPY
Date: Mon, 31 Aug 2015 15:50:00 -0400 [thread overview]
Message-ID: <1441050606-40897-11-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1441050606-40897-1-git-send-email-andros@netapp.com>
From: Andy Adamson <andros@netapp.com>
Support only one source server address: the same address that
the client and source server use.
Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfs/nfs42proc.c | 22 ++++++++++++++++++++--
fs/nfs/nfs42xdr.c | 27 +++++++++++++++++++++++++--
include/linux/nfs_xdr.h | 3 +++
3 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 92b5d5a..42cab7e 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -157,8 +157,12 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len)
return err;
}
+/**
+ * Support one source address for now.
+ */
static ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
- struct file *dst, loff_t pos_dst, size_t count)
+ struct file *dst, loff_t pos_dst, size_t count,
+ struct nfs42_copy_notify_res *cn_res)
{
struct nfs42_copy_args args = {
.src_fh = NFS_FH(file_inode(src)),
@@ -176,6 +180,19 @@ static ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
struct nfs_server *server = NFS_SERVER(file_inode(dst));
int status;
+ if (cn_res) {
+ args.cp_nsrc = 1; /* support for one NL4_NETADDR for now */
+ args.cp_src[0].nl4_type = cn_res->cnr_src[0].nl4_type;
+ args.cp_src[0].u.nl4_addr = cn_res->cnr_src[0].u.nl4_addr;
+
+ dprintk("--> %s nl4_type %d cp_addr netid %d:%s uaddr %d:%s\n",
+ __func__, args.cp_src[0].nl4_type,
+ args.cp_src[0].u.nl4_addr.na_netid_len,
+ args.cp_src[0].u.nl4_addr.na_netid,
+ args.cp_src[0].u.nl4_addr.na_uaddr_len,
+ args.cp_src[0].u.nl4_addr.na_uaddr);
+ }
+
if (!(server->caps & NFS_CAP_COPY))
return -ENOTSUPP;
@@ -297,7 +314,8 @@ ssize_t nfs42_do_copy(struct file *src, loff_t pos_src, struct file *dst,
if (ret)
goto out_err;
}
- ret = nfs42_proc_copy(src, pos_src, dst, pos_dst, count);
+ /* NULL nfs42_copy_notify_res pointer signals intra ssc */
+ ret = nfs42_proc_copy(src, pos_src, dst, pos_dst, count, cn_resp);
out_err:
kfree(cn_resp);
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index feb29af..060d4eb 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -20,7 +20,10 @@
#define encode_copy_maxsz (op_encode_hdr_maxsz + \
XDR_QUADLEN(NFS4_STATEID_SIZE) + \
XDR_QUADLEN(NFS4_STATEID_SIZE) + \
- 2 + 2 + 2 + 1 + 1 + 1)
+ 2 + 2 + 2 + 1 + 1 + 1 +\
+ 1 + /* One cnr_source_server */\
+ 1 + /* nl4_type */ \
+ 1 + XDR_QUADLEN(NFS4_OPAQUE_LIMIT))
#define decode_copy_maxsz (op_decode_hdr_maxsz + \
NFS42_WRITE_RES_SIZE + \
1 /* cr_consecutive */ + \
@@ -136,7 +139,27 @@ static void encode_copy(struct xdr_stream *xdr,
encode_uint32(xdr, 1); /* consecutive = true */
encode_uint32(xdr, 1); /* synchronous = true */
- encode_uint32(xdr, 0); /* src server list */
+ encode_uint32(xdr, args->cp_nsrc); /* set to 1 for inter-ssc*/
+ if (args->cp_nsrc == 0) /* intra-ssc */
+ return;
+
+ encode_uint32(xdr, args->cp_src[0].nl4_type);
+ /* Support one src server in list for now */
+ switch (args->cp_src[0].nl4_type) {
+ case NL4_NAME:
+ case NL4_URL:
+ encode_string(xdr, args->cp_src[0].u.nl4_str_sz,
+ args->cp_src[0].u.nl4_str);
+ break;
+ case NL4_NETADDR:
+ encode_string(xdr, args->cp_src[0].u.nl4_addr.na_netid_len,
+ args->cp_src[0].u.nl4_addr.na_netid);
+ encode_string(xdr, args->cp_src[0].u.nl4_addr.na_uaddr_len,
+ args->cp_src[0].u.nl4_addr.na_uaddr);
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ }
}
static void encode_copy_notify(struct xdr_stream *xdr,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a7f63fb..dd9009a 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1339,6 +1339,9 @@ struct nfs42_copy_args {
u64 dst_pos;
u64 count;
+ /* Support one source server */
+ int cp_nsrc;
+ struct nl4_server cp_src[NFS42_MAX_SSC_SRC];
};
struct nfs42_write_res {
--
1.8.3.1
next prev parent reply other threads:[~2015-08-31 19:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 19:49 [PATCH 00/16] NFSv4.2: Add support for inter-server to server COPY andros
2015-08-31 19:49 ` [PATCH 01/16] VFS: Separate cross fs check from vfs_copy_file_range andros
2015-08-31 19:49 ` [PATCH 02/16] BTRFS: Use VFS copy offload helper andros
2015-08-31 19:49 ` [PATCH 03/16] VFS SQUASH use file_out instead of file_in for copy_file_range andros
2015-08-31 19:49 ` [PATCH 04/16] NFS COPY xdr changes andros
2015-08-31 19:49 ` [PATCH 05/16] NFS add same file check and flush source and destination for COPY andros
2015-08-31 19:49 ` [PATCH 06/16] NFS add inter ssc functions to nfs42proc andros
2015-08-31 19:49 ` [PATCH 07/16] NFS add COPY_NOTIFY operation andros
2015-08-31 19:49 ` [PATCH 08/16] NFSD add ca_source_server<> to COPY andros
2015-08-31 19:49 ` [PATCH 09/16] NFSD add COPY_NOTIFY operation andros
2015-08-31 19:50 ` andros [this message]
2015-08-31 19:50 ` [PATCH 11/16] NFSD generalize nfsd4_compound_state flag names andros
2015-08-31 19:50 ` [PATCH 12/16] NFSD: allow inter server COPY to have a STALE source server fh andros
2015-08-31 19:50 ` [PATCH 13/16] NFSD add nfs4 inter ssc to nfsd4_copy andros
2015-08-31 19:50 ` [PATCH 14/16] NFS in copy use stateid returned by copy_notify andros
2015-08-31 19:50 ` [PATCH 15/16] NFS always use openstateid in COPY_NOTIFY andros
2015-08-31 19:50 ` [PATCH 16/16] NFSD: extra stateid checking in read for interserver copy andros
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=1441050606-40897-11-git-send-email-andros@netapp.com \
--to=andros@netapp.com \
--cc=Anna.Schumaker@netapp.com \
--cc=Trond.Myklebust@primarydata.com \
--cc=bfields@fieldses.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).