From: J. Eric Ivancich Date: Mon, 24 Mar 2025 23:44:20 +0000 (-0400) Subject: rgw: clean-up of some code X-Git-Tag: v19.2.3~180^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=974393b9e5e4c9f2aa21447188d5eb911aface88;p=ceph.git rgw: clean-up of some code Comments added and formatting adjusted. Signed-off-by: J. Eric Ivancich (cherry picked from commit a84f984d0324e9abc060f166dd626063361a7ab0) --- diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index a2cdab035ce7d..60a5a5f8c83c6 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -1940,7 +1940,7 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in, olh_key.name.c_str(), olh_key.instance.c_str(), olh_entry.delete_marker); if (olh_key == dest_key) { - /* this is the current head, need to update! */ + /* this is the current head, need to update the OLH! */ cls_rgw_obj_key next_key; bool found = false; ret = obj.find_next_key(&next_key, &found); diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 12d04529b84b2..0c6c9b6c0d51c 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -5772,8 +5772,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, } result.version_id = marker.key.instance; - if (result.version_id.empty()) + if (result.version_id.empty()) { result.version_id = "null"; + } result.delete_marker = true; struct rgw_bucket_dir_entry_meta meta; @@ -5824,7 +5825,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, } return 0; - } + } // if versioned bucket rgw_rados_ref ref; int r = store->get_obj_head_ref(dpp, target->get_bucket_info(), obj, &ref); @@ -5835,8 +5836,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, RGWObjState *state; RGWObjManifest *manifest = nullptr; r = target->get_state(dpp, &state, &manifest, false, y); - if (r < 0) + if (r < 0) { return r; + } ObjectWriteOperation op; @@ -5858,7 +5860,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, } uint64_t obj_accounted_size = state->accounted_size; - if(params.abortmp) { + if (params.abortmp) { obj_accounted_size = params.parts_accounted_size; } @@ -5895,8 +5897,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, } r = target->prepare_atomic_modification(dpp, op, false, NULL, NULL, NULL, true, false, y); - if (r < 0) + if (r < 0) { return r; + } RGWBucketInfo& bucket_info = target->get_bucket_info(); @@ -5910,10 +5913,10 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, index_op.set_bilog_flags(params.bilog_flags | RGW_BILOG_NULL_VERSION); } - r = index_op.prepare(dpp, CLS_RGW_OP_DEL, &state->write_tag, y, log_op); - if (r < 0) + if (r < 0) { return r; + } store->remove_rgw_head_obj(op); @@ -5954,8 +5957,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, target->invalidate_state(); } - if (r < 0) + if (r < 0) { return r; + } /* update quota cache */ store->quota_handler->update_stats(params.bucket_owner, obj.bucket, -1, 0, obj_accounted_size); @@ -7994,7 +7998,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp, } return 0; -} +} // bucket_index_unlink_instance int RGWRados::bucket_index_read_olh_log(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, RGWObjState& state, @@ -8321,7 +8325,6 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp, return r; } - if (need_to_remove) { string olh_tag(state.olh_tag.c_str(), state.olh_tag.length()); r = clear_olh(dpp, obj_ctx, obj, bucket_info, ref, olh_tag, last_ver, y); @@ -8588,10 +8591,13 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider* dpp, bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP; } - ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, bilog_flags, zones_trace, log_op); + ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, + op_tag, olh_tag, olh_epoch, y, + bilog_flags, zones_trace, log_op); if (ret < 0) { olh_cancel_modification(dpp, bucket_info, *state, olh_obj, op_tag, y); - ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl; + ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" << + target_obj << " returned " << ret << dendl; if (ret == -ECANCELED) { continue; } @@ -8604,9 +8610,9 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider* dpp, ldpp_dout(dpp, 20) << "update_olh() target_obj=" << olh_obj << " returned " << r << dendl; } return ret; - } + } // if error in bucket_index_unlink_instance call break; - } + } // cancel retry loop if (i == MAX_ECANCELED_RETRY) { ldpp_dout(dpp, 0) << "ERROR: exceeded max ECANCELED retries, aborting (EIO)" << dendl; @@ -10670,7 +10676,7 @@ int RGWRados::delete_obj_aio(const DoutPrefixProvider *dpp, const rgw_obj& obj, } } return ret; -} +} // delete_obj_aio void objexp_hint_entry::generate_test_instances(list& o) { diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index c1d1cefc20e66..92d9ee768e214 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -1270,7 +1270,7 @@ public: const RGWBucketInfo& bucket_info, const rgw_obj& obj, int versioning_status, optional_yield y, // versioning flags defined in enum RGWBucketFlags - bool null_verid, + bool null_verid, uint16_t bilog_flags = 0, const ceph::real_time& expiration_time = ceph::real_time(), rgw_zone_set *zones_trace = nullptr,