From e67e85c954e22cd1b9ca02eace00c137cd7b9820 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 29 Sep 2016 17:30:29 -0400 Subject: [PATCH] radosgw-admin: add 'size_utilized' to bucket stats Signed-off-by: Casey Bodley --- src/rgw/rgw_common.h | 1 + src/rgw/rgw_json_enc.cc | 2 ++ src/rgw/rgw_rados.cc | 1 + 3 files changed, 4 insertions(+) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index dc581bfba42..b5e3763251a 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1118,6 +1118,7 @@ struct RGWStorageStats RGWObjCategory category; uint64_t size; uint64_t size_rounded; + uint64_t size_utilized{0}; //< size after compression, encryption uint64_t num_objects; RGWStorageStats() diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 034a488c744..12f25e1742f 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -595,8 +595,10 @@ void RGWStorageStats::dump(Formatter *f) const { encode_json("size", size, f); encode_json("size_actual", size_rounded, f); + encode_json("size_utilized", size_utilized, f); encode_json("size_kb", rgw_rounded_kb(size), f); encode_json("size_kb_actual", rgw_rounded_kb(size_rounded), f); + encode_json("size_kb_utilized", rgw_rounded_kb(size_utilized), f); encode_json("num_objects", num_objects, f); } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index fd13ba9e460..61223e8001d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -7968,6 +7968,7 @@ static void accumulate_raw_stats(const rgw_bucket_dir_header& header, s.category = category; s.size += header_stats.total_size; s.size_rounded += header_stats.total_size_rounded; + s.size_utilized += header_stats.actual_size; s.num_objects += header_stats.num_entries; } } -- 2.47.3