Subject: [nfsv4] [PATCH 1/3] Allow the client to inform the MDS of statistics
From: Thomas Haynes <[email-masked]>
To: [email-masked]
Date: Thu, 15 May 2014 17:56:07 -0700
List-Id: NFSv4 Working Group <nfsv4.ietf.org>

From: Tom Haynes <[email-masked]>

Signed-off-by: Tom Haynes <[email-masked]>
---
 Makefile                         |  4 ++++
 dotx.d/Makefile                  | 23 +++++++++++++----------
 dotx.d/layoutstats_args.x        | 10 ++++++++++
 dotx.d/layoutstats_res.x         |  5 +++++
 dotx.d/type_io_info.x            |  4 ++++
 nfsv42_middle_errors.xml         | 31 +++++++++++++++++++++++++++++++
 nfsv42_middle_new_errors.xml     | 31 +++++++++++++++++++++++++++++++
 nfsv42_middle_op_layoutstats.xml | 38 ++++++++++++++++++++++++++++++++++++++
 nfsv42_middle_op_mandlist.xml    |  1 +
 9 files changed, 137 insertions(+), 10 deletions(-)
 create mode 100644 dotx.d/layoutstats_args.x
 create mode 100644 dotx.d/layoutstats_res.x
 create mode 100644 dotx.d/type_io_info.x
 create mode 100644 nfsv42_middle_op_layoutstats.xml

diff --git a/Makefile b/Makefile
index 6b65a00..3a81c8f 100755
--- a/Makefile
+++ b/Makefile
@@ -355,6 +355,9 @@ AUTOGEN =	\
 		autogen/layoutget_res.xml \
 		autogen/layoutreturn_args.xml \
 		autogen/layoutreturn_res.xml \
+		autogen/type_io_info.xml \
+		autogen/layoutstats_args.xml \
+		autogen/layoutstats_res.xml \
 		autogen/link_args.xml \
 		autogen/link_res.xml \
 		autogen/lock_args.xml \
@@ -448,6 +451,7 @@ IDXMLSRC_BASE = \
 	${DOC_PREFIX}_middle_op_deallocate.xml \
 	${DOC_PREFIX}_middle_op_io_advise.xml \
 	${DOC_PREFIX}_middle_op_layoutreturn.xml \
+	${DOC_PREFIX}_middle_op_layoutstats.xml \
 	${DOC_PREFIX}_middle_op_offload_cancel.xml \
 	${DOC_PREFIX}_middle_op_offload_status.xml \
 	${DOC_PREFIX}_middle_op_read_plus.xml \
diff --git a/dotx.d/Makefile b/dotx.d/Makefile
index 928bd5b..555b9ee 100755
--- a/dotx.d/Makefile
+++ b/dotx.d/Makefile
@@ -106,16 +106,16 @@ FORE_OPS_AS_IS2 = \
 		want_delegation_res.x \
 		destroy_clientid_args.x \
 		destroy_clientid_res.x \
-                reclaim_complete_args.x \
-                reclaim_complete_res.x \
-                copy_args.x \
-                copy_res.x \
-                copy_notify_args.x \
-                copy_notify_res.x \
-                offload_cancel_args.x \
-                offload_cancel_res.x \
-                offload_status_args.x \
-                offload_status_res.x \
+		reclaim_complete_args.x \
+		reclaim_complete_res.x \
+		copy_args.x \
+		copy_res.x \
+		copy_notify_args.x \
+		copy_notify_res.x \
+		offload_cancel_args.x \
+		offload_cancel_res.x \
+		offload_status_args.x \
+		offload_status_res.x \
 		allocate_args.x \
 		allocate_res.x \
 		deallocate_args.x \
@@ -123,6 +123,9 @@ FORE_OPS_AS_IS2 = \
 		type_io_advise.x \
 		io_advise_args.x \
 		io_advise_res.x \
+		type_io_info.x \
+		layoutstats_args.x \
+		layoutstats_res.x \
 		read_plus_args.x \
 		read_plus_content.x \
 		read_plus_res_pre.x \
