]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: clean-up of some code 62748/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Mon, 24 Mar 2025 23:44:20 +0000 (19:44 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Wed, 9 Apr 2025 16:44:09 +0000 (12:44 -0400)
Comments added and formatting adjusted.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit a84f984d0324e9abc060f166dd626063361a7ab0)

src/cls/rgw/cls_rgw.cc
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h

index a2cdab035ce7db598547ca2b2f49d89af2e891f2..60a5a5f8c83c60ccd465b952b508d4f9b962d9b0 100644 (file)
@@ -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);
index 12d04529b84b2e2baa1d754001c54c754777cb2d..0c6c9b6c0d51c7e81f5b01a8f725ec0cc7dd986b 100644 (file)
@@ -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<objexp_hint_entry*>& o)
 {
index c1d1cefc20e66564dfd668e0eece0b6011ddb84e..92d9ee768e214712a7e8000e98930a4b7c54769d 100644 (file)
@@ -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,