]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add accounted_size to RGWObjEnt
authorCasey Bodley <cbodley@redhat.com>
Thu, 29 Sep 2016 16:28:10 +0000 (12:28 -0400)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 2 Nov 2016 11:13:06 +0000 (12:13 +0100)
and use accounted_size for BucketList operations

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_common.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc

index 192344828eb674e388e19f24dab78d4c3a38f768..dc581bfba42e20a383a599b1a2e168d6ac4b160f 100644 (file)
@@ -1375,7 +1375,8 @@ struct RGWObjEnt {
   std::string ns;
   rgw_user owner;
   std::string owner_display_name;
-  uint64_t size;
+  uint64_t size{0};
+  uint64_t accounted_size{0};
   ceph::real_time mtime;
   string etag;
   string content_type;
@@ -1383,7 +1384,7 @@ struct RGWObjEnt {
   uint32_t flags;
   uint64_t versioned_epoch;
 
-  RGWObjEnt() : size(0), flags(0), versioned_epoch(0) {}
+  RGWObjEnt() : flags(0), versioned_epoch(0) {}
 
   void dump(Formatter *f) const;
 
index cbd1ca3d53472ff33e026b9123a21a638ae5019d..2aa04c46d861643cb2a1c8b7c379d5bd098e522f 100644 (file)
@@ -9256,6 +9256,7 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, uint
   RGWObjEnt ent;
   obj.get_index_key(&ent.key);
   ent.size = size;
+  ent.accounted_size = size;
   ent.mtime = ut;
   ent.etag = etag;
   ACLOwner owner;
@@ -11771,7 +11772,7 @@ int RGWRados::cls_obj_complete_op(BucketShard& bs, RGWModifyOp op, string& tag,
   ObjectWriteOperation o;
   rgw_bucket_dir_entry_meta dir_meta;
   dir_meta.size = ent.size;
-  dir_meta.accounted_size = ent.size;
+  dir_meta.accounted_size = ent.accounted_size;
   dir_meta.mtime = ent.mtime;
   dir_meta.etag = ent.etag;
   dir_meta.owner = ent.owner.to_str();
@@ -11889,6 +11890,7 @@ int RGWRados::cls_bucket_list(rgw_bucket& bucket, int shard_id, rgw_obj_key& sta
     RGWObjEnt e;
     e.key.set(dirent.key.name, dirent.key.instance);
     e.size = dirent.meta.size;
+    e.accounted_size = dirent.meta.accounted_size;
     e.mtime = dirent.meta.mtime;
     e.etag = dirent.meta.etag;
     e.owner = dirent.meta.owner;
@@ -12092,6 +12094,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
   ACLOwner owner;
 
   object.size = astate->size;
+  object.accounted_size = astate->accounted_size;
   object.mtime = astate->mtime;
 
   map<string, bufferlist>::iterator iter = astate->attrset.find(RGW_ATTR_ETAG);
@@ -12135,6 +12138,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
   list_state.ver.pool = io_ctx.get_id();
   list_state.ver.epoch = astate->epoch;
   list_state.meta.size = object.size;
+  list_state.meta.accounted_size = object.accounted_size;
   list_state.meta.mtime = object.mtime;
   list_state.meta.category = main_category;
   list_state.meta.etag = etag;
index c36910ec4f03d923af921eb51c74c332b8ef1474..c3f2b523b8a1be969fdd520d91a7cd4f88096422 100644 (file)
@@ -549,7 +549,7 @@ void RGWListBucket_ObjStore_S3::send_versioned_response()
       dump_time(s, "LastModified", &iter->mtime);
       if (!iter->is_delete_marker()) {
        s->formatter->dump_format("ETag", "\"%s\"", iter->etag.c_str());
-       s->formatter->dump_int("Size", iter->size);
+       s->formatter->dump_int("Size", iter->accounted_size);
        s->formatter->dump_string("StorageClass", "STANDARD");
       }
       dump_owner(s, iter->owner, iter->owner_display_name);
@@ -623,7 +623,7 @@ void RGWListBucket_ObjStore_S3::send_response()
       }
       dump_time(s, "LastModified", &iter->mtime);
       s->formatter->dump_format("ETag", "\"%s\"", iter->etag.c_str());
-      s->formatter->dump_int("Size", iter->size);
+      s->formatter->dump_int("Size", iter->accounted_size);
       s->formatter->dump_string("StorageClass", "STANDARD");
       dump_owner(s, iter->owner, iter->owner_display_name);
       if (s->system_request) {
index 977a73b67f50c68efa7cb180a1a9a78168474c18..2d94e481b20baffe1aa587307b5dd32fc8d42a59 100644 (file)
@@ -295,7 +295,7 @@ void RGWListBucket_ObjStore_SWIFT::send_response()
       s->formatter->open_object_section("object");
       s->formatter->dump_string("name", key.name);
       s->formatter->dump_string("hash", iter->etag);
-      s->formatter->dump_int("bytes", iter->size);
+      s->formatter->dump_int("bytes", iter->accounted_size);
       string single_content_type = iter->content_type;
       if (iter->content_type.size()) {
         // content type might hold multiple values, just dump the last one