]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/reshard: use defined variable 35321/head
authorKefu Chai <kchai@redhat.com>
Sat, 30 May 2020 04:51:14 +0000 (12:51 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Jun 2020 15:28:24 +0000 (23:28 +0800)
use the defined reference for more concise code, this silences the
warning like:
```
../src/rgw/rgw_reshard.cc:530:15: warning: unused variable â€˜bucket’ [-Wunused-variable]
  530 |   rgw_bucket& bucket = bucket_info.bucket;
      |               ^~~~~~
```

also move `ret` close to where it is used for the first time.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_reshard.cc

index bf2508b79cea911846dc6a16dec10de65a5a391d..0a66d17c77fe69e84300f285b3e79afc4ec2c350 100644 (file)
@@ -527,14 +527,11 @@ int RGWBucketReshard::do_reshard(int num_shards,
                                 ostream *out,
                                 Formatter *formatter)
 {
-  rgw_bucket& bucket = bucket_info.bucket;
-
-  int ret = 0;
-
   if (out) {
-    (*out) << "tenant: " << bucket_info.bucket.tenant << std::endl;
-    (*out) << "bucket name: " << bucket_info.bucket.name << std::endl;
-    (*out) << "old bucket instance id: " << bucket_info.bucket.bucket_id <<
+    const rgw_bucket& bucket = bucket_info.bucket;
+    (*out) << "tenant: " << bucket.tenant << std::endl;
+    (*out) << "bucket name: " << bucket.name << std::endl;
+    (*out) << "old bucket instance id: " << bucket.bucket_id <<
       std::endl;
     (*out) << "new bucket instance id: " << new_bucket_info.bucket.bucket_id <<
       std::endl;
@@ -553,7 +550,7 @@ int RGWBucketReshard::do_reshard(int num_shards,
   // complete successfully
   BucketInfoReshardUpdate bucket_info_updater(store, bucket_info, bucket_attrs, new_bucket_info.bucket.bucket_id);
 
-  ret = bucket_info_updater.start();
+  int ret = bucket_info_updater.start();
   if (ret < 0) {
     ldout(store->ctx(), 0) << __func__ << ": failed to update bucket info ret=" << ret << dendl;
     return ret;