From 63db0ebc7f23c2431bd334d1187eed5d8ed50976 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 28 Sep 2016 15:37:17 -0400 Subject: [PATCH] cls/rgw: add actual_size to rgw_bucket_caregory_stats Signed-off-by: Casey Bodley --- src/cls/rgw/cls_rgw_types.cc | 2 ++ src/cls/rgw/cls_rgw_types.h | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cls/rgw/cls_rgw_types.cc b/src/cls/rgw/cls_rgw_types.cc index 27a413e865b..1b8edbb667d 100644 --- a/src/cls/rgw/cls_rgw_types.cc +++ b/src/cls/rgw/cls_rgw_types.cc @@ -468,6 +468,7 @@ void rgw_bucket_category_stats::generate_test_instances(listtotal_size = 1024; s->total_size_rounded = 4096; s->num_entries = 2; + s->actual_size = 1024; o.push_back(s); o.push_back(new rgw_bucket_category_stats); } @@ -477,6 +478,7 @@ void rgw_bucket_category_stats::dump(Formatter *f) const f->dump_unsigned("total_size", total_size); f->dump_unsigned("total_size_rounded", total_size_rounded); f->dump_unsigned("num_entries", num_entries); + f->dump_unsigned("actual_size", actual_size); } void rgw_bucket_dir_header::generate_test_instances(list& o) diff --git a/src/cls/rgw/cls_rgw_types.h b/src/cls/rgw/cls_rgw_types.h index ea14cb6ec23..61209e4b6d1 100644 --- a/src/cls/rgw/cls_rgw_types.h +++ b/src/cls/rgw/cls_rgw_types.h @@ -554,21 +554,28 @@ struct rgw_bucket_category_stats { uint64_t total_size; uint64_t total_size_rounded; uint64_t num_entries; + uint64_t actual_size{0}; //< account for compression, encryption rgw_bucket_category_stats() : total_size(0), total_size_rounded(0), num_entries(0) {} void encode(bufferlist &bl) const { - ENCODE_START(2, 2, bl); + ENCODE_START(3, 2, bl); ::encode(total_size, bl); ::encode(total_size_rounded, bl); ::encode(num_entries, bl); + ::encode(actual_size, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { - DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); + DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); ::decode(total_size, bl); ::decode(total_size_rounded, bl); ::decode(num_entries, bl); + if (struct_v >= 3) { + ::decode(actual_size, bl); + } else { + actual_size = total_size; + } DECODE_FINISH(bl); } void dump(Formatter *f) const; -- 2.39.5