]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MPGStats.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.
15 #ifndef CEPH_MPGSTATS_H
16 #define CEPH_MPGSTATS_H
18 #include "osd/osd_types.h"
19 #include "messages/PaxosServiceMessage.h"
21 class MPGStats final
: public PaxosServiceMessage
{
22 static constexpr int HEAD_VERSION
= 2;
23 static constexpr int COMPAT_VERSION
= 1;
27 std::map
<pg_t
, pg_stat_t
> pg_stat
;
29 std::map
<int64_t, store_statfs_t
> pool_stat
;
32 MPGStats() : PaxosServiceMessage
{MSG_PGSTATS
, 0, HEAD_VERSION
, COMPAT_VERSION
} {}
33 MPGStats(const uuid_d
& f
, epoch_t e
)
34 : PaxosServiceMessage
{MSG_PGSTATS
, 0, HEAD_VERSION
, COMPAT_VERSION
},
43 std::string_view
get_type_name() const override
{ return "pg_stats"; }
44 void print(std::ostream
& out
) const override
{
45 out
<< "pg_stats(" << pg_stat
.size() << " pgs seq " << osd_stat
.seq
<< " v " << version
<< ")";
48 void encode_payload(uint64_t features
) override
{
51 encode(fsid
, payload
);
52 encode(osd_stat
, payload
, features
);
53 encode(pg_stat
, payload
);
54 encode(epoch
, payload
);
55 encode(utime_t
{}, payload
);
56 encode(pool_stat
, payload
, features
);
58 void decode_payload() override
{
60 auto p
= payload
.cbegin();
64 if (osd_stat
.num_osds
== 0) {
65 // for the benefit of legacy OSDs who don't set this field
66 osd_stat
.num_osds
= 1;
72 if (header
.version
>= 2)