]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: avoid calling rgw_make_bucket_entry_name() when not needed
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 30 Nov 2015 20:15:24 +0000 (12:15 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 2 Dec 2015 18:45:41 +0000 (10:45 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h
src/rgw/rgw_log.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc

index 157fd085aa60c4239aac4cf9e8616fd54f323a37..456700dfe45452fb7584b7b2439ac76f011d4763 100644 (file)
@@ -53,6 +53,18 @@ void rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_
   }
 }
 
+string rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_name) {
+  string bucket_entry;
+
+  if (tenant_name.empty()) {
+    bucket_entry = bucket_name;
+  } else {
+    bucket_entry = tenant_name + "/" + bucket_name;
+  }
+
+  return bucket_entry;
+}
+
 /*
  * Tenants are separated from buckets in URLs by a colon in S3.
  * This function is not to be used on Swift URLs, not even for COPY arguments.
index e818f0a6b5c9758f0beff99186790443d6911376..9191fbe8651ccc97353ab781c6b3f31d1236901a 100644 (file)
@@ -47,6 +47,8 @@ extern int rgw_bucket_sync_user_stats(RGWRados *store, const string& tenant_name
 extern void rgw_make_bucket_entry_name(const string& tenant_name,
                                        const string& bucket_name,
                                        string& bucket_entry);
+extern string rgw_make_bucket_entry_name(const string& tenant_name,
+                                       const string& bucket_name);
 extern void rgw_parse_url_bucket(const string &bucket,
                                  string &tenant_name, string &bucket_name);
 
index 0e565cb2c858b3dc60118f7baea918ba5c4b950e..8f85fdec17fbbd2ad52e202c348fcb5b8033415a 100644 (file)
@@ -289,9 +289,7 @@ int rgw_log_op(RGWRados *store, struct req_state *s, const string& op_name, OpsL
   } else {
     bucket_id = s->bucket.bucket_id;
   }
-  string bucket_log;
-  rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name, bucket_log);
-  entry.bucket = bucket_log;
+  rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name, entry.bucket);
 
   if (check_utf8(s->bucket_name.c_str(), entry.bucket.size()) != 0) {
     ldout(s->cct, 5) << "not logging op on bucket with non-utf8 name" << dendl;
index 16d5dea41d91579c46491069adda3afb573010fc..8c00e192c03fdd3fd41ff9a4a0ee8dbf29cdf772 100644 (file)
@@ -2363,9 +2363,8 @@ int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket, bool rela
 
 int RGWHandler_ObjStore_S3::init(RGWRados *store, struct req_state *s, RGWClientIO *cio)
 {
-  string bucket_log;
-  rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name, bucket_log);
-  dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>")) << " s->bucket=" << bucket_log << dendl;
+  dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
+           << " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) << dendl;
 
   int ret;
   ret = validate_tenant_name(s->bucket_tenant);
index 0d3aeeb9afd1b178dca62ae56d22551746c7633a..95cb8f514c68302a825d633ba725baf8010b4ecf 100644 (file)
@@ -1216,9 +1216,8 @@ int RGWHandler_ObjStore_SWIFT::init_from_header(struct req_state *s)
 
 int RGWHandler_ObjStore_SWIFT::init(RGWRados *store, struct req_state *s, RGWClientIO *cio)
 {
-  string bucket_log;
-  rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name, bucket_log);
-  dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>")) << " s->bucket=" << bucket_log << dendl;
+  dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
+           << " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) << dendl;
 
   int ret;
   ret = validate_tenant_name(s->bucket_tenant);