Skip to content

Commit

Permalink
Merge pull request ceph#29675 from tchaikov/wip-remove-parent-pgls-fi…
Browse files Browse the repository at this point in the history
…lter

osd/PrimaryLogPG: remove unused "parent" pgls-filter

Reviewed-by: Patrick Donnelly <[email protected]>
  • Loading branch information
tchaikov authored Aug 16, 2019
2 parents ebdf419 + f74318e commit 2b4b397
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 78 deletions.
6 changes: 2 additions & 4 deletions src/cls/cephfs/cls_cephfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,10 @@ class PGLSCephFSFilter : public PGLSFilter {

~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;
Expand Down
3 changes: 1 addition & 2 deletions src/cls/hello/cls_hello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ class PGLSHelloFilter : public PGLSFilter {
}

~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;
Expand Down
3 changes: 1 addition & 2 deletions src/objclass/objclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class PGLSFilter {
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
Expand Down
68 changes: 7 additions & 61 deletions src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,57 +776,10 @@ class PGLSPlainFilter : public PGLSFilter {
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;
};

class PGLSParentFilter : public PGLSFilter {
inodeno_t parent_ino;
public:
CephContext* cct;
explicit PGLSParentFilter(CephContext* cct) : cct(cct) {
xattr = "_parent";
}
int init(bufferlist::const_iterator &params) override
{
try {
decode(parent_ino, params);
} catch (buffer::error &e) {
return -EINVAL;
}
generic_dout(0) << "parent_ino=" << parent_ino << dendl;

return 0;
}
~PGLSParentFilter() override {}
bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata) override;
};

bool PGLSParentFilter::filter(const hobject_t &obj,
bufferlist& xattr_data, bufferlist& outdata)
{
auto iter = xattr_data.cbegin();
inode_backtrace_t bt;

generic_dout(0) << "PGLSParentFilter::filter" << dendl;

decode(bt, iter);

vector<inode_backpointer_t>::iterator vi;
for (vi = bt.ancestors.begin(); vi != bt.ancestors.end(); ++vi) {
generic_dout(0) << "vi->dirino=" << vi->dirino << " parent_ino=" << parent_ino << dendl;
if (vi->dirino == parent_ino) {
encode(*vi, outdata);
return true;
}
}

return false;
}

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;
Expand All @@ -837,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;

Expand All @@ -855,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)
Expand All @@ -870,9 +823,7 @@ int PrimaryLogPG::get_pgls_filter(bufferlist::const_iterator& iter, PGLSFilter *
return -EINVAL;
}

if (type.compare("parent") == 0) {
filter = new PGLSParentFilter(cct);
} else if (type.compare("plain") == 0) {
if (type.compare("plain") == 0) {
filter = new PGLSPlainFilter();
} else {
std::size_t dot = type.find(".");
Expand Down Expand Up @@ -1083,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();

Expand Down Expand Up @@ -1229,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
Expand Down Expand Up @@ -1258,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;
}
Expand Down Expand Up @@ -1379,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,
Expand All @@ -1392,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/osd/PrimaryLogPG.h
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
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<hobject_t, list<OpRequestRef>> in_progress_proxy_ops;
Expand Down
13 changes: 7 additions & 6 deletions src/osdc/Objecter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3799,10 +3799,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
Expand All @@ -3829,7 +3830,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);
}
Expand Down Expand Up @@ -5157,11 +5157,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()
Expand Down
2 changes: 0 additions & 2 deletions src/osdc/Objecter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1610,8 +1610,6 @@ class Objecter : public md_config_obs_t, public Dispatcher {

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
Expand Down

0 comments on commit 2b4b397

Please sign in to comment.