diff options
author | Greg Farnum <greg@inktank.com> | 2013-10-09 10:39:19 -0700 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-10-09 11:13:55 -0700 |
commit | f23d0433336c3cc101dbfe45429d306fe29abc2a (patch) | |
tree | f7666353be96ce380dfd6e3fc17b08a7b3e39f49 | |
parent | 12159e452c0919ec9dd6a4677af09ef33c765ebc (diff) | |
download | ceph-f23d0433336c3cc101dbfe45429d306fe29abc2a.tar.gz |
OSD: add back CEPH_OSD_OP_COPY_GET, and use it in the Objecter
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>
-rw-r--r-- | src/common/ceph_strings.cc | 1 | ||||
-rw-r--r-- | src/include/rados.h | 1 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 14 | ||||
-rw-r--r-- | src/osd/osd_types.cc | 24 | ||||
-rw-r--r-- | src/osd/osd_types.h | 2 | ||||
-rw-r--r-- | src/osdc/Objecter.h | 2 |
6 files changed, 41 insertions, 3 deletions
diff --git a/src/common/ceph_strings.cc b/src/common/ceph_strings.cc index 858487a6445..2adfc0a88bc 100644 --- a/src/common/ceph_strings.cc +++ b/src/common/ceph_strings.cc @@ -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"; diff --git a/src/include/rados.h b/src/include/rados.h index 48374cd1af9..c410f801672 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -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, diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a14c811605a..6fc4fdd9709 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3608,6 +3608,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; { @@ -4244,7 +4251,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; @@ -4318,7 +4324,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; } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 5cdd6f6859c..729c2a1647e 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2524,24 +2524,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(in_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(in_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) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 26506fa30f7..84542e501a5 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1865,6 +1865,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; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index a18f9a5bc04..b48c6bfcc14 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -620,7 +620,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); |