osd/osd_types: add num_legacy_snapsets to stats struct

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-02-27 18:50:52 -06:00
parent 7911950d85
commit 3862309d50
2 changed files with 30 additions and 7 deletions

View File

@ -1883,11 +1883,12 @@ void object_stat_sum_t::dump(Formatter *f) const
f->dump_int("num_evict_mode_some", num_evict_mode_some);
f->dump_int("num_evict_mode_full", num_evict_mode_full);
f->dump_int("num_objects_pinned", num_objects_pinned);
f->dump_int("num_legacy_snapsets", num_legacy_snapsets);
}
void object_stat_sum_t::encode(bufferlist& bl) const
{
ENCODE_START(15, 14, bl);
ENCODE_START(16, 14, bl);
#if defined(CEPH_LITTLE_ENDIAN)
bl.append((char *)(&num_bytes), sizeof(object_stat_sum_t));
#else
@ -1925,6 +1926,7 @@ void object_stat_sum_t::encode(bufferlist& bl) const
::encode(num_evict_mode_full, bl);
::encode(num_objects_pinned, bl);
::encode(num_objects_missing, bl);
::encode(num_legacy_snapsets, bl);
#endif
ENCODE_FINISH(bl);
}
@ -1932,9 +1934,9 @@ void object_stat_sum_t::encode(bufferlist& bl) const
void object_stat_sum_t::decode(bufferlist::iterator& bl)
{
bool decode_finish = false;
DECODE_START(15, bl);
DECODE_START(16, bl);
#if defined(CEPH_LITTLE_ENDIAN)
if (struct_v >= 15) {
if (struct_v >= 16) {
bl.copy(sizeof(object_stat_sum_t), (char*)(&num_bytes));
decode_finish = true;
}
@ -1974,6 +1976,11 @@ void object_stat_sum_t::decode(bufferlist::iterator& bl)
::decode(num_evict_mode_full, bl);
::decode(num_objects_pinned, bl);
::decode(num_objects_missing, bl);
if (struct_v >= 16) {
::decode(num_legacy_snapsets, bl);
} else {
num_legacy_snapsets = num_object_clones; // upper bound
}
}
DECODE_FINISH(bl);
}
@ -2052,6 +2059,7 @@ void object_stat_sum_t::add(const object_stat_sum_t& o)
num_evict_mode_some += o.num_evict_mode_some;
num_evict_mode_full += o.num_evict_mode_full;
num_objects_pinned += o.num_objects_pinned;
num_legacy_snapsets += o.num_legacy_snapsets;
}
void object_stat_sum_t::sub(const object_stat_sum_t& o)
@ -2090,6 +2098,7 @@ void object_stat_sum_t::sub(const object_stat_sum_t& o)
num_evict_mode_some -= o.num_evict_mode_some;
num_evict_mode_full -= o.num_evict_mode_full;
num_objects_pinned -= o.num_objects_pinned;
num_legacy_snapsets -= o.num_legacy_snapsets;
}
bool operator==(const object_stat_sum_t& l, const object_stat_sum_t& r)
@ -2128,7 +2137,8 @@ bool operator==(const object_stat_sum_t& l, const object_stat_sum_t& r)
l.num_flush_mode_low == r.num_flush_mode_low &&
l.num_evict_mode_some == r.num_evict_mode_some &&
l.num_evict_mode_full == r.num_evict_mode_full &&
l.num_objects_pinned == r.num_objects_pinned;
l.num_objects_pinned == r.num_objects_pinned &&
l.num_legacy_snapsets == r.num_legacy_snapsets;
}
// -- object_stat_collection_t --

View File

@ -1617,6 +1617,7 @@ struct object_stat_sum_t {
int32_t num_evict_mode_full; // 1 when in evict full mode, otherwise 0
int64_t num_objects_pinned;
int64_t num_objects_missing;
int64_t num_legacy_snapsets; ///< upper bound on pre-luminous-style SnapSets
object_stat_sum_t()
: num_bytes(0),
@ -1644,7 +1645,8 @@ struct object_stat_sum_t {
num_flush_mode_high(0), num_flush_mode_low(0),
num_evict_mode_some(0), num_evict_mode_full(0),
num_objects_pinned(0),
num_objects_missing(0)
num_objects_missing(0),
num_legacy_snapsets(0)
{}
void floor(int64_t f) {
@ -1683,6 +1685,7 @@ struct object_stat_sum_t {
FLOOR(num_evict_mode_some);
FLOOR(num_evict_mode_full);
FLOOR(num_objects_pinned);
FLOOR(num_legacy_snapsets);
#undef FLOOR
}
@ -1693,7 +1696,14 @@ struct object_stat_sum_t {
if (i < (PARAM % out.size())) { \
out[i].PARAM++; \
} \
} \
}
#define SPLIT_PRESERVE_NONZERO(PARAM) \
for (unsigned i = 0; i < out.size(); ++i) { \
if (PARAM) \
out[i].PARAM = 1 + PARAM / out.size(); \
else \
out[i].PARAM = 0; \
}
SPLIT(num_bytes);
SPLIT(num_objects);
@ -1729,7 +1739,9 @@ struct object_stat_sum_t {
SPLIT(num_evict_mode_some);
SPLIT(num_evict_mode_full);
SPLIT(num_objects_pinned);
SPLIT_PRESERVE_NONZERO(num_legacy_snapsets);
#undef SPLIT
#undef SPLIT_PRESERVE_NONZERO
}
void clear() {
@ -1784,7 +1796,8 @@ struct object_stat_sum_t {
sizeof(num_evict_mode_some) +
sizeof(num_evict_mode_full) +
sizeof(num_objects_pinned) +
sizeof(num_objects_missing)
sizeof(num_objects_missing) +
sizeof(num_legacy_snapsets)
,
"object_stat_sum_t have padding");
}