mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
rgw: add accounted_size to RGWObjEnt
and use accounted_size for BucketList operations Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
9a105a6966
commit
2d2d370762
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user