Skip to content

Commit a84f984

Browse files
committed
rgw: clean-up of some code
Comments added and formatting adjusted. Signed-off-by: J. Eric Ivancich <[email protected]>
1 parent 333b5cd commit a84f984

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

src/cls/rgw/cls_rgw.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in,
20642064
olh_key.name.c_str(), olh_key.instance.c_str(), olh_entry.delete_marker);
20652065

20662066
if (olh_key == dest_key) {
2067-
/* this is the current head, need to update! */
2067+
/* this is the current head, need to update the OLH! */
20682068
cls_rgw_obj_key next_key;
20692069
bool found = false;
20702070
ret = obj.find_next_key(&next_key, &found);

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6080,8 +6080,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
60806080
}
60816081

60826082
result.version_id = marker.key.instance;
6083-
if (result.version_id.empty())
6083+
if (result.version_id.empty()) {
60846084
result.version_id = "null";
6085+
}
60856086
result.delete_marker = true;
60866087

60876088
struct rgw_bucket_dir_entry_meta meta;
@@ -6132,7 +6133,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
61326133
}
61336134

61346135
return 0;
6135-
}
6136+
} // if versioned bucket
61366137

61376138
rgw_rados_ref ref;
61386139
int r = store->get_obj_head_ref(dpp, target->get_bucket_info(), obj, &ref);
@@ -6143,8 +6144,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
61436144
RGWObjState *state;
61446145
RGWObjManifest *manifest = nullptr;
61456146
r = target->get_state(dpp, &state, &manifest, false, y);
6146-
if (r < 0)
6147+
if (r < 0) {
61476148
return r;
6149+
}
61486150

61496151
ObjectWriteOperation op;
61506152

@@ -6166,7 +6168,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
61666168
}
61676169
uint64_t obj_accounted_size = state->accounted_size;
61686170

6169-
if(params.abortmp) {
6171+
if (params.abortmp) {
61706172
obj_accounted_size = params.parts_accounted_size;
61716173
}
61726174

@@ -6203,8 +6205,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
62036205
}
62046206

62056207
r = target->prepare_atomic_modification(dpp, op, false, NULL, NULL, NULL, true, false, y);
6206-
if (r < 0)
6208+
if (r < 0) {
62076209
return r;
6210+
}
62086211

62096212
RGWBucketInfo& bucket_info = target->get_bucket_info();
62106213

@@ -6218,10 +6221,10 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
62186221
index_op.set_bilog_flags(params.bilog_flags | RGW_BILOG_NULL_VERSION);
62196222
}
62206223

6221-
62226224
r = index_op.prepare(dpp, CLS_RGW_OP_DEL, &state->write_tag, y);
6223-
if (r < 0)
6225+
if (r < 0) {
62246226
return r;
6227+
}
62256228

62266229
store->remove_rgw_head_obj(op);
62276230

@@ -6266,8 +6269,9 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y,
62666269
target->invalidate_state();
62676270
}
62686271

6269-
if (r < 0)
6272+
if (r < 0) {
62706273
return r;
6274+
}
62716275

62726276
/* update quota cache */
62736277
store->quota_handler->update_stats(params.bucket_owner, obj.bucket, -1, 0, obj_accounted_size);
@@ -8408,7 +8412,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp,
84088412
}
84098413

84108414
return 0;
8411-
}
8415+
} // bucket_index_unlink_instance
84128416

84138417
int RGWRados::bucket_index_read_olh_log(const DoutPrefixProvider *dpp,
84148418
RGWBucketInfo& bucket_info, RGWObjState& state,
@@ -8735,7 +8739,6 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp,
87358739
return r;
87368740
}
87378741

8738-
87398742
if (need_to_remove) {
87408743
string olh_tag(state.olh_tag.c_str(), state.olh_tag.length());
87418744
r = clear_olh(dpp, obj_ctx, obj, bucket_info, ref, olh_tag, last_ver, y);
@@ -9002,10 +9005,13 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider* dpp,
90029005
bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP;
90039006
}
90049007

9005-
ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, bilog_flags, zones_trace, log_op);
9008+
ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj,
9009+
op_tag, olh_tag, olh_epoch, y,
9010+
bilog_flags, zones_trace, log_op);
90069011
if (ret < 0) {
90079012
olh_cancel_modification(dpp, bucket_info, *state, olh_obj, op_tag, y);
9008-
ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl;
9013+
ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" <<
9014+
target_obj << " returned " << ret << dendl;
90099015
if (ret == -ECANCELED) {
90109016
continue;
90119017
}
@@ -9018,9 +9024,9 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider* dpp,
90189024
ldpp_dout(dpp, 20) << "update_olh() target_obj=" << olh_obj << " returned " << r << dendl;
90199025
}
90209026
return ret;
9021-
}
9027+
} // if error in bucket_index_unlink_instance call
90229028
break;
9023-
}
9029+
} // cancel retry loop
90249030

90259031
if (i == MAX_ECANCELED_RETRY) {
90269032
ldpp_dout(dpp, 0) << "ERROR: exceeded max ECANCELED retries, aborting (EIO)" << dendl;
@@ -11136,7 +11142,7 @@ int RGWRados::delete_obj_aio(const DoutPrefixProvider *dpp, const rgw_obj& obj,
1113611142
}
1113711143
}
1113811144
return ret;
11139-
}
11145+
} // delete_obj_aio
1114011146

1114111147
void objexp_hint_entry::generate_test_instances(list<objexp_hint_entry*>& o)
1114211148
{

src/rgw/driver/rados/rgw_rados.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ int restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
12901290
const RGWBucketInfo& bucket_info,
12911291
const rgw_obj& obj,
12921292
int versioning_status, optional_yield y, // versioning flags defined in enum RGWBucketFlags
1293-
bool null_verid,
1293+
bool null_verid,
12941294
uint16_t bilog_flags = 0,
12951295
const ceph::real_time& expiration_time = ceph::real_time(),
12961296
rgw_zone_set *zones_trace = nullptr,

0 commit comments

Comments
 (0)