From: Sage Weil Date: Wed, 20 May 2020 18:50:47 +0000 (-0500) Subject: cls_cas: remove ops that expose internal ref representation X-Git-Tag: v17.0.0~2135^2~13 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=25cdc0a7a02c81a7e53e9023d51f01f778c16f88;p=ceph.git cls_cas: remove ops that expose internal ref representation The internal representation may change, and we've dropped all the users. Signed-off-by: Sage Weil --- diff --git a/src/cls/cas/cls_cas.cc b/src/cls/cas/cls_cas.cc index 36bf7e8bafe58..3f06a387dba2f 100644 --- a/src/cls/cas/cls_cas.cc +++ b/src/cls/cas/cls_cas.cc @@ -198,52 +198,6 @@ static int chunk_put_ref(cls_method_context_t hctx, return 0; } -static int chunk_set_refs(cls_method_context_t hctx, - bufferlist *in, bufferlist *out) -{ - auto in_iter = in->cbegin(); - - cls_cas_chunk_set_refs_op op; - try { - decode(op, in_iter); - } catch (ceph::buffer::error& err) { - CLS_LOG(1, "ERROR: cls_cas_chunk_set(): failed to decode entry\n"); - return -EINVAL; - } - - if (!op.refs.size()) { - return cls_cxx_remove(hctx); - } - - chunk_obj_refcount objr; - objr.refs = op.refs; - - int ret = chunk_set_refcount(hctx, objr); - if (ret < 0) - return ret; - - return 0; -} - -static int chunk_read_refs(cls_method_context_t hctx, - bufferlist *in, bufferlist *out) -{ - chunk_obj_refcount objr; - - cls_cas_chunk_read_refs_ret read_ret; - int ret = chunk_read_refcount(hctx, &objr); - if (ret < 0) - return ret; - - for (auto &p : objr.refs) { - read_ret.refs.insert(p); - } - - encode(read_ret, *out); - - return 0; -} - static int references_chunk(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { @@ -273,8 +227,6 @@ CLS_INIT(cas) cls_method_handle_t h_chunk_create_or_get_ref; cls_method_handle_t h_chunk_get_ref; cls_method_handle_t h_chunk_put_ref; - cls_method_handle_t h_chunk_set_refs; - cls_method_handle_t h_chunk_read_refs; cls_method_handle_t h_references_chunk; cls_register("cas", &h_class); @@ -291,13 +243,6 @@ CLS_INIT(cas) CLS_METHOD_RD | CLS_METHOD_WR, chunk_put_ref, &h_chunk_put_ref); - cls_register_cxx_method(h_class, "chunk_set_refs", - CLS_METHOD_RD | CLS_METHOD_WR, - chunk_set_refs, - &h_chunk_set_refs); - cls_register_cxx_method(h_class, "chunk_read_refs", CLS_METHOD_RD, - chunk_read_refs, - &h_chunk_read_refs); cls_register_cxx_method(h_class, "references_chunk", CLS_METHOD_RD, references_chunk, &h_references_chunk); diff --git a/src/cls/cas/cls_cas_client.cc b/src/cls/cas/cls_cas_client.cc index 7492f62a39a8f..085d9e52a50a7 100644 --- a/src/cls/cas/cls_cas_client.cc +++ b/src/cls/cas/cls_cas_client.cc @@ -53,40 +53,6 @@ void cls_cas_chunk_put_ref( op.exec("cas", "chunk_put_ref", in); } -void cls_cas_chunk_set_refs( - librados::ObjectWriteOperation& op, - set& refs) -{ - bufferlist in; - cls_cas_chunk_set_refs_op call; - call.refs = refs; - encode(call, in); - op.exec("cas", "chunk_set_refs", in); -} - -int cls_cas_chunk_read_refs( - librados::IoCtx& io_ctx, - string& oid, - set *refs) -{ - bufferlist in, out; - int r = io_ctx.exec(oid, "cas", "chunk_read_refs", in, out); - if (r < 0) - return r; - - cls_cas_chunk_read_refs_ret ret; - try { - auto iter = out.cbegin(); - decode(ret, iter); - } catch (ceph::buffer::error& err) { - return -EIO; - } - - *refs = ret.refs; - - return r; -} - int cls_cas_references_chunk( librados::IoCtx& io_ctx, const string& oid, diff --git a/src/cls/cas/cls_cas_client.h b/src/cls/cas/cls_cas_client.h index 1017edfb0d2ab..0abbf045bb03b 100644 --- a/src/cls/cas/cls_cas_client.h +++ b/src/cls/cas/cls_cas_client.h @@ -34,17 +34,6 @@ void cls_cas_chunk_put_ref( // advanced (used for scrub, repair, etc.) // -/// read list of all chunk references -int cls_cas_chunk_read_refs( - librados::IoCtx& io_ctx, - std::string& oid, - std::set *refs); - -/// force update on chunk references -void cls_cas_chunk_set_refs( - librados::ObjectWriteOperation& op, - std::set& refs); - /// check if a tiered rados object links to a chunk int cls_cas_references_chunk( librados::IoCtx& io_ctx, diff --git a/src/cls/cas/cls_cas_ops.h b/src/cls/cas/cls_cas_ops.h index 4d3ec147c744c..a79013f0ea12c 100644 --- a/src/cls/cas/cls_cas_ops.h +++ b/src/cls/cas/cls_cas_ops.h @@ -98,66 +98,4 @@ struct cls_cas_chunk_put_ref_op { }; WRITE_CLASS_ENCODER(cls_cas_chunk_put_ref_op) - -struct cls_cas_chunk_set_refs_op { - std::set refs; - - cls_cas_chunk_set_refs_op() {} - - void encode(ceph::buffer::list& bl) const { - ENCODE_START(1, 1, bl); - encode(refs, bl); - ENCODE_FINISH(bl); - } - - void decode(ceph::buffer::list::const_iterator& bl) { - DECODE_START(1, bl); - decode(refs, bl); - DECODE_FINISH(bl); - } - - void dump(ceph::Formatter *f) const { - f->open_array_section("refs"); - for (auto& i : refs) { - f->dump_object("ref", i); - } - f->close_section(); - } - static void generate_test_instances(std::list& ls) { - ls.push_back(new cls_cas_chunk_set_refs_op()); - } -}; -WRITE_CLASS_ENCODER(cls_cas_chunk_set_refs_op) - - -struct cls_cas_chunk_read_refs_ret { - std::set refs; - - cls_cas_chunk_read_refs_ret() {} - - void encode(ceph::buffer::list& bl) const { - ENCODE_START(1, 1, bl); - encode(refs, bl); - ENCODE_FINISH(bl); - } - - void decode(ceph::buffer::list::const_iterator& bl) { - DECODE_START(1, bl); - decode(refs, bl); - DECODE_FINISH(bl); - } - - void dump(ceph::Formatter *f) const { - f->open_array_section("refs"); - for (auto& i : refs) { - f->dump_object("ref", i); - } - f->close_section(); - } - static void generate_test_instances(std::list& ls) { - ls.push_back(new cls_cas_chunk_read_refs_ret()); - } -}; -WRITE_CLASS_ENCODER(cls_cas_chunk_read_refs_ret) - #endif diff --git a/src/tools/ceph-dencoder/common_types.h b/src/tools/ceph-dencoder/common_types.h index ed6ffc6209f22..6583cd4b87047 100644 --- a/src/tools/ceph-dencoder/common_types.h +++ b/src/tools/ceph-dencoder/common_types.h @@ -65,8 +65,6 @@ TYPE_FEATUREFUL_NOCOPY(CrushWrapper) TYPE(cls_cas_chunk_create_or_get_ref_op) TYPE(cls_cas_chunk_get_ref_op) TYPE(cls_cas_chunk_put_ref_op) -TYPE(cls_cas_chunk_set_refs_op) -TYPE(cls_cas_chunk_read_refs_ret) #include "cls/cas/cls_cas_internal.h" TYPE(chunk_obj_refcount)