]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: clean-up of some code 62640/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Mon, 24 Mar 2025 23:44:20 +0000 (19:44 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 3 Apr 2025 17:33:04 +0000 (13:33 -0400)
Comments added and formatting adjusted.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/cls/rgw/cls_rgw.cc
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h

index aa47be003005c1d8f542d3e673ae7026c192fa49..67fb9e9a9cfe301f6d2f2d96168a13a460a6ed3a 100644 (file)
@@ -2064,7 +2064,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);
index 10bf1b9c9c6d4cb81f9b73775a1ae133008b4745..531d53858a3d9805024d94c71c5c632de7bfee0f 100644 (file)
@@ -6080,8 +6080,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;
@@ -6132,7 +6133,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);
@@ -6143,8 +6144,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;
 
@@ -6166,7 +6168,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;
   }
 
@@ -6203,8 +6205,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();
 
@@ -6218,10 +6221,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);
-  if (r < 0)
+  if (r < 0) {
     return r;
+  }
 
   store->remove_rgw_head_obj(op);
 
@@ -6266,8 +6269,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);
@@ -8408,7 +8412,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,
@@ -8735,7 +8739,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);
@@ -9002,10 +9005,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;
       }
@@ -9018,9 +9024,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;
@@ -11136,7 +11142,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<objexp_hint_entry*>& o)
 {
index a6ef008cb2b602036e0760928f158ef48df6c6d0..a8cef14cd89bfa3e46389baf1d51a11395355b56 100644 (file)
@@ -1290,7 +1290,7 @@ int restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
                 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,