diff --git a/dotx.d/layoutstats_args.x b/dotx.d/layoutstats_args.x
new file mode 100644
index 0000000..61e8eee
--- /dev/null
+++ b/dotx.d/layoutstats_args.x
@@ -0,0 +1,10 @@
+
+struct LAYOUTSTATS4args {
+        /* CURRENT_FH: file */
+        offset4                 lsa_offset;
+        length4                 lsa_length;
+        stateid4                lsa_stateid;
+	io_info4		lsa_read;
+	io_info4		lsa_write;
+        layoutupdate4           lsa_layoutupdate;
+};
diff --git a/dotx.d/layoutstats_res.x b/dotx.d/layoutstats_res.x
new file mode 100644
index 0000000..6928863
--- /dev/null
+++ b/dotx.d/layoutstats_res.x
@@ -0,0 +1,5 @@
+
+struct LAYOUTSTATS4res {
+	nfsstat4	lsr_status;
+};
+
diff --git a/dotx.d/type_io_info.x b/dotx.d/type_io_info.x
new file mode 100644
index 0000000..fa1a22a
--- /dev/null
+++ b/dotx.d/type_io_info.x
@@ -0,0 +1,4 @@
+struct io_info4 {
+	uint32_t	ii_count;
+	uint64_t	ii_bytes;
+};
diff --git a/nfsv42_middle_errors.xml b/nfsv42_middle_errors.xml
index c8ecd2d..73f255c 100644
--- a/nfsv42_middle_errors.xml
+++ b/nfsv42_middle_errors.xml
@@ -1955,6 +1955,37 @@
         NFS4ERR_WRONG_TYPE
       </c>
 
+      <c>LAYOUTSTATS</c>
+      <c>
+        NFS4ERR_ADMIN_REVOKED,
+        NFS4ERR_BADXDR,
+        NFS4ERR_BAD_STATEID,
+        NFS4ERR_DEADSESSION,
+        NFS4ERR_DELAY,
+        NFS4ERR_DELEG_REVOKED,
+        NFS4ERR_EXPIRED,
+        NFS4ERR_FHEXPIRED,
+        NFS4ERR_GRACE,
+        NFS4ERR_INVAL,
+        NFS4ERR_ISDIR,
+        NFS4ERR_MOVED,
+        NFS4ERR_NOFILEHANDLE,
+        NFS4ERR_NOTSUPP,
+        NFS4ERR_NO_GRACE,
+        NFS4ERR_OLD_STATEID,
+        NFS4ERR_OP_NOT_IN_SESSION,
+        NFS4ERR_REP_TOO_BIG,
+        NFS4ERR_REP_TOO_BIG_TO_CACHE,
+        NFS4ERR_REQ_TOO_BIG,
+        NFS4ERR_RETRY_UNCACHED_REP,
+        NFS4ERR_SERVERFAULT,
+        NFS4ERR_STALE,
+        NFS4ERR_TOO_MANY_OPS,
+        NFS4ERR_UNKNOWN_LAYOUTTYPE,
+        NFS4ERR_WRONG_CRED,
+        NFS4ERR_WRONG_TYPE
+      </c>
+
       <c>LINK</c>
       <c>
         NFS4ERR_ACCESS,
diff --git a/nfsv42_middle_new_errors.xml b/nfsv42_middle_new_errors.xml
index 053a629..cc18168 100644
--- a/nfsv42_middle_new_errors.xml
+++ b/nfsv42_middle_new_errors.xml
@@ -269,6 +269,37 @@
         NFS4ERR_WRONG_TYPE
       </c>
 
