]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: maintain uncompressed size in copy_obj_data
authorCasey Bodley <cbodley@redhat.com>
Wed, 26 Oct 2016 18:54:37 +0000 (14:54 -0400)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 2 Nov 2016 11:14:10 +0000 (12:14 +0100)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc

index 61223e8001d5c2c2efc623b483d431ed9821025c..919206c3127bee101b78ff45280cc879faac8951 100644 (file)
@@ -7626,10 +7626,20 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
     }
   }
 
-  // XXX: need to copy over compression attr and its orig_size here?
-  ret = processor.complete(ofs, etag, mtime, set_mtime, attrs, delete_at);
+  // pass original size if compressed
+  uint64_t accounted_size = ofs;
+  {
+    bool compressed{false};
+    RGWCompressionInfo cs_info;
+    ret = rgw_compression_info_from_attrset(attrs, compressed, cs_info);
+    if (ret < 0) {
+      ldout(cct, 0) << "ERROR: failed to read compression info" << dendl;
+      return ret;
+    }
+    accounted_size = cs_info.orig_size;
+  }
 
-  return ret;
+  return processor.complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at);
 }
 
 bool RGWRados::is_meta_master()