All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olga Kornievskaia <kolga@netapp.com>
To: <Trond.Myklebust@primarydata.com>, <anna.schumaker@netapp.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v5 04/23] NFS OFFLOAD_STATUS op
Date: Fri, 13 Oct 2017 16:55:42 -0400	[thread overview]
Message-ID: <20171013205550.65573-5-kolga@netapp.com> (raw)
In-Reply-To: <20171013205550.65573-1-kolga@netapp.com>

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs42.h     |  5 ++++-
 fs/nfs/nfs42proc.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
index b6cd153..6b9decf 100644
--- a/fs/nfs/nfs42.h
+++ b/fs/nfs/nfs42.h
@@ -11,6 +11,7 @@
  */
 #define PNFS_LAYOUTSTATS_MAXDEV (4)
 
+#if defined(CONFIG_NFS_V4_2)
 /* nfs4.2proc.c */
 int nfs42_proc_allocate(struct file *, loff_t, loff_t);
 ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t);
@@ -19,5 +20,7 @@
 int nfs42_proc_layoutstats_generic(struct nfs_server *,
 				   struct nfs42_layoutstat_data *);
 int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
-
+int nfs42_proc_offload_status(struct file *, nfs4_stateid *,
+			      struct nfs42_offload_status_res *);
+#endif /* CONFIG_NFS_V4_2) */
 #endif /* __LINUX_FS_NFS_NFS4_2_H */
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 6c2db51..65fb014 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -263,6 +263,49 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
 	return err;
 }
 
+int _nfs42_proc_offload_status(struct file *dst, nfs4_stateid *stateid,
+				struct nfs42_offload_status_res *res)
+{
+	struct nfs42_offload_status_args args = {
+		.osa_src_fh = NFS_FH(file_inode(dst)),
+	};
+	struct nfs_server *dst_server = NFS_SERVER(file_inode(dst));
+	struct rpc_message msg = {
+		.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OFFLOAD_STATUS],
+		.rpc_resp = res,
+		.rpc_argp = &args,
+	};
+	int status;
+
+	memcpy(&args.osa_stateid, stateid, sizeof(args.osa_stateid));
+	status = nfs4_call_sync(dst_server->client, dst_server, &msg,
+				&args.osa_seq_args, &res->osr_seq_res, 0);
+	if (status == -ENOTSUPP)
+		dst_server->caps &= ~NFS_CAP_OFFLOAD_STATUS;
+
+	return status;
+}
+
+int nfs42_proc_offload_status(struct file *dst, nfs4_stateid *stateid,
+				struct nfs42_offload_status_res *res)
+{
+	struct nfs_server *dst_server = NFS_SERVER(file_inode(dst));
+	struct nfs4_exception exception = { };
+	int status;
+
+	if (!(dst_server->caps & NFS_CAP_OFFLOAD_STATUS))
+		return -EOPNOTSUPP;
+
+	do {
+		status = _nfs42_proc_offload_status(dst, stateid, res);
+		if (status == -ENOTSUPP)
+			return -EOPNOTSUPP;
+		status = nfs4_handle_exception(dst_server, status, &exception);
+	} while (exception.retry);
+
+	return status;
+}
+
 static loff_t _nfs42_proc_llseek(struct file *filep,
 		struct nfs_lock_context *lock, loff_t offset, int whence)
 {
-- 
1.8.3.1


  parent reply	other threads:[~2017-10-13 20:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 20:55 [PATCH v5 00/23] NFS support for async intra COPY Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 01/23] fs: Don't copy beyond the end of the file Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 02/23] NFS CB_OFFLOAD xdr Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 03/23] NFS OFFLOAD_STATUS xdr Olga Kornievskaia
2017-10-17 18:39   ` Anna Schumaker
2017-10-18 17:20     ` Olga Kornievskaia
2017-10-13 20:55 ` Olga Kornievskaia [this message]
2017-10-13 20:57   ` [PATCH v5 04/23] NFS OFFLOAD_STATUS op Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 05/23] NFS OFFLOAD_CANCEL xdr Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 06/23] NFS COPY xdr handle async reply Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 07/23] NFS add support for asynchronous COPY Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 08/23] NFS handle COPY reply CB_OFFLOAD call race Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 09/23] NFS export nfs4_async_handle_error Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 10/23] NFS send OFFLOAD_CANCEL when COPY killed Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 11/23] NFS handle COPY ERR_OFFLOAD_NO_REQS Olga Kornievskaia
2017-10-13 20:55 ` [PATCH v5 12/23] NFS add a simple sync nfs4_proc_commit after async COPY Olga Kornievskaia

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=20171013205550.65573-5-kolga@netapp.com \
    --to=kolga@netapp.com \
    --cc=Trond.Myklebust@primarydata.com \
    --cc=anna.schumaker@netapp.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.