From 1976d67ce23da6977ad89548503e3b6e98642c23 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 5 Jun 2025 14:15:01 -0400 Subject: [PATCH] rgw/lc: remove WorkQ* args these were only used to log the WorkQ's thread name, which will no longer be relevant with coroutines Signed-off-by: Casey Bodley --- src/rgw/rgw_lc.cc | 118 ++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 71 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index aa6c713391b..e9f4fca9f07 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -504,7 +504,6 @@ struct lc_op_ctx { std::unique_ptr obj; RGWObjectCtx octx; const DoutPrefixProvider *dpp; - WorkQ* wq; std::unique_ptr tier; @@ -512,11 +511,11 @@ struct lc_op_ctx { boost::optional next_key_name, uint64_t num_noncurrent, ceph::real_time effective_mtime, - const DoutPrefixProvider *dpp, WorkQ* wq) + const DoutPrefixProvider *dpp) : cct(env.driver->ctx()), env(env), o(o), next_key_name(next_key_name), num_noncurrent(num_noncurrent), effective_mtime(effective_mtime), driver(env.driver), bucket(env.bucket), op(env.op), ol(env.ol), - octx(env.driver), dpp(dpp), wq(wq) + octx(env.driver), dpp(dpp) { obj = bucket->get_object(o.key); /* once bucket versioning is enabled, the non-current entries with @@ -759,7 +758,7 @@ public: void build(); void update(); int process(rgw_bucket_dir_entry& o, const DoutPrefixProvider *dpp, - WorkQ* wq, optional_yield y); + optional_yield y); }; /* LCOpRule */ using WorkItem = @@ -774,7 +773,7 @@ class WorkQ : public Thread { public: using unique_lock = std::unique_lock; - using work_f = std::function; + using work_f = std::function; using dequeue_result = std::list; static constexpr uint32_t FLAG_NONE = 0x0000; @@ -783,7 +782,7 @@ public: static constexpr uint32_t FLAG_EDRAIN_SYNC = 0x0004; private: - const work_f bsf = [](RGWLC::LCWorker* wk, WorkQ* wq, WorkItem& wi, optional_yield) {}; + const work_f bsf = [](RGWLC::LCWorker* wk, WorkItem& wi, optional_yield) {}; RGWLC::LCWorker* wk; uint32_t qmax; int ix; @@ -864,7 +863,7 @@ private: boost::asio::spawn(context, [&](boost::asio::yield_context yield) { try { optional_yield y(yield); - f(wk, this, item, y); + f(wk, item, y); } catch (const std::exception& e) { ldpp_dout(wk->dpp, 0) << "Coroutine error: " << e.what() << dendl; } @@ -957,7 +956,7 @@ int RGWLC::handle_multipart_expiration(rgw::sal::Bucket* target, params.ns = RGW_OBJ_NS_MULTIPART; params.access_list_filter = MultipartMetaFilter; - auto pf = [&](RGWLC::LCWorker *wk, WorkQ *wq, WorkItem &wi, optional_yield y) { + auto pf = [&](RGWLC::LCWorker *wk, WorkItem &wi, optional_yield y) { int ret{0}; auto wt = std::get>(wi); auto& [rule, obj] = wt; @@ -989,13 +988,11 @@ int RGWLC::handle_multipart_expiration(rgw::sal::Bucket* target, } else { if (ret == -ERR_NO_SUCH_UPLOAD) { ldpp_dout(wk->get_lc(), 5) << "ERROR: abort_multipart_upload " - "failed, ret=" - << ret << ", thread:" << wq->thr_name() + "failed, ret=" << ret << ", meta:" << obj.key << dendl; } else { ldpp_dout(wk->get_lc(), 0) << "ERROR: abort_multipart_upload " - "failed, ret=" - << ret << ", thread:" << wq->thr_name() + "failed, ret=" << ret << ", meta:" << obj.key << dendl; } } /* abort failed */ @@ -1118,7 +1115,7 @@ static int check_tags(const DoutPrefixProvider *dpp, lc_op_ctx& oc, bool *skip, if (ret < 0) { if (ret != -ENODATA) { ldpp_dout(oc.dpp, 5) << "ERROR: read_obj_tags returned r=" - << ret << " " << oc.wq->thr_name() << dendl; + << ret << dendl; } return 0; } @@ -1127,16 +1124,15 @@ static int check_tags(const DoutPrefixProvider *dpp, lc_op_ctx& oc, bool *skip, auto iter = tags_bl.cbegin(); dest_obj_tags.decode(iter); } catch (buffer::error& err) { - ldpp_dout(oc.dpp,0) << "ERROR: caught buffer::error, couldn't decode TagSet " - << oc.wq->thr_name() << dendl; + ldpp_dout(oc.dpp,0) << "ERROR: caught buffer::error, couldn't decode TagSet" + << dendl; return -EIO; } if (! has_all_tags(op, dest_obj_tags)) { ldpp_dout(oc.dpp, 20) << __func__ << "() skipping obj " << oc.obj << " as tags do not match in rule: " - << op.id << " " - << oc.wq->thr_name() << dendl; + << op.id << dendl; return 0; } } @@ -1161,8 +1157,7 @@ public: return false; } ldpp_dout(oc.dpp, 0) << "ERROR: check_tags on obj=" << oc.obj - << " returned ret=" << ret << " " - << oc.wq->thr_name() << dendl; + << " returned ret=" << ret << dendl; return false; } @@ -1178,20 +1173,20 @@ public: auto& o = oc.o; if (!o.is_current()) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": not current, skipping " - << oc.wq->thr_name() << dendl; + << ": not current, skipping" + << dendl; return false; } if (o.is_delete_marker()) { if (oc.next_has_same_name(o.key.name)) { ldpp_dout(dpp, 7) << __func__ << "(): dm-check SAME: key=" << o.key - << " next_key_name: %%" << *oc.next_key_name << "%% " - << oc.wq->thr_name() << dendl; + << " next_key_name: %%" << *oc.next_key_name << "%%" + << dendl; return false; } ldpp_dout(dpp, 7) << __func__ << "(): dm-check DELE: key=" << o.key - << " " << oc.wq->thr_name() << dendl; + << dendl; // go on to compare mtime, size, etc } @@ -1202,8 +1197,8 @@ public: if (op.expiration <= 0) { if (op.expiration_date == boost::none) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": no expiration set in rule, skipping " - << oc.wq->thr_name() << dendl; + << ": no expiration set in rule, skipping" + << dendl; return false; } is_expired = ceph_clock_now() >= @@ -1217,8 +1212,7 @@ public: ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": is_expired=" << (int)is_expired << " size_check_p: " - << size_check_p << " " - << oc.wq->thr_name() << dendl; + << size_check_p << dendl; return is_expired && size_check_p; } @@ -1234,13 +1228,11 @@ public: if (r < 0) { ldpp_dout(oc.dpp, 0) << "ERROR: current is-dm remove_expired_obj " << oc.bucket << ":" << o.key - << " " << cpp_strerror(r) << " " - << oc.wq->thr_name() << dendl; + << " " << cpp_strerror(r) << dendl; return r; } ldpp_dout(oc.dpp, 2) << "DELETED: current is-dm " - << oc.bucket << ":" << o.key - << " " << oc.wq->thr_name() << dendl; + << oc.bucket << ":" << o.key << dendl; } else { /* ! o.is_delete_marker() */ r = remove_expired_obj(oc.dpp, y, oc, !oc.bucket->versioning_enabled(), @@ -1249,15 +1241,14 @@ public: if (r < 0) { ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj " << oc.bucket << ":" << o.key - << " " << cpp_strerror(r) << " " - << oc.wq->thr_name() << dendl; + << " " << cpp_strerror(r) << dendl; return r; } if (perfcounter) { perfcounter->inc(l_rgw_lc_expire_current, 1); } ldpp_dout(oc.dpp, 2) << "DELETED:" << oc.bucket << ":" << o.key - << " " << oc.wq->thr_name() << dendl; + << dendl; } return 0; } @@ -1273,8 +1264,7 @@ public: auto& o = oc.o; if (o.is_current()) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": current version, skipping " - << oc.wq->thr_name() << dendl; + << ": current version, skipping" << dendl; return false; } @@ -1288,8 +1278,7 @@ public: << is_expired << " " << ": num_noncurrent=" << oc.num_noncurrent << " size_check_p: " << size_check_p << " newer_noncurrent_p: " - << newer_noncurrent_p << " " - << oc.wq->thr_name() << dendl; + << newer_noncurrent_p << dendl; return is_expired && (oc.num_noncurrent > oc.op.newer_noncurrent) && size_check_p && @@ -1304,16 +1293,14 @@ public: if (r < 0) { ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj (non-current expiration) " << oc.bucket << ":" << o.key - << " " << cpp_strerror(r) - << " " << oc.wq->thr_name() << dendl; + << " " << cpp_strerror(r) << dendl; return r; } if (perfcounter) { perfcounter->inc(l_rgw_lc_expire_noncurrent, 1); } ldpp_dout(oc.dpp, 2) << "DELETED:" << oc.bucket << ":" << o.key - << " (non-current expiration) " - << oc.wq->thr_name() << dendl; + << " (non-current expiration)" << dendl; return 0; } }; @@ -1326,8 +1313,7 @@ public: auto& o = oc.o; if (!o.is_delete_marker()) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": not a delete marker, skipping " - << oc.wq->thr_name() << dendl; + << ": not a delete marker, skipping" << dendl; return false; } /* don't remove the delete marker if that would expose a non-current @@ -1335,7 +1321,7 @@ public: if (oc.next_has_same_name(o.key.name)) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": dm expiration would expose a non-current version, skipping " - << oc.wq->thr_name() << dendl; + << dendl; return false; } *exp_time = real_clock::now(); @@ -1352,7 +1338,6 @@ public: ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj (delete marker expiration) " << oc.bucket << ":" << o.key << " " << cpp_strerror(r) - << " " << oc.wq->thr_name() << dendl; return r; } @@ -1360,8 +1345,7 @@ public: perfcounter->inc(l_rgw_lc_expire_dm, 1); } ldpp_dout(oc.dpp, 2) << "DELETED:" << oc.bucket << ":" << o.key - << " (delete marker expiration) " - << oc.wq->thr_name() << dendl; + << " (delete marker expiration)" << dendl; return 0; } }; @@ -1393,8 +1377,8 @@ public: if (transition.days < 0) { if (transition.date == boost::none) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": no transition day/date set in rule, skipping " - << oc.wq->thr_name() << dendl; + << ": no transition day/date set in rule, skipping" + << dendl; return false; } is_expired = ceph_clock_now() >= @@ -1408,8 +1392,7 @@ public: ldpp_dout(oc.dpp, 20) << __func__ << "(): key=" << o.key << ": is_expired=" << is_expired << " " << " size_check_p: " - << size_check_p << " " - << oc.wq->thr_name() << dendl; + << size_check_p << dendl; need_to_process = (rgw_placement_rule::get_canonical_storage_class(o.meta.storage_class) != @@ -1587,8 +1570,7 @@ public: ldpp_dout(oc.dpp, 0) << "ERROR: non existent dest placement: " << target_placement << " bucket="<< oc.bucket - << " rule_id=" << oc.op.id - << " " << oc.wq->thr_name() << dendl; + << " rule_id=" << oc.op.id << dendl; return -EINVAL; } @@ -1600,8 +1582,7 @@ public: ldpp_dout(oc.dpp, 0) << "ERROR: failed to transition obj " << oc.bucket << ":" << o.key << " -> " << transition.storage_class - << " " << cpp_strerror(r) - << " " << oc.wq->thr_name() << dendl; + << " " << cpp_strerror(r) << dendl; return r; } } @@ -1617,8 +1598,7 @@ public: ldpp_dout(oc.dpp, 2) << "TRANSITIONED:" << oc.bucket << ":" << o.key << " -> " - << transition.storage_class - << " " << oc.wq->thr_name() << dendl; + << transition.storage_class << dendl; return 0; } }; @@ -1708,9 +1688,9 @@ void LCOpRule::update() int LCOpRule::process(rgw_bucket_dir_entry& o, const DoutPrefixProvider *dpp, - WorkQ* wq, optional_yield y) + optional_yield y) { - lc_op_ctx ctx(env, o, next_key_name, num_noncurrent, effective_mtime, dpp, wq); + lc_op_ctx ctx(env, o, next_key_name, num_noncurrent, effective_mtime, dpp); shared_ptr *selected = nullptr; // n.b., req'd by sharing real_time exp; @@ -1747,8 +1727,7 @@ int LCOpRule::process(rgw_bucket_dir_entry& o, if (!cont) { ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key - << ": no rule match, skipping " - << wq->thr_name() << dendl; + << ": no rule match, skipping" << dendl; return 0; } @@ -1756,12 +1735,11 @@ int LCOpRule::process(rgw_bucket_dir_entry& o, if (r < 0) { ldpp_dout(dpp, 0) << "ERROR: remove_expired_obj " << env.bucket << ":" << o.key - << " " << cpp_strerror(r) - << " " << wq->thr_name() << dendl; + << " " << cpp_strerror(r) << dendl; return r; } ldpp_dout(dpp, 20) << "processed:" << env.bucket << ":" - << o.key << " " << wq->thr_name() << dendl; + << o.key << dendl; } return 0; @@ -1830,19 +1808,17 @@ int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker, /* fetch information for zone checks */ rgw::sal::Zone* zone = driver->get_zone(); - auto pf = [&bucket_name](RGWLC::LCWorker* wk, WorkQ* wq, WorkItem& wi, optional_yield y) { + auto pf = [&bucket_name](RGWLC::LCWorker* wk, WorkItem& wi, optional_yield y) { auto wt = std::get>(wi); auto& [op_rule, o] = wt; ldpp_dout(wk->get_lc(), 20) - << __func__ << "(): key=" << o.key << wq->thr_name() - << dendl; - int ret = op_rule.process(o, wk->dpp, wq, y); + << __func__ << "(): key=" << o.key << dendl; + int ret = op_rule.process(o, wk->dpp, y); if (ret < 0) { ldpp_dout(wk->get_lc(), 20) << "ERROR: orule.process() returned ret=" << ret - << " thread=" << wq->thr_name() << " bucket=" << bucket_name << dendl; } -- 2.39.5