#include "cls_fifo_legacy.h"
namespace rgw::cls::fifo {
-static constexpr auto dout_subsys = ceph_subsys_objclass;
namespace cb = ceph::buffer;
namespace fifo = rados::cls::fifo;
}
auto pos = s.find(':');
- if (pos == string::npos) {
+ if (pos == s.npos) {
return std::nullopt;
}
}
-int FIFO::apply_update(fifo::info* info,
+int FIFO::apply_update(const DoutPrefixProvider *dpp,
+ fifo::info* info,
const fifo::objv& objv,
const fifo::update& update,
std::uint64_t tid)
{
- ldout(cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " entering: tid=" << tid << dendl;
std::unique_lock l(m);
if (objv != info->version) {
- lderr(cct) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " version mismatch, canceling: tid=" << tid << dendl;
return -ECANCELED;
}
auto err = info->apply_update(update);
if (err) {
- lderr(cct) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " error applying update: " << *err << " tid=" << tid << dendl;
return -ECANCELED;
}
if (r >= 0 || r == -ECANCELED) {
canceled = (r == -ECANCELED);
if (!canceled) {
- r = apply_update(&info, version, update, tid);
+ r = apply_update(dpp, &info, version, update, tid);
if (r < 0) canceled = true;
}
if (canceled) {
ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " entering: tid=" << tid << dendl;
if (reread)
- handle_reread(std::move(p), r);
+ handle_reread(dpp, std::move(p), r);
else
handle_update(dpp, std::move(p), r);
}
}
bool canceled = (r == -ECANCELED);
if (!canceled) {
- int r = fifo->apply_update(&fifo->info, version, update, tid);
+ int r = fifo->apply_update(dpp, &fifo->info, version, update, tid);
if (r < 0) {
ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " update failed, marking canceled: r=" << r
complete(std::move(p), 0);
}
- void handle_reread(Ptr&& p, int r) {
- ldout(fifo->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ void handle_reread(const DoutPrefixProvider *dpp, Ptr&& p, int r) {
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " handling async read_meta: tid="
<< tid << dendl;
if (r < 0 && pcanceled) {
*pcanceled = true;
}
if (r < 0) {
- lderr(fifo->cct) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " failed dispatching read_meta: r=" << r << " tid="
<< tid << dendl;
} else {
- ldout(fifo->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " completing: tid=" << tid << dendl;
}
complete(std::move(p), r);
return 0;
}
-void FIFO::trim_part(int64_t part_num, uint64_t ofs,
+void FIFO::trim_part(const DoutPrefixProvider *dpp, int64_t part_num, uint64_t ofs,
std::optional<std::string_view> tag,
bool exclusive, std::uint64_t tid,
lr::AioCompletion* c)
{
- ldout(cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " entering: tid=" << tid << dendl;
lr::ObjectWriteOperation op;
std::unique_lock l(m);
std::uint32_t _phs;
std::uint32_t _peo;
- auto r = get_meta(dpp, ioctx, oid, nullopt, &_info, &_phs, &_peo, tid, y);
+ auto r = get_meta(dpp, ioctx, oid, std::nullopt, &_info, &_phs, &_peo, tid, y);
if (r < 0) {
ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " get_meta failed: r=" << r << " tid=" << tid << dendl;
std::uint64_t tid;
bool new_heading = false;
- void prep_then_push(Ptr&& p, const unsigned successes) {
+ void prep_then_push(const DoutPrefixProvider *dpp, Ptr&& p, const unsigned successes) {
std::unique_lock l(f->m);
auto max_part_size = f->info.params.max_part_size;
auto part_entry_overhead = f->part_entry_overhead;
l.unlock();
- ldout(f->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " preparing push: remaining=" << remaining.size()
<< " batch=" << batch.size() << " i=" << i
<< " tid=" << tid << dendl;
batch.push_back(std::move(remaining.front()));
remaining.pop_front();
}
- ldout(f->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " prepared push: remaining=" << remaining.size()
<< " batch=" << batch.size() << " i=" << i
<< " batch_len=" << batch_len
return;
}
i = 0; // We've made forward progress, so reset the race counter!
- prep_then_push(std::move(p), r);
+ prep_then_push(dpp, std::move(p), r);
} else {
if (r < 0) {
ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
return;
}
new_heading = false;
- handle_new_head(std::move(p), r);
+ handle_new_head(dpp, std::move(p), r);
}
}
- void handle_new_head(Ptr&& p, int r) {
+ void handle_new_head(const DoutPrefixProvider *dpp, Ptr&& p, int r) {
if (r == -ECANCELED) {
if (p->i == MAX_RACE_RETRIES) {
- lderr(f->cct) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " canceled too many times, giving up: tid=" << tid << dendl;
complete(std::move(p), -ECANCELED);
return;
}
if (p->batch.empty()) {
- prep_then_push(std::move(p), 0);
+ prep_then_push(dpp, std::move(p), 0);
return;
} else {
push(std::move(p));
<< " need new head tid=" << tid << dendl;
p->new_head(dpp, std::move(p));
} else {
- p->prep_then_push(std::move(p), 0);
+ p->prep_then_push(dpp, std::move(p), 0);
}
}
if (pn < part_num) {
ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " pn=" << pn << " tid=" << tid << dendl;
- fifo->trim_part(pn++, max_part_size, std::nullopt,
+ fifo->trim_part(dpp, pn++, max_part_size, std::nullopt,
false, tid, call(std::move(p)));
} else {
update = true;
canceled = tail_part_num < part_num;
- fifo->trim_part(part_num, ofs, std::nullopt, exclusive, tid,
+ fifo->trim_part(dpp, part_num, ofs, std::nullopt, exclusive, tid,
call(std::move(p)));
}
return;
std::unique_lock l(fifo->m);
const auto max_part_size = fifo->info.params.max_part_size;
l.unlock();
- fifo->trim_part(pn++, max_part_size, std::nullopt,
+ fifo->trim_part(dpp, pn++, max_part_size, std::nullopt,
false, tid, call(std::move(p)));
return;
}
l.unlock();
update = true;
canceled = tail_part_num < part_num;
- fifo->trim_part(part_num, ofs, std::nullopt, exclusive, tid,
+ fifo->trim_part(dpp, part_num, ofs, std::nullopt, exclusive, tid,
call(std::move(p)));
return;
}
} else {
trimmer->update = true;
}
- trim_part(pn, ofs, std::nullopt, exclusive,
+ trim_part(dpp, pn, ofs, std::nullopt, exclusive,
tid, Trimmer::call(std::move(trimmer)));
}
pp_callback,
} state;
- void create_part(Ptr&& p, int64_t part_num,
+ void create_part(const DoutPrefixProvider *dpp, Ptr&& p, int64_t part_num,
std::string_view tag) {
- ldout(fifo->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " entering: tid=" << tid << dendl;
state = entry_callback;
lr::ObjectWriteOperation op;
return;
}
- void remove_part(Ptr&& p, int64_t part_num,
+ void remove_part(const DoutPrefixProvider *dpp, Ptr&& p, int64_t part_num,
std::string_view tag) {
- ldout(fifo->cct, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, 20) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " entering: tid=" << tid << dendl;
state = entry_callback;
lr::ObjectWriteOperation op;
const auto entry = iter->second;
switch (entry.op) {
case fifo::journal_entry::Op::create:
- create_part(std::move(p), entry.part_num, entry.part_tag);
+ create_part(dpp, std::move(p), entry.part_num, entry.part_tag);
return;
case fifo::journal_entry::Op::set_head:
if (entry.part_num > new_head) {
++iter;
continue;
case fifo::journal_entry::Op::remove:
- remove_part(std::move(p), entry.part_num, entry.part_tag);
+ remove_part(dpp, std::move(p), entry.part_num, entry.part_tag);
return;
default:
- lderr(fifo->cct) << __PRETTY_FUNCTION__ << ":" << __LINE__
+ ldpp_dout(dpp, -1) << __PRETTY_FUNCTION__ << ":" << __LINE__
<< " unknown journaled op: entry=" << entry << " tid="
<< tid << dendl;
complete(std::move(p), -EIO);