Subject: [nfsv4] [PATCH 0/1] Replace CLONE with ca_atomic flag for intra-server-COPY

From: <[email-masked]>
Date: Fri, 3 Apr 2015 12:40:20 -0400

From: Andy Adamson <[email-masked]>

With this patch, CLONE functionality is replaced by an intra-server COPY with
ca_synchronous and ca_atomic set.

Note that a server implementation of synchronous intra-server COPY requries
only the COPY operation, and the implementatation can support only
ca_synchronous with ca_atomic set if it so desires.

This case of intra-server COPY is no more complicated to implement on the
server than the CLONE operation.

Requirements for Operations
          ......
   If a server supports intra-server copy, then the server MUST support
   the COPY operation.  If a server's COPY operation returns a stateid,
   then the server MUST also support these operations: CB_OFFLOAD,
   OFFLOAD_CANCEL, and OFFLOAD_STATUS.

If this patch is accepted, the CLONE operatation can be removed.
(and the clone_block attribute can be renamed)

Andy Adamson (1):
  Replace CLONE with ca_atomic flag for intra-server COPY

 dotx.d/copy_args.x        |  1 +
 dotx.d/copy_res.x         |  1 +
 nfsv42_middle_op_copy.xml | 24 +++++++++++++++++++++++-
 3 files changed, 25 insertions(+), 1 deletion(-)

-- 
1.9.3 (Apple Git-50)

---

From: <[email-masked]>
Date: Fri, 3 Apr 2015 12:40:21 -0400

With the both ca_synchronous and ca_atomic set, intra-server COPY performs
the CLONE functionality.

Signed-off-by: Andy Adamson <[email-masked]>
---
 dotx.d/copy_args.x        |  1 +
 dotx.d/copy_res.x         |  1 +
 nfsv42_middle_op_copy.xml | 37 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/dotx.d/copy_args.x b/dotx.d/copy_args.x
index 66bf938..432ceb1 100644
--- a/dotx.d/copy_args.x
+++ b/dotx.d/copy_args.x
@@ -8,6 +8,7 @@ struct COPY4args {
 	length4		ca_count;
 	bool		ca_consecutive;
 	bool		ca_synchronous;
+	bool		ca_atomic;
 	netloc4		ca_source_server<>;
 };
 
diff --git a/dotx.d/copy_res.x b/dotx.d/copy_res.x
index f252056..b632082 100644
--- a/dotx.d/copy_res.x
+++ b/dotx.d/copy_res.x
@@ -2,6 +2,7 @@
 struct copy_requirements4 {
 	bool		cr_consecutive;
 	bool		cr_synchronous;
+	bool		cr_atomic;
 };
 
 struct COPY4resok {
diff --git a/nfsv42_middle_op_copy.xml b/nfsv42_middle_op_copy.xml
index 718aa86..769464b 100644
--- a/nfsv42_middle_op_copy.xml
+++ b/nfsv42_middle_op_copy.xml
@@ -169,7 +169,42 @@
     </t>
 
     <t>
-      If both are set by the client, then the destination SHOULD
+      For an intra-server COPY, if ca_synchronous is set, ca_atomic may
+      also be set, indicating that the client has required that the intra-
+      server synchronous COPY be atomic; that is either all changes or no
+      changes are seen by the client or other clients.  If the destination
+      server cannot meet this requirement, then it MUST return an error of
+      NFS4ERR_OFFLOAD_NO_REQS and set cr_atomic to be false.  
+    </t>
+
+    <t>
+      When both ca_synchronous and ca_atomic are set, both cl_src_offset and
+      cl_dst_offset must be aligned to the clone block size
+      <xref target='ss:fattr:clone' />.
+      cl_count must be aligned to the clone block size, unless
+      cl_src_offset + cl_count are equal to the source file size.
+    </t>
+
+    <t>
+      If ca_synchronous is set, but ca_atomic is not set, the client has
+      indicated that the intra-server synchronous COPY is not required to
+      be atomic. If the
+      destination server cannot meet this requirement, for example because
+      of the lack of clone block alignment, the destination server MUST
+      return an error of NFS4ERR_OFFLOAD_NO_REQS and set cr_atomic to be true. 
+    </t>
+
+    <t>
+      When ca_atomic is set on a synchronous intra-server COPY,
+      ca_consecutive is ignored by the server, and
+      cr_consecutive is set to false.  For an asynchronous intra-server
+      COPY, or an inter-server COPY, ca_atomic is ignored by the server,
+      and cr_atomic is set to false.
+    </t>
+
+    <t>
+      If both ca_synchronous and ca_consecutive are set by the client,
+      then the destination SHOULD
       try to determine if it can respond to both requirements
       at the same time. If it cannot make that determination,
       it must set to false the one it can and set to true the
-- 
1.9.3 (Apple Git-50)