]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: add actual_size to rgw_bucket_caregory_stats
authorCasey Bodley <cbodley@redhat.com>
Wed, 28 Sep 2016 19:37:17 +0000 (15:37 -0400)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 2 Nov 2016 11:10:25 +0000 (12:10 +0100)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h

index 27a413e865b948a555f098cf6a4eeba0cab33533..1b8edbb667d13e51d9a9737ef70415c67d9b3cdd 100644 (file)
@@ -468,6 +468,7 @@ void rgw_bucket_category_stats::generate_test_instances(list<rgw_bucket_category
   s->total_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<rgw_bucket_dir_header*>& o)
index ea14cb6ec23f4d659e0083d0eb24f6811e3f1021..61209e4b6d12fbc2c86caa33f7c8c8baa6ec6a2f 100644 (file)
@@ -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;