From f74318e5c6fd348f3c8938b3f52f40e3475fbbb1 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Sat, 10 Aug 2019 10:38:20 +0200 Subject: [PATCH] osd, osdc: drop the unused outdata feature of PGLSFilter. Before this commit PGLSFilter interface was offering the outdata parameter in its filter() method: filter(..., bufferlist& outdata) OSD was serializing and appending the bufferlist to response to CEPH_OSD_OP_PGLS_FILTER and CEPH_OSD_OP_PGNLS_FILTER operations. At the Objecter's side these extra bits were being parsed and finally stored in NListContext::extra_info. However, it really looks this member is not used anywhere. The commit removes the outdata handling on multiple layers: from PGLSFilter implementations, through OSD till Objecter. Signed-off-by: Radoslaw Zarzynski --- src/cls/cephfs/cls_cephfs.cc | 6 ++---- src/cls/hello/cls_hello.cc | 3 +-- src/objclass/objclass.h | 3 +-- src/osd/PrimaryLogPG.cc | 19 ++++++------------- src/osd/PrimaryLogPG.h | 2 +- src/osdc/Objecter.cc | 13 +++++++------ src/osdc/Objecter.h | 2 -- 7 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/cls/cephfs/cls_cephfs.cc b/src/cls/cephfs/cls_cephfs.cc index 7e3214b9246fe..3500ae6e497c7 100644 --- a/src/cls/cephfs/cls_cephfs.cc +++ b/src/cls/cephfs/cls_cephfs.cc @@ -146,12 +146,10 @@ public: ~PGLSCephFSFilter() override {} bool reject_empty_xattr() override { return false; } - bool filter(const hobject_t &obj, bufferlist& xattr_data, - bufferlist& outdata) override; + bool filter(const hobject_t &obj, bufferlist& xattr_data) override; }; -bool PGLSCephFSFilter::filter(const hobject_t &obj, - bufferlist& xattr_data, bufferlist& outdata) +bool PGLSCephFSFilter::filter(const hobject_t &obj, bufferlist& xattr_data) { const std::string need_ending = ".00000000"; const std::string &obj_name = obj.oid.name; diff --git a/src/cls/hello/cls_hello.cc b/src/cls/hello/cls_hello.cc index eaa2df175eab8..261b0f60e061e 100644 --- a/src/cls/hello/cls_hello.cc +++ b/src/cls/hello/cls_hello.cc @@ -266,8 +266,7 @@ public: } ~PGLSHelloFilter() override {} - bool filter(const hobject_t &obj, bufferlist& xattr_data, - bufferlist& outdata) override + bool filter(const hobject_t &obj, ceph::bufferlist& xattr_data) override { if (val.size() != xattr_data.length()) return false; diff --git a/src/objclass/objclass.h b/src/objclass/objclass.h index 7ddc6ff36fdb4..703f0cf706c50 100644 --- a/src/objclass/objclass.h +++ b/src/objclass/objclass.h @@ -81,8 +81,7 @@ protected: public: PGLSFilter(); virtual ~PGLSFilter(); - virtual bool filter(const hobject_t &obj, ceph::buffer::list& xattr_data, - ceph::buffer::list& outdata) = 0; + virtual bool filter(const hobject_t &obj, ceph::buffer::list& xattr_data) = 0; /** * Arguments passed from the RADOS client. Implementations must diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 0d4787cd2a8a1..be6050df6c52a 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -776,12 +776,10 @@ public: return 0; } ~PGLSPlainFilter() override {} - bool filter(const hobject_t &obj, bufferlist& xattr_data, - bufferlist& outdata) override; + bool filter(const hobject_t &obj, bufferlist& xattr_data) override; }; -bool PGLSPlainFilter::filter(const hobject_t &obj, - bufferlist& xattr_data, bufferlist& outdata) +bool PGLSPlainFilter::filter(const hobject_t &obj, bufferlist& xattr_data) { if (val.size() != xattr_data.length()) return false; @@ -792,7 +790,7 @@ bool PGLSPlainFilter::filter(const hobject_t &obj, return true; } -bool PrimaryLogPG::pgls_filter(PGLSFilter *filter, hobject_t& sobj, bufferlist& outdata) +bool PrimaryLogPG::pgls_filter(PGLSFilter* filter, hobject_t& sobj) { bufferlist bl; @@ -810,7 +808,7 @@ bool PrimaryLogPG::pgls_filter(PGLSFilter *filter, hobject_t& sobj, bufferlist& } } - return filter->filter(sobj, bl, outdata); + return filter->filter(sobj, bl); } int PrimaryLogPG::get_pgls_filter(bufferlist::const_iterator& iter, PGLSFilter **pfilter) @@ -1036,7 +1034,6 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) int result = 0; string cname, mname; PGLSFilter *filter = NULL; - bufferlist filter_out; snapid_t snapid = m->get_snapid(); @@ -1182,7 +1179,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) candidate.get_namespace() != m->get_hobj().nspace) continue; - if (filter && !pgls_filter(filter, candidate, filter_out)) + if (filter && !pgls_filter(filter, candidate)) continue; dout(20) << "pgnls item 0x" << std::hex @@ -1211,8 +1208,6 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) } dout(10) << "pgnls handle=" << response.handle << dendl; encode(response, osd_op.outdata); - if (filter) - encode(filter_out, osd_op.outdata); dout(10) << " pgnls result=" << result << " outdata.length()=" << osd_op.outdata.length() << dendl; } @@ -1332,7 +1327,7 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) if (recovery_state.get_missing_loc().is_deleted(candidate)) continue; - if (filter && !pgls_filter(filter, candidate, filter_out)) + if (filter && !pgls_filter(filter, candidate)) continue; response.entries.push_back(make_pair(candidate.oid, @@ -1345,8 +1340,6 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) } response.handle = next; encode(response, osd_op.outdata); - if (filter) - encode(filter_out, osd_op.outdata); dout(10) << " pgls result=" << result << " outdata.length()=" << osd_op.outdata.length() << dendl; } diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3498a419f13d1..adc93974ce4fa 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1410,7 +1410,7 @@ protected: int do_sparse_read(OpContext *ctx, OSDOp& osd_op); int do_writesame(OpContext *ctx, OSDOp& osd_op); - bool pgls_filter(PGLSFilter *filter, hobject_t& sobj, bufferlist& outdata); + bool pgls_filter(PGLSFilter *filter, hobject_t& sobj); int get_pgls_filter(bufferlist::const_iterator& iter, PGLSFilter **pfilter); map> in_progress_proxy_ops; diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index ec0126a0bc654..9d11a3186e49d 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3798,10 +3798,11 @@ void Objecter::_nlist_reply(NListContext *list_context, int r, auto iter = list_context->bl.cbegin(); pg_nls_response_t response; - ceph::buffer::list extra_info; decode(response, iter); if (!iter.end()) { - decode(extra_info, iter); + // we do this as legacy. + ceph::buffer::list legacy_extra_info; + decode(legacy_extra_info, iter); } // if the osd returns 1 (newer code), or handle MAX, it means we @@ -3828,7 +3829,6 @@ void Objecter::_nlist_reply(NListContext *list_context, int r, << ", response.entries " << response.entries << ", handle " << response.handle << ", tentative new pos " << list_context->pos << dendl; - list_context->extra_info.append(extra_info); if (response_size) { list_context->list.splice(list_context->list.end(), response.entries); } @@ -5156,11 +5156,12 @@ void Objecter::_enumerate_reply( auto iter = bl.cbegin(); pg_nls_response_t response; - // XXX extra_info doesn't seem used anywhere? - ceph::buffer::list extra_info; decode(response, iter); if (!iter.end()) { - decode(extra_info, iter); + // extra_info isn't used anywhere. We do this solely to preserve + // backward compatibility + ceph::buffer::list legacy_extra_info; + decode(legacy_extra_info, iter); } ldout(cct, 10) << __func__ << ": got " << response.entries.size() diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 292fd918cfade..b0ddfe81efb4f 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1610,8 +1610,6 @@ public: ceph::buffer::list filter; - ceph::buffer::list extra_info; - // The budget associated with this context, once it is set (>= 0), // the budget is not get/released on OP basis, instead the budget // is acquired before sending the first OP and released upon receiving -- 2.39.5