]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDRepScrub.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef CEPH_MOSDREPSCRUB_H
17 #define CEPH_MOSDREPSCRUB_H
19 #include "MOSDFastDispatchOp.h"
22 * instruct an OSD initiate a replica scrub on a specific PG
25 struct MOSDRepScrub
: public MOSDFastDispatchOp
{
27 static const int HEAD_VERSION
= 9;
28 static const int COMPAT_VERSION
= 6;
30 spg_t pgid
; // PG to scrub
31 eversion_t scrub_from
; // only scrub log entries after scrub_from
32 eversion_t scrub_to
; // last_update_applied when message sent
33 epoch_t map_epoch
= 0, min_epoch
= 0;
34 bool chunky
; // true for chunky scrubs
35 hobject_t start
; // lower bound of scrub, inclusive
36 hobject_t end
; // upper bound of scrub, exclusive
37 bool deep
; // true if scrub should be deep
38 bool allow_preemption
= false;
40 bool high_priority
= false;
42 epoch_t
get_map_epoch() const override
{
45 epoch_t
get_min_epoch() const override
{
48 spg_t
get_spg() const override
{
53 : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB
, HEAD_VERSION
, COMPAT_VERSION
),
57 MOSDRepScrub(spg_t pgid
, eversion_t scrub_to
, epoch_t map_epoch
, epoch_t min_epoch
,
58 hobject_t start
, hobject_t end
, bool deep
,
59 bool preemption
, int prio
, bool highprio
)
60 : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB
, HEAD_VERSION
, COMPAT_VERSION
),
69 allow_preemption(preemption
),
71 high_priority(highprio
) { }
75 ~MOSDRepScrub() override
{}
78 const char *get_type_name() const override
{ return "replica scrub"; }
79 void print(ostream
& out
) const override
{
80 out
<< "replica_scrub(pg: " << pgid
81 << ",from:" << scrub_from
83 << ",epoch:" << map_epoch
<< "/" << min_epoch
84 << ",start:" << start
<< ",end:" << end
85 << ",chunky:" << chunky
87 << ",version:" << header
.version
88 << ",allow_preemption:" << (int)allow_preemption
89 << ",priority=" << priority
90 << (high_priority
? " (high)":"")
94 void encode_payload(uint64_t features
) override
{
95 ::encode(pgid
.pgid
, payload
);
96 ::encode(scrub_from
, payload
);
97 ::encode(scrub_to
, payload
);
98 ::encode(map_epoch
, payload
);
99 ::encode(chunky
, payload
);
100 ::encode(start
, payload
);
101 ::encode(end
, payload
);
102 ::encode(deep
, payload
);
103 ::encode(pgid
.shard
, payload
);
104 ::encode((uint32_t)-1, payload
); // seed
105 ::encode(min_epoch
, payload
);
106 ::encode(allow_preemption
, payload
);
107 ::encode(priority
, payload
);
108 ::encode(high_priority
, payload
);
110 void decode_payload() override
{
111 bufferlist::iterator p
= payload
.begin();
112 ::decode(pgid
.pgid
, p
);
113 ::decode(scrub_from
, p
);
114 ::decode(scrub_to
, p
);
115 ::decode(map_epoch
, p
);
120 ::decode(pgid
.shard
, p
);
125 if (header
.version
>= 7) {
126 ::decode(min_epoch
, p
);
128 min_epoch
= map_epoch
;
130 if (header
.version
>= 8) {
131 ::decode(allow_preemption
, p
);
133 if (header
.version
>= 9) {
134 ::decode(priority
, p
);
135 ::decode(high_priority
, p
);