mirror of
https://github.com/ceph/ceph
synced 2025-02-22 02:27:29 +00:00
Merge pull request #43056 from Matan-B/wip-matanb-scrub-passkey
osd: Replacing friend declarations for passkey interface Reviewed-by: Ronen Friedman <rfriedma@redhat.com> Reviewed-by: Josh Durgin <jdurgin@redhat.com> Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
commit
93212e34f6
24
src/osd/PG.h
24
src/osd/PG.h
@ -161,12 +161,20 @@ class PGRecoveryStats {
|
||||
*
|
||||
*/
|
||||
|
||||
/// Facilitating scrub-realated object access to private PG data
|
||||
class ScrubberPasskey {
|
||||
private:
|
||||
friend class Scrub::ReplicaReservations;
|
||||
friend class PrimaryLogScrub;
|
||||
ScrubberPasskey() {}
|
||||
ScrubberPasskey(const ScrubberPasskey&) = default;
|
||||
ScrubberPasskey& operator=(const ScrubberPasskey&) = delete;
|
||||
};
|
||||
|
||||
class PG : public DoutPrefixProvider, public PeeringState::PeeringListener {
|
||||
friend struct NamedState;
|
||||
friend class PeeringState;
|
||||
friend class PgScrubber;
|
||||
friend class PrimaryLogScrub;
|
||||
friend class Scrub::ReplicaReservations;
|
||||
friend class Scrub::LocalReservation; // dout()-only friendship
|
||||
friend class Scrub::ReservedByRemotePrimary; // dout()-only friendship
|
||||
|
||||
@ -1330,6 +1338,18 @@ protected:
|
||||
|
||||
// ref to recovery_state.info
|
||||
const pg_info_t &info;
|
||||
|
||||
|
||||
// ScrubberPasskey getters:
|
||||
public:
|
||||
const pg_info_t& get_pg_info(ScrubberPasskey) const {
|
||||
return info;
|
||||
}
|
||||
|
||||
OSDService* get_pg_osd(ScrubberPasskey) const {
|
||||
return osd;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "PrimaryLogPG.h"
|
||||
#include "scrub_machine.h"
|
||||
|
||||
#define dout_context (m_pg->cct)
|
||||
#define dout_context (m_pg->get_cct())
|
||||
#define dout_subsys ceph_subsys_osd
|
||||
#undef dout_prefix
|
||||
#define dout_prefix _prefix(_dout, this->m_pg)
|
||||
@ -43,7 +43,7 @@ bool PrimaryLogScrub::get_store_errors(const scrub_ls_arg_t& arg,
|
||||
|
||||
void PrimaryLogScrub::_scrub_finish()
|
||||
{
|
||||
auto& info = m_pg->info; ///< a temporary alias
|
||||
auto& info = m_pg->get_pg_info(ScrubberPasskey{}); ///< a temporary alias
|
||||
|
||||
dout(10) << __func__
|
||||
<< " info stats: " << (info.stats.stats_invalid ? "invalid" : "valid")
|
||||
|
@ -30,7 +30,7 @@ using namespace std::chrono;
|
||||
using namespace std::chrono_literals;
|
||||
using namespace std::literals;
|
||||
|
||||
#define dout_context (m_pg->cct)
|
||||
#define dout_context (m_pg->get_cct())
|
||||
#define dout_subsys ceph_subsys_osd
|
||||
#undef dout_prefix
|
||||
#define dout_prefix _prefix(_dout, this->m_pg)
|
||||
@ -2124,7 +2124,7 @@ namespace Scrub {
|
||||
|
||||
void ReplicaReservations::release_replica(pg_shard_t peer, epoch_t epoch)
|
||||
{
|
||||
auto m = new MOSDScrubReserve(spg_t(m_pg->info.pgid.pgid, peer.shard), epoch,
|
||||
auto m = new MOSDScrubReserve(spg_t(m_pg_info.pgid.pgid, peer.shard), epoch,
|
||||
MOSDScrubReserve::RELEASE, m_pg->pg_whoami);
|
||||
m_osds->send_message_osd_cluster(peer.osd, m, epoch);
|
||||
}
|
||||
@ -2132,8 +2132,9 @@ void ReplicaReservations::release_replica(pg_shard_t peer, epoch_t epoch)
|
||||
ReplicaReservations::ReplicaReservations(PG* pg, pg_shard_t whoami)
|
||||
: m_pg{pg}
|
||||
, m_acting_set{pg->get_actingset()}
|
||||
, m_osds{m_pg->osd}
|
||||
, m_osds{m_pg->get_pg_osd(ScrubberPasskey())}
|
||||
, m_pending{static_cast<int>(m_acting_set.size()) - 1}
|
||||
, m_pg_info{m_pg->get_pg_info(ScrubberPasskey())}
|
||||
{
|
||||
epoch_t epoch = m_pg->get_osdmap_epoch();
|
||||
|
||||
@ -2147,7 +2148,7 @@ ReplicaReservations::ReplicaReservations(PG* pg, pg_shard_t whoami)
|
||||
for (auto p : m_acting_set) {
|
||||
if (p == whoami)
|
||||
continue;
|
||||
auto m = new MOSDScrubReserve(spg_t(m_pg->info.pgid.pgid, p.shard), epoch,
|
||||
auto m = new MOSDScrubReserve(spg_t(m_pg_info.pgid.pgid, p.shard), epoch,
|
||||
MOSDScrubReserve::REQUEST, m_pg->pg_whoami);
|
||||
m_osds->send_message_osd_cluster(p.osd, m, epoch);
|
||||
m_waited_for_peers.push_back(p);
|
||||
|
@ -45,6 +45,7 @@ class ReplicaReservations {
|
||||
std::vector<pg_shard_t> m_reserved_peers;
|
||||
bool m_had_rejections{false};
|
||||
int m_pending{-1};
|
||||
const pg_info_t& m_pg_info;
|
||||
|
||||
void release_replica(pg_shard_t peer, epoch_t epoch);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user