Skip to content

Commit 75236e9

Browse files
committed
messages: add MOSDPGPCT
Signed-off-by: Samuel Just <[email protected]>
1 parent f4b0589 commit 75236e9

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

src/messages/MOSDPGPCT.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2024 IBM, Red Hat
7+
*
8+
* This is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License version 2.1, as published by the Free Software
11+
* Foundation. See file COPYING.
12+
*
13+
*/
14+
15+
#pragma once
16+
17+
18+
#include "MOSDFastDispatchOp.h"
19+
20+
class MOSDPGPCT final : public MOSDFastDispatchOp {
21+
private:
22+
static constexpr int HEAD_VERSION = 1;
23+
static constexpr int COMPAT_VERSION = 1;
24+
25+
public:
26+
/// epoch at which the message was sent
27+
epoch_t map_epoch = 0;
28+
29+
/// start epoch of the interval in which the message was sent
30+
epoch_t min_epoch = 0;
31+
32+
/// target pg
33+
spg_t pgid;
34+
35+
/**
36+
* pg_committed_to
37+
*
38+
* Propagates PeeringState::pg_committed_to to replicas as with
39+
* MOSDRepOp, ECSubWrite, MOSDPGPCT.
40+
*/
41+
eversion_t pg_committed_to;
42+
43+
epoch_t get_map_epoch() const override {
44+
return map_epoch;
45+
}
46+
epoch_t get_min_epoch() const override {
47+
return min_epoch;
48+
}
49+
spg_t get_spg() const override {
50+
return pgid;
51+
}
52+
53+
MOSDPGPCT()
54+
: MOSDFastDispatchOp{MSG_OSD_PG_PCT, HEAD_VERSION,
55+
COMPAT_VERSION} {}
56+
MOSDPGPCT(
57+
spg_t pgid,
58+
epoch_t epoch,
59+
epoch_t min_epoch,
60+
eversion_t pg_committed_to)
61+
: MOSDFastDispatchOp{MSG_OSD_PG_PCT, HEAD_VERSION,
62+
COMPAT_VERSION},
63+
map_epoch(epoch),
64+
min_epoch(min_epoch),
65+
pgid(pgid),
66+
pg_committed_to(pg_committed_to)
67+
{}
68+
69+
private:
70+
~MOSDPGPCT() final {}
71+
72+
public:
73+
std::string_view get_type_name() const override { return "PGPCT"; }
74+
void print(std::ostream& out) const override {
75+
out << "pg_pct(" << pgid << " epoch " << map_epoch
76+
<< "/" << min_epoch
77+
<< " pg_committed_to " << pg_committed_to
78+
<< ")";
79+
}
80+
81+
void encode_payload(uint64_t features) override {
82+
using ceph::encode;
83+
encode(map_epoch, payload);
84+
encode(min_epoch, payload);
85+
encode(pgid, payload);
86+
encode(pg_committed_to, payload);
87+
}
88+
void decode_payload() override {
89+
using ceph::decode;
90+
auto p = payload.cbegin();
91+
decode(map_epoch, p);
92+
decode(min_epoch, p);
93+
decode(pgid, p);
94+
decode(pg_committed_to, p);
95+
}
96+
private:
97+
template<class T, typename... Args>
98+
friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
99+
};

src/msg/Message.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@
219219
#include "messages/MOSDPGUpdateLogMissing.h"
220220
#include "messages/MOSDPGUpdateLogMissingReply.h"
221221

222+
#include "messages/MOSDPGPCT.h"
223+
222224
#include "messages/MNVMeofGwBeacon.h"
223225
#include "messages/MNVMeofGwMap.h"
224226

@@ -549,6 +551,9 @@ Message *decode_message(CephContext *cct,
549551
case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY:
550552
m = make_message<MOSDPGUpdateLogMissingReply>();
551553
break;
554+
case MSG_OSD_PG_PCT:
555+
m = make_message<MOSDPGPCT>();
556+
break;
552557
case CEPH_MSG_OSD_BACKOFF:
553558
m = make_message<MOSDBackoff>();
554559
break;

src/msg/Message.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@
136136
#define MSG_OSD_PG_UPDATE_LOG_MISSING 114
137137
#define MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY 115
138138

139+
#define MSG_OSD_PG_PCT 136
140+
139141
#define MSG_OSD_PG_CREATED 116
140142
#define MSG_OSD_REP_SCRUBMAP 117
141143
#define MSG_OSD_PG_RECOVERY_DELETE 118

0 commit comments

Comments
 (0)