]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDRepScrub.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MOSDRepScrub.h
CommitLineData
7c673cae
FG
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) 2004-2006 Sage Weil <sage@newdream.net>
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
16#ifndef CEPH_MOSDREPSCRUB_H
17#define CEPH_MOSDREPSCRUB_H
18
19#include "MOSDFastDispatchOp.h"
20
21/*
22 * instruct an OSD initiate a replica scrub on a specific PG
23 */
24
11fdf7f2
TL
25class MOSDRepScrub : public MessageInstance<MOSDRepScrub, MOSDFastDispatchOp> {
26public:
27 friend factory;
7c673cae 28
11fdf7f2
TL
29 static constexpr int HEAD_VERSION = 9;
30 static constexpr int COMPAT_VERSION = 6;
7c673cae
FG
31
32 spg_t pgid; // PG to scrub
33 eversion_t scrub_from; // only scrub log entries after scrub_from
34 eversion_t scrub_to; // last_update_applied when message sent
d2e6a577 35 epoch_t map_epoch = 0, min_epoch = 0;
7c673cae
FG
36 bool chunky; // true for chunky scrubs
37 hobject_t start; // lower bound of scrub, inclusive
38 hobject_t end; // upper bound of scrub, exclusive
39 bool deep; // true if scrub should be deep
28e407b8
AA
40 bool allow_preemption = false;
41 int32_t priority = 0;
42 bool high_priority = false;
7c673cae
FG
43
44 epoch_t get_map_epoch() const override {
45 return map_epoch;
46 }
47 epoch_t get_min_epoch() const override {
48 return min_epoch;
49 }
50 spg_t get_spg() const override {
51 return pgid;
52 }
53
54 MOSDRepScrub()
11fdf7f2 55 : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION),
7c673cae 56 chunky(false),
28e407b8 57 deep(false) { }
7c673cae
FG
58
59 MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, epoch_t min_epoch,
28e407b8
AA
60 hobject_t start, hobject_t end, bool deep,
61 bool preemption, int prio, bool highprio)
11fdf7f2 62 : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION),
7c673cae
FG
63 pgid(pgid),
64 scrub_to(scrub_to),
65 map_epoch(map_epoch),
66 min_epoch(min_epoch),
67 chunky(true),
68 start(start),
69 end(end),
70 deep(deep),
28e407b8
AA
71 allow_preemption(preemption),
72 priority(prio),
73 high_priority(highprio) { }
7c673cae
FG
74
75
76private:
77 ~MOSDRepScrub() override {}
78
79public:
11fdf7f2 80 std::string_view get_type_name() const override { return "replica scrub"; }
7c673cae 81 void print(ostream& out) const override {
28e407b8
AA
82 out << "replica_scrub(pg: " << pgid
83 << ",from:" << scrub_from
84 << ",to:" << scrub_to
7c673cae
FG
85 << ",epoch:" << map_epoch << "/" << min_epoch
86 << ",start:" << start << ",end:" << end
87 << ",chunky:" << chunky
88 << ",deep:" << deep
28e407b8
AA
89 << ",version:" << header.version
90 << ",allow_preemption:" << (int)allow_preemption
91 << ",priority=" << priority
92 << (high_priority ? " (high)":"")
93 << ")";
7c673cae
FG
94 }
95
96 void encode_payload(uint64_t features) override {
11fdf7f2
TL
97 using ceph::encode;
98 encode(pgid.pgid, payload);
99 encode(scrub_from, payload);
100 encode(scrub_to, payload);
101 encode(map_epoch, payload);
102 encode(chunky, payload);
103 encode(start, payload);
104 encode(end, payload);
105 encode(deep, payload);
106 encode(pgid.shard, payload);
107 encode((uint32_t)-1, payload); // seed
108 encode(min_epoch, payload);
109 encode(allow_preemption, payload);
110 encode(priority, payload);
111 encode(high_priority, payload);
7c673cae
FG
112 }
113 void decode_payload() override {
11fdf7f2
TL
114 auto p = payload.cbegin();
115 decode(pgid.pgid, p);
116 decode(scrub_from, p);
117 decode(scrub_to, p);
118 decode(map_epoch, p);
119 decode(chunky, p);
120 decode(start, p);
121 decode(end, p);
122 decode(deep, p);
123 decode(pgid.shard, p);
28e407b8
AA
124 {
125 uint32_t seed;
11fdf7f2 126 decode(seed, p);
28e407b8 127 }
7c673cae 128 if (header.version >= 7) {
11fdf7f2 129 decode(min_epoch, p);
7c673cae
FG
130 } else {
131 min_epoch = map_epoch;
132 }
28e407b8 133 if (header.version >= 8) {
11fdf7f2 134 decode(allow_preemption, p);
28e407b8
AA
135 }
136 if (header.version >= 9) {
11fdf7f2
TL
137 decode(priority, p);
138 decode(high_priority, p);
28e407b8 139 }
7c673cae
FG
140 }
141};
142
143#endif