]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: add back CEPH_OSD_OP_COPY_GET, and use it in the Objecter
authorGreg Farnum <greg@inktank.com>
Wed, 9 Oct 2013 17:39:19 +0000 (10:39 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 25 Oct 2013 20:52:56 +0000 (13:52 -0700)
This one is encoded with version information. We are not doing anything
to control which op gets sent by the client, but after discussion with
Sam we think this op isn't accessible enough to clients (right now it's
only triggered by a client sending copy-from, which can only happen via
ceph-test-rados) to require compatibility versioning.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/common/ceph_strings.cc
src/include/rados.h
src/osd/ReplicatedPG.cc
src/osd/osd_types.cc
src/osd/osd_types.h
src/osdc/Objecter.h

index 8ffdc4143f28514a46d27c15d85a441ceaea9b8f..3eb5e672d4070e899d14b56178ff818c55696181 100644 (file)
@@ -49,6 +49,7 @@ const char *ceph_osd_op_name(int op)
        case CEPH_OSD_OP_WATCH: return "watch";
 
        case CEPH_OSD_OP_COPY_GET_CLASSIC: return "copy-get-classic";
+       case CEPH_OSD_OP_COPY_GET: return "copy-get";
        case CEPH_OSD_OP_COPY_FROM: return "copy-from";
        case CEPH_OSD_OP_UNDIRTY: return "undirty";
        case CEPH_OSD_OP_ISDIRTY: return "isdirty";
index 48374cd1af99e559556737d280b9fea63c7c4164..c410f8016720141a34724c373384a893c83a2abf 100644 (file)
@@ -221,6 +221,7 @@ enum {
        CEPH_OSD_OP_COPY_GET_CLASSIC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 27,
        CEPH_OSD_OP_UNDIRTY   = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 28,
        CEPH_OSD_OP_ISDIRTY   = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 29,
+       CEPH_OSD_OP_COPY_GET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 30,
 
        /** multi **/
        CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
index ebc033daf7ea5d7e6bc5861c5b1dc6e50db5a6ab..6d1bdbd0c31e0ed580c9f1e7f4fb74c970404e0d 100644 (file)
@@ -3618,6 +3618,13 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        goto fail;
       break;
 
+    case CEPH_OSD_OP_COPY_GET:
+      ++ctx->num_read;
+      result = fill_in_copy_get(bp, osd_op, oi, false);
+      if (result == -EINVAL)
+       goto fail;
+      break;
+
     case CEPH_OSD_OP_COPY_FROM:
       ++ctx->num_write;
       {
@@ -4254,7 +4261,6 @@ struct C_Copyfrom : public Context {
 int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op,
                                    object_info_t& oi, bool classic)
 {
-  assert(classic);
   hobject_t& soid = oi.soid;
   int result = 0;
   object_copy_cursor_t cursor;
@@ -4328,7 +4334,11 @@ int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op,
                     << " " << out_omap.size() << " keys"
                     << dendl;
   reply_obj.cursor = cursor;
-  ::encode(reply_obj, osd_op.outdata);
+  if (classic) {
+    reply_obj.encode_classic(osd_op.outdata);
+  } else {
+    ::encode(reply_obj, osd_op.outdata);
+  }
   result = 0;
   return result;
 }
index 93ce65e81eebb01fbaa8b874356c47a6d8124319..e3867905dc767d9d7b61eeac5082859e45ae5354 100644 (file)
@@ -2525,24 +2525,48 @@ void object_copy_cursor_t::generate_test_instances(list<object_copy_cursor_t*>&
 
 // -- object_copy_data_t --
 
+void object_copy_data_t::encode_classic(bufferlist& bl) const
+{
+  ::encode(size, bl);
+  ::encode(mtime, bl);
+  ::encode(attrs, bl);
+  ::encode(data, bl);
+  ::encode(omap, bl);
+  ::encode(cursor, bl);
+}
+
+void object_copy_data_t::decode_classic(bufferlist::iterator& bl)
+{
+  ::decode(size, bl);
+  ::decode(mtime, bl);
+  ::decode(attrs, bl);
+  ::decode(data, bl);
+  ::decode(omap, bl);
+  ::decode(cursor, bl);
+}
+
 void object_copy_data_t::encode(bufferlist& bl) const
 {
+  ENCODE_START(1, 1, bl);
   ::encode(size, bl);
   ::encode(mtime, bl);
   ::encode(attrs, bl);
   ::encode(data, bl);
   ::encode(omap, bl);
   ::encode(cursor, bl);
+  ENCODE_FINISH(bl);
 }
 
 void object_copy_data_t::decode(bufferlist::iterator& bl)
 {
+  DECODE_START(1, bl);
   ::decode(size, bl);
   ::decode(mtime, bl);
   ::decode(attrs, bl);
   ::decode(data, bl);
   ::decode(omap, bl);
   ::decode(cursor, bl);
+  DECODE_FINISH(bl);
 }
 
 void object_copy_data_t::generate_test_instances(list<object_copy_data_t*>& o)
index 419f9d05291add513c9b85ff69b25f29ceee4ea6..c9f518e638d282665dabf05bcdbe0cc3915f0841 100644 (file)
@@ -1882,6 +1882,8 @@ public:
   object_copy_data_t() : size((uint64_t)-1) {}
 
   static void generate_test_instances(list<object_copy_data_t*>& o);
+  void encode_classic(bufferlist& bl) const;
+  void decode_classic(bufferlist::iterator& bl);
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& bl);
   void dump(Formatter *f) const;
index 713c2a0bfd8d6d0e5df4b3dd5473a28ca7b64e01..9b89f9586f4c926b0d07243d84bb30833fe876d3 100644 (file)
@@ -616,7 +616,7 @@ struct ObjectOperation {
                bufferlist *out_data,
                std::map<std::string,bufferlist> *out_omap,
                int *prval) {
-    OSDOp& osd_op = add_op(CEPH_OSD_OP_COPY_GET_CLASSIC);
+    OSDOp& osd_op = add_op(CEPH_OSD_OP_COPY_GET);
     osd_op.op.copy_get.max = max;
     ::encode(*cursor, osd_op.indata);
     ::encode(max, osd_op.indata);