+      <c>LAYOUTSTATS</c>
+      <c>
+        NFS4ERR_ADMIN_REVOKED,
+        NFS4ERR_BADXDR,
+        NFS4ERR_BAD_STATEID,
+        NFS4ERR_DEADSESSION,
+        NFS4ERR_DELAY,
+        NFS4ERR_DELEG_REVOKED,
+        NFS4ERR_EXPIRED,
+        NFS4ERR_FHEXPIRED,
+        NFS4ERR_GRACE,
+        NFS4ERR_INVAL,
+        NFS4ERR_ISDIR,
+        NFS4ERR_MOVED,
+        NFS4ERR_NOFILEHANDLE,
+        NFS4ERR_NOTSUPP,
+        NFS4ERR_NO_GRACE,
+        NFS4ERR_OLD_STATEID,
+        NFS4ERR_OP_NOT_IN_SESSION,
+        NFS4ERR_REP_TOO_BIG,
+        NFS4ERR_REP_TOO_BIG_TO_CACHE,
+        NFS4ERR_REQ_TOO_BIG,
+        NFS4ERR_RETRY_UNCACHED_REP,
+        NFS4ERR_SERVERFAULT,
+        NFS4ERR_STALE,
+        NFS4ERR_TOO_MANY_OPS,
+        NFS4ERR_UNKNOWN_LAYOUTTYPE,
+        NFS4ERR_WRONG_CRED,
+        NFS4ERR_WRONG_TYPE
+      </c>
+
       <c>OFFLOAD_CANCEL</c>
       <c>
         NFS4ERR_ADMIN_REVOKED,
diff --git a/nfsv42_middle_op_layoutstats.xml b/nfsv42_middle_op_layoutstats.xml
new file mode 100644
index 0000000..4784b13
--- /dev/null
+++ b/nfsv42_middle_op_layoutstats.xml
@@ -0,0 +1,38 @@
+<!-- Copyright (C) The IETF Trust (2014) -->
+<!-- Copyright (C) The Internet Society (2014) -->
+
+<section anchor='op:layout_event' title='Operation 70: LAYOUTSTATS - Provide Statistics for the Layout'>
+  <section toc='exclude' title="ARGUMENT">
+    <?rfc include='autogen/type_layoutupdate4.xml'?>
+    <?rfc include='autogen/type_io_info.xml'?>
+    <?rfc include='autogen/layoutstats_args.xml'?>
+  </section>
+
+  <section toc='exclude' title="RESULT">
+    <?rfc include='autogen/layoutstats_res.xml'?>
+  </section>
+
+  <section toc='exclude' title="DESCRIPTION">
+    <t>
+      The client can use LAYOUTSTATS to inform the metadata server
+      about its interaction with the layout represented by the
+      current filehandle, client ID (derived from the session ID
+      in the preceding SEQUENCE operation), byte-range (lea_offset
+      + lea_length), and lea_stateid. lsa_read and lsa_write allow
+      for non-Layout Type specific statistices to be reported.  The
+      remaining information the client is presenting is specific
+      to the Layout Type and presented in the lea_layoutupdate
+      field. Each Layout Type MUST define the contents of
+      lea_layoutupdate in their respective specifications.
+    </t>
+
+    <t>
+      LAYOUTSTATS can be combined with IO_ADVISE (see
+      <xref target='op:io_advise' />) to augment the decision making
+      process of how the metadata server handles a file.  I.e.,
+      IO_ADVISE lets the server know that a byte range has a certain
+      characteristic, but not necessarily the intensity of that
+      characteristic.
+    </t>
+  </section>
+</section>
diff --git a/nfsv42_middle_op_mandlist.xml b/nfsv42_middle_op_mandlist.xml
index 4ebd0bb..b590a6e 100644
--- a/nfsv42_middle_op_mandlist.xml
+++ b/nfsv42_middle_op_mandlist.xml
@@ -141,6 +141,7 @@
       <c>LAYOUTCOMMIT         </c> <c> OPT </c> <c> pNFS (REQ)   </c>
       <c>LAYOUTGET            </c> <c> OPT </c> <c> pNFS (REQ)   </c>
       <c>LAYOUTRETURN         </c> <c> OPT </c> <c> pNFS (REQ)   </c>
+      <c>LAYOUTSTATS          </c> <c> OPT </c> <c> pNFS (REQ)   </c>
       <c>LINK                 </c> <c> OPT </c> <c>              </c>
       <c>LOCK                 </c> <c> REQ </c> <c>              </c>
       <c>LOCKT                </c> <c> REQ </c> <c>              </c>
-- 
1.9.0