hobject_t oid;
PrimaryLogPG::OpContext *ctx;
epoch_t last_peering_reset;
- C_gather(PrimaryLogPG *pg_, hobject_t oid_, PrimaryLogPG::OpContext *ctx_, epoch_t lpr_) :
- pg(pg_), oid(oid_), ctx(ctx_), last_peering_reset(lpr_) {}
+ OSDOp *osd_op;
+ C_gather(PrimaryLogPG *pg_, hobject_t oid_, PrimaryLogPG::OpContext *ctx_, epoch_t lpr_, OSDOp *osd_op_) :
+ pg(pg_), oid(oid_), ctx(ctx_), last_peering_reset(lpr_), osd_op(osd_op_) {}
void finish(int r) override {
if (r == -ECANCELED)
return;
if (last_peering_reset != pg->get_last_peering_reset()) {
return;
}
- pg->cls_gather_set_result(p, r);
+ osd_op->rval = r;
+ pg->cls_gather_ops.erase(p);
pg->execute_ctx(ctx);
}
};
cgop.objecter_tids.push_back(tid);
dout(10) << __func__ << " src=" << oid << ", tgt=" << soid << dendl;
}
-
- C_gather *fin = new C_gather(this, soid, ctx, get_last_peering_reset());
+
+ C_gather *fin = new C_gather(this, soid, ctx, get_last_peering_reset(), &(*ctx->ops)[ctx->current_osd_subop_num]);
gather.set_finisher(new C_OnFinisher(fin,
osd->get_objecter_finisher(get_pg_shard())));
gather.activate();
return -EINPROGRESS;
}
-int PrimaryLogPG::finish_cls_gather(OpContext *ctx)
-{
- ObjectState& obs = ctx->new_obs;
- object_info_t& oi = obs.oi;
- const hobject_t& soid = oi.soid;
- map<hobject_t,PrimaryLogPG::CLSGatherOp>::iterator p = cls_gather_ops.find(soid);
- ceph_assert(p != cls_gather_ops.end());
- int r = p->second.rval;
- cls_gather_ops.erase(p);
- return r;
-}
-
// ========================================================================
// flush
//
// cls gather
//
-void PrimaryLogPG::cls_gather_set_result(map<hobject_t,PrimaryLogPG::CLSGatherOp>::iterator p, int r)
-{
- ceph_assert(p != cls_gather_ops.end());
- p->second.rval = r;
-}
-
void PrimaryLogPG::cancel_cls_gather(map<hobject_t,CLSGatherOp>::iterator iter, bool requeue,
vector<ceph_tid_t> *tids)
{
// -- cls_gather --
std::map<hobject_t, CLSGatherOp> cls_gather_ops;
- void cls_gather_set_result(map<hobject_t,PrimaryLogPG::CLSGatherOp>::iterator p, int r);
void cancel_cls_gather(map<hobject_t,CLSGatherOp>::iterator iter, bool requeue, std::vector<ceph_tid_t> *tids);
void cancel_cls_gather_ops(bool requeue, std::vector<ceph_tid_t> *tids);
void do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn);
int start_cls_gather(OpContext *ctx, std::map<std::string, bufferlist> *src_objs, const std::string& pool,
const char *cls, const char *method, bufferlist& inbl);
- int finish_cls_gather(OpContext *ctx);
private:
int do_scrub_ls(const MOSDOp *op, OSDOp *osd_op);
struct GatherFinisher : public PrimaryLogPG::OpFinisher {
std::map<std::string, bufferlist> src_obj_buffs;
+ OSDOp *osd_op;
+ GatherFinisher(OSDOp *osd_op_) : osd_op(osd_op_) {}
int execute() override {
return 0;
}
const char *cls, const char *method, bufferlist& inbl)
{
PrimaryLogPG::OpContext **pctx = (PrimaryLogPG::OpContext**)hctx;
- auto [iter, inserted] = (*pctx)->op_finishers.emplace(std::make_pair((*pctx)->current_osd_subop_num, std::make_unique<GatherFinisher>()));
+ int subop_num = (*pctx)->current_osd_subop_num;
+ OSDOp *osd_op = &(*(*pctx)->ops)[subop_num];
+ auto [iter, inserted] = (*pctx)->op_finishers.emplace(std::make_pair(subop_num, std::make_unique<GatherFinisher>(osd_op)));
assert(inserted);
auto &gather = *static_cast<GatherFinisher*>(iter->second.get());
for (const auto &obj : src_objs) {
} else {
GatherFinisher *gf = (GatherFinisher*)op_finisher;
*results = gf->src_obj_buffs;
- r = (*pctx)->pg->finish_cls_gather(*pctx);
+ r = gf->osd_op->rval;
}
return r;
}