From: Casey Bodley Date: Thu, 29 Sep 2016 16:32:21 +0000 (-0400) Subject: rgw: add accounted_size argument to Write::write_meta X-Git-Tag: v11.1.0~429^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=885606c76cf8009570098cde48c0a23a21e6020d;p=ceph.git rgw: add accounted_size argument to Write::write_meta Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index fa2f56af4bae..e72548ab785b 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2673,7 +2673,7 @@ int RGWPutObjProcessor_Multipart::do_complete(string& etag, real_time *mtime, re head_obj_op.meta.owner = s->owner.get_id(); head_obj_op.meta.delete_at = delete_at; - int r = head_obj_op.write_meta(s->obj_size, attrs); + int r = head_obj_op.write_meta(obj_len, obj_len, attrs); if (r < 0) return r; @@ -4582,7 +4582,7 @@ void RGWInitMultipart::execute() obj_op.meta.category = RGW_OBJ_CATEGORY_MULTIMETA; obj_op.meta.flags = PUT_OBJ_CREATE_EXCL; - op_ret = obj_op.write_meta(0, attrs); + op_ret = obj_op.write_meta(0, 0, attrs); } while (op_ret == -EEXIST); } @@ -4954,7 +4954,7 @@ void RGWCompleteMultipart::execute() obj_op.meta.ptag = &s->req_id; /* use req_id as operation tag */ obj_op.meta.owner = s->owner.get_id(); obj_op.meta.flags = PUT_OBJ_CREATE; - op_ret = obj_op.write_meta(ofs, attrs); + op_ret = obj_op.write_meta(ofs, ofs, attrs); if (op_ret < 0) return; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index be518907a621..8a6c492cdd40 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2540,7 +2540,7 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, real_time *mtime, real_ obj_op.meta.olh_epoch = olh_epoch; obj_op.meta.delete_at = delete_at; - r = obj_op.write_meta(obj_len, attrs); + r = obj_op.write_meta(obj_len, obj_len, attrs); if (r < 0) { return r; } @@ -6245,13 +6245,14 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx, * obj: the object name/key * data: the object contents/value * size: the amount of data to write (data must be this long) + * accounted_size: original size of data before compression, encryption * mtime: if non-NULL, writes the given mtime to the bucket storage * attrs: all the given attrs are written to bucket storage for the given object * exclusive: create object exclusively * Returns: 0 on success, -ERR# otherwise. */ -int RGWRados::Object::Write::write_meta(uint64_t size, - map& attrs) +int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size, + map& attrs) { rgw_bucket bucket; rgw_rados_ref ref; @@ -6357,7 +6358,7 @@ int RGWRados::Object::Write::write_meta(uint64_t size, int64_t poolid; bool orig_exists = state->exists; - uint64_t orig_size = state->size; + uint64_t orig_size = state->accounted_size; bool versioned_target = (meta.olh_epoch > 0 || !obj.get_instance().empty()); @@ -6394,7 +6395,7 @@ int RGWRados::Object::Write::write_meta(uint64_t size, ldout(store->ctx(), 0) << "ERROR: complete_atomic_modification returned r=" << r << dendl; } - r = index_op.complete(poolid, epoch, size, size, + r = index_op.complete(poolid, epoch, size, accounted_size, meta.set_mtime, etag, content_type, &acl_bl, meta.category, meta.remove_objs); if (r < 0) @@ -6429,7 +6430,8 @@ int RGWRados::Object::Write::write_meta(uint64_t size, meta.canceled = false; /* update quota cache */ - store->quota_handler->update_stats(meta.owner, bucket, (orig_exists ? 0 : 1), size, orig_size); + store->quota_handler->update_stats(meta.owner, bucket, (orig_exists ? 0 : 1), + accounted_size, orig_size); return 0; done_cancel: @@ -7536,7 +7538,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, write_op.meta.olh_epoch = olh_epoch; write_op.meta.delete_at = delete_at; - ret = write_op.write_meta(obj_size, attrs); + ret = write_op.write_meta(obj_size, astate->accounted_size, attrs); if (ret < 0) { goto done_ret; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 79340b8ed523..ba62caee50c4 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -2465,7 +2465,8 @@ public: explicit Write(RGWRados::Object *_target) : target(_target) {} - int write_meta(uint64_t size, map& attrs); + int write_meta(uint64_t size, uint64_t accounted_size, + map& attrs); int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive); };