From cb9c38707f90edff4ad4c76e565c9a48648d0f30 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sun, 19 Feb 2023 17:48:11 -0500 Subject: [PATCH] rgw/rados: cosmetic cleanup of attr handling Signed-off-by: Casey Bodley (cherry picked from commit 8ee9b3fc5e7e81a79d637593eca9add365c0b784) --- src/rgw/driver/rados/rgw_rados.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 57ea3621a05..d1e281a9f7b 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -5579,19 +5579,17 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc } } - iter = s->attrset.find(RGW_ATTR_SHADOW_OBJ); - if (iter != s->attrset.end()) { - bufferlist bl = iter->second; - bufferlist::iterator it = bl.begin(); + if (iter = s->attrset.find(RGW_ATTR_SHADOW_OBJ); iter != s->attrset.end()) { + const bufferlist& bl = iter->second; + auto it = bl.begin(); it.copy(bl.length(), s->shadow_obj); s->shadow_obj[bl.length()] = '\0'; } if (iter = s->attrset.find(RGW_ATTR_ID_TAG); iter != s->attrset.end()) { s->obj_tag = iter->second; } - auto ttiter = s->attrset.find(RGW_ATTR_TAIL_TAG); - if (ttiter != s->attrset.end()) { - s->tail_tag = s->attrset[RGW_ATTR_TAIL_TAG]; + if (iter = s->attrset.find(RGW_ATTR_TAIL_TAG); iter != s->attrset.end()) { + s->tail_tag = iter->second; } if (iter = s->attrset.find(RGW_ATTR_MANIFEST); iter != s->attrset.end()) { @@ -5628,9 +5626,8 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc s->fake_tag = true; } } - map::iterator aiter = s->attrset.find(RGW_ATTR_PG_VER); - if (aiter != s->attrset.end()) { - bufferlist& pg_ver_bl = aiter->second; + if (iter = s->attrset.find(RGW_ATTR_PG_VER); iter != s->attrset.end()) { + const bufferlist& pg_ver_bl = iter->second; if (pg_ver_bl.length()) { auto pgbl = pg_ver_bl.cbegin(); try { @@ -5640,9 +5637,8 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc } } } - aiter = s->attrset.find(RGW_ATTR_SOURCE_ZONE); - if (aiter != s->attrset.end()) { - bufferlist& zone_short_id_bl = aiter->second; + if (iter = s->attrset.find(RGW_ATTR_SOURCE_ZONE); iter != s->attrset.end()) { + const bufferlist& zone_short_id_bl = iter->second; if (zone_short_id_bl.length()) { auto zbl = zone_short_id_bl.cbegin(); try { @@ -5661,8 +5657,7 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc /* an object might not be olh yet, but could have olh id tag, so we should set it anyway if * it exist, and not only if is_olh() returns true */ - iter = s->attrset.find(RGW_ATTR_OLH_ID_TAG); - if (iter != s->attrset.end()) { + if (iter = s->attrset.find(RGW_ATTR_OLH_ID_TAG); iter != s->attrset.end()) { s->olh_tag = iter->second; } -- 2.39.5