s->exists = true;
s->has_attrs = true;
+ s->accounted_size = s->size;
- map<string, bufferlist>::iterator iter = s->attrset.find(RGW_ATTR_SHADOW_OBJ);
+ auto iter = s->attrset.find(RGW_ATTR_COMPRESSION);
+ if (iter != s->attrset.end()) {
+ // use uncompressed size for accounted_size
+ try {
+ RGWCompressionInfo info;
+ auto p = iter->second.begin();
+ ::decode(info, p);
+ s->accounted_size = info.orig_size;
+ } catch (buffer::error&) {
+ dout(0) << "ERROR: could not decode compression info for object: " << obj << dendl;
+ return -EIO;
+ }
+ }
+
+ iter = s->attrset.find(RGW_ATTR_SHADOW_OBJ);
if (iter != s->attrset.end()) {
bufferlist bl = iter->second;
bufferlist::iterator it = bl.begin();
bool is_atomic;
bool has_attrs;
bool exists;
- uint64_t size;
+ uint64_t size; //< size of raw object
+ uint64_t accounted_size{0}; //< size before compression, encryption
ceph::real_time mtime;
uint64_t epoch;
bufferlist obj_tag;
has_attrs = rhs.has_attrs;
exists = rhs.exists;
size = rhs.size;
+ accounted_size = rhs.accounted_size;
mtime = rhs.mtime;
epoch = rhs.epoch;
if (rhs.obj_tag.length()) {