]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reformat some code to make it easier to read
authorJ. Eric Ivancich <ivancich@redhat.com>
Tue, 3 Sep 2019 17:03:51 +0000 (13:03 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Fri, 24 Jan 2020 18:45:09 +0000 (13:45 -0500)
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/cls/rgw/cls_rgw.cc
src/cls/rgw/cls_rgw_types.h
src/rgw/rgw_rados.cc

index 30b408c84eb8b9af585b43a97c234517c8200f04..7d56e0fea3f9f9d0ceb19fe1db363004a191fb2d 100644 (file)
@@ -152,15 +152,22 @@ static int log_index_operation(cls_method_context_t hctx, cls_rgw_obj_key& obj_k
  * UTF-8 object names can *both* preceed and follow the "ugly
  * namespace".
  */
-static int get_obj_vals(cls_method_context_t hctx, const string& start, const string& filter_prefix,
-                        int num_entries, map<string, bufferlist> *pkeys, bool *pmore)
-{
-  int ret = cls_cxx_map_get_vals(hctx, start, filter_prefix, num_entries, pkeys, pmore);
-  if (ret < 0)
+static int get_obj_vals(cls_method_context_t hctx,
+                       const string& start,
+                       const string& filter_prefix,
+                        int num_entries,
+                       map<string, bufferlist> *pkeys,
+                       bool *pmore)
+{
+  int ret = cls_cxx_map_get_vals(hctx, start, filter_prefix,
+                                num_entries, pkeys, pmore);
+  if (ret < 0) {
     return ret;
+  }
 
-  if (pkeys->empty())
+  if (pkeys->empty()) {
     return 0;
+  }
 
   auto last_element = pkeys->rbegin();
   if ((unsigned char)last_element->first[0] < BI_PREFIX_CHAR) {
@@ -195,8 +202,9 @@ static int get_obj_vals(cls_method_context_t hctx, const string& start, const st
   auto upper = std::lower_bound(lower, pkeys->end(), new_start, comp);
   pkeys->erase(lower, upper);
 
-  if (num_entries == (int)pkeys->size() || !(*pmore))
+  if (num_entries == (int)pkeys->size() || !(*pmore)) {
     return 0;
+  }
 
   if (pkeys->size() && new_start < pkeys->rbegin()->first) {
     new_start = pkeys->rbegin()->first;
@@ -205,12 +213,15 @@ static int get_obj_vals(cls_method_context_t hctx, const string& start, const st
   map<string, bufferlist> new_keys;
 
   /* now get some more keys */
-  ret = cls_cxx_map_get_vals(hctx, new_start, filter_prefix, num_entries - pkeys->size(), &new_keys, pmore);
-  if (ret < 0)
+  ret = cls_cxx_map_get_vals(hctx, new_start, filter_prefix,
+                            num_entries - pkeys->size(), &new_keys, pmore);
+  if (ret < 0) {
     return ret;
+  }
 
   pkeys->insert(std::make_move_iterator(new_keys.begin()),
                 std::make_move_iterator(new_keys.end()));
+
   return 0;
 }
 
@@ -1339,11 +1350,15 @@ static int write_version_marker(cls_method_context_t hctx, cls_rgw_obj_key& key)
 }
 
 /*
- * plain entries are the ones who were created when bucket was not versioned,
- * if we override these objects, we need to convert these to versioned entries -- ones that have
- * both data entry, and listing key. Their version is going to be empty though
+ * plain entries are the ones who were created when bucket was not
+ * versioned, if we override these objects, we need to convert these
+ * to versioned entries -- ones that have both data entry, and listing
+ * key. Their version is going to be empty though
  */
-static int convert_plain_entry_to_versioned(cls_method_context_t hctx, cls_rgw_obj_key& key, bool demote_current, bool instance_only)
+static int convert_plain_entry_to_versioned(cls_method_context_t hctx,
+                                           cls_rgw_obj_key& key,
+                                           bool demote_current,
+                                           bool instance_only)
 {
   if (!key.instance.empty()) {
     return -EINVAL;
@@ -1375,7 +1390,8 @@ static int convert_plain_entry_to_versioned(cls_method_context_t hctx, cls_rgw_o
       ret = write_obj_entries(hctx, entry, new_idx);
     }
     if (ret < 0) {
-      CLS_LOG(0, "ERROR: write_obj_entries new_idx=%s returned %d", new_idx.c_str(), ret);
+      CLS_LOG(0, "ERROR: write_obj_entries new_idx=%s returned %d",
+             new_idx.c_str(), ret);
       return ret;
     }
   }
index b77cd3b8bde161db0e6b5dab02dd7c2c96101e63..49add410fe00b3c5c7175b7d874bfec15f0f4ab0 100644 (file)
@@ -57,8 +57,7 @@ enum RGWCheckMTimeType {
 
 #define ROUND_BLOCK_SIZE 4096
 
-static inline uint64_t cls_rgw_get_rounded_size(uint64_t size)
-{
+static inline uint64_t cls_rgw_get_rounded_size(uint64_t size) {
   return (size + ROUND_BLOCK_SIZE - 1) & ~(ROUND_BLOCK_SIZE - 1);
 }
 
index 3c1b18119bae8943dbf25860d4d07e996a83d7e2..f6c65ea95131c8afab97d0c2920ac14134b6cee3 100644 (file)
@@ -1724,11 +1724,12 @@ int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id)
  * is_truncated: if number of objects in the bucket is bigger than
  * max, then truncated.
  */
-int RGWRados::Bucket::List::list_objects_ordered(int64_t max_p,
-                                                vector<rgw_bucket_dir_entry> *result,
-                                                map<string, bool> *common_prefixes,
-                                                bool *is_truncated,
-                                                optional_yield y)
+int RGWRados::Bucket::List::list_objects_ordered(
+  int64_t max_p,
+  vector<rgw_bucket_dir_entry> *result,
+  map<string, bool> *common_prefixes,
+  bool *is_truncated,
+  optional_yield y)
 {
   RGWRados *store = target->get_store();
   CephContext *cct = store->ctx();