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) 2017 OVH
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_MOSDFORCERECOVERY_H
17 #define CEPH_MOSDFORCERECOVERY_H
19 #include "msg/Message.h"
22 * instruct an OSD to boost/unboost recovery/backfill priority of some or all pg(s)
25 // boost priority of recovery
26 static const int OFR_RECOVERY = 1;
28 // boost priority of backfill
29 static const int OFR_BACKFILL = 2;
31 // cancel priority boost, requeue if necessary
32 static const int OFR_CANCEL = 4;
34 struct MOSDForceRecovery : public Message {
36 static const int HEAD_VERSION = 1;
37 static const int COMPAT_VERSION = 1;
40 vector<pg_t> forced_pgs;
43 MOSDForceRecovery() : Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {}
44 MOSDForceRecovery(const uuid_d& f, char opts) :
45 Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
46 fsid(f), options(opts) {}
47 MOSDForceRecovery(const uuid_d& f, vector<pg_t>& pgs, char opts) :
48 Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
49 fsid(f), forced_pgs(pgs), options(opts) {}
51 ~MOSDForceRecovery() {}
54 const char *get_type_name() const { return "force_recovery"; }
55 void print(ostream& out) const {
56 out << "force_recovery(";
57 if (forced_pgs.empty())
61 if (options & OFR_RECOVERY)
63 if (options & OFR_BACKFILL)
65 if (options & OFR_CANCEL)
70 void encode_payload(uint64_t features) {
71 ::encode(fsid, payload);
72 ::encode(forced_pgs, payload);
73 ::encode(options, payload);
75 void decode_payload() {
76 bufferlist::iterator p = payload.begin();
78 ::decode(forced_pgs, p);
83 #endif /* CEPH_MOSDFORCERECOVERY_H_ */