]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: do not capture unused variables
authorKefu Chai <kchai@redhat.com>
Sat, 11 Jan 2020 08:07:42 +0000 (16:07 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 11 Jan 2020 15:12:27 +0000 (23:12 +0800)
this silences warnings from clang:

src/crimson/osd/heartbeat.cc:109:14: warning: lambda capture 'this' is
not used [-Wunused-lambda-capture]
      .then([this, &info=peer_info->second] (auto xcon_front, auto
xcon_back) {
             ^~~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/net/ProtocolV1.cc
src/crimson/net/ProtocolV2.cc
src/crimson/osd/heartbeat.cc
src/crimson/osd/osd.cc
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_meta.cc

index ac8f65402ab0953f77a8b7edeb3005c2ff9dd0e6..9bd41a8fe2e3a7b9c8c08d65284f813ca3c55aa9 100644 (file)
@@ -441,7 +441,7 @@ seastar::future<stop_t> ProtocolV1::send_connect_reply_ready(
       } else {
         return socket->flush();
       }
-    }).then([this] {
+    }).then([] {
       return stop_t::yes;
     });
 }
index 2de2dd75e98c93f02019a02d6be6f3d2ac14622a..36867b07d42ff25269cb42be366e16c9fa190be4 100644 (file)
@@ -917,7 +917,7 @@ void ProtocolV2::execute_connecting()
             abort_protocol();
           }
           if (socket) {
-            (void) with_gate(pending_dispatch, [this, sock = std::move(socket)] () mutable {
+            (void) with_gate(pending_dispatch, [sock = std::move(socket)] () mutable {
               return sock->close().then([sock = std::move(sock)] {});
             });
           }
@@ -928,7 +928,7 @@ void ProtocolV2::execute_connecting()
           if (unlikely(state != state_t::CONNECTING)) {
             logger().debug("{} triggered {} during Socket::connect()",
                            conn, get_state_name(state));
-            return sock->close().then([this, sock = std::move(sock)] {
+            return sock->close().then([sock = std::move(sock)] {
               abort_protocol();
             });
           }
@@ -1129,7 +1129,7 @@ ProtocolV2::send_wait()
 {
   auto wait = WaitFrame::Encode();
   logger().debug("{} WRITE WaitFrame", conn);
-  return write_frame(wait).then([this] {
+  return write_frame(wait).then([] {
     return next_step_t::wait;
   });
 }
@@ -1319,7 +1319,7 @@ ProtocolV2::server_connect()
       auto ident_missing_features = IdentMissingFeaturesFrame::Encode(feat_missing);
       logger().warn("{} WRITE IdentMissingFeaturesFrame: features={} (peer missing)",
                     conn, feat_missing);
-      return write_frame(ident_missing_features).then([this] {
+      return write_frame(ident_missing_features).then([] {
         return next_step_t::wait;
       });
     }
@@ -1791,7 +1791,7 @@ void ProtocolV2::trigger_replacing(bool reconnect,
       }
 
       if (socket) {
-        (void) with_gate(pending_dispatch, [this, sock = std::move(socket)] () mutable {
+        (void) with_gate(pending_dispatch, [sock = std::move(socket)] () mutable {
           return sock->close().then([sock = std::move(sock)] {});
         });
       }
index e1a1738a2f3f3579ffe6f4be53ad594fa2b272ec..139e684c092e2df15dec89ed90629d0f864808a1 100644 (file)
@@ -106,7 +106,7 @@ seastar::future<> Heartbeat::add_peer(osd_id_t peer, epoch_t epoch)
                            CEPH_ENTITY_TYPE_OSD),
         back_msgr.connect(osdmap->get_hb_back_addrs(peer).front(),
                           CEPH_ENTITY_TYPE_OSD))
-      .then([this, &info=peer_info->second] (auto xcon_front, auto xcon_back) {
+      .then([&info=peer_info->second] (auto xcon_front, auto xcon_back) {
         // sharded-messenger compatible mode
         info.con_front = xcon_front->release();
         info.con_back = xcon_back->release();
@@ -135,7 +135,7 @@ seastar::future<Heartbeat::osds_t> Heartbeat::remove_down_peers()
         return seastar::make_ready_future<osd_id_t>(-1);
       }
     }, osds_t{},
-    [this](osds_t&& extras, osd_id_t extra) {
+    [](osds_t&& extras, osd_id_t extra) {
       if (extra >= 0) {
         extras.push_back(extra);
       }
index 1d7abd6eb4dc3ef67d9a1926343cfbd8ee564db1..64231720bf5fa9f8578c0e6506d1d67d2bc5a4a2 100644 (file)
@@ -359,7 +359,7 @@ seastar::future<> OSD::_add_me_to_crush()
     "args": [{}]
   }})", whoami, weight, loc);
   return monc->run_command({cmd}, {}).then(
-    [this](int32_t code, string message, bufferlist) {
+    [](int32_t code, string message, bufferlist) {
       if (code) {
        logger().warn("fail to add to crush: {} ({})", message, code);
        throw std::runtime_error("fail to add to crush");
@@ -605,7 +605,7 @@ seastar::future<std::unique_ptr<OSDMap>> OSD::load_map(epoch_t e)
 {
   auto o = std::make_unique<OSDMap>();
   if (e > 0) {
-    return load_map_bl(e).then([e, o=std::move(o), this](bufferlist bl) mutable {
+    return load_map_bl(e).then([o=std::move(o)](bufferlist bl) mutable {
       o->decode(bl);
       return seastar::make_ready_future<unique_ptr<OSDMap>>(std::move(o));
     });
@@ -695,7 +695,7 @@ seastar::future<Ref<PG>> OSD::handle_pg_create_info(
            }
          }
          return make_pg(startmap, pgid).then(
-           [this, startmap=std::move(startmap)](auto pg) mutable {
+           [startmap=std::move(startmap)](auto pg) mutable {
              return seastar::make_ready_future<Ref<PG>, cached_map_t>(
                std::move(pg),
                std::move(startmap));
index 415c2e7d0f9838c5fd5a94442645d47c67c08d00..418245e6c75cb0b1a8917672d6b75c206f21ff61 100644 (file)
@@ -67,7 +67,7 @@ PGBackend::load_metadata(const hobject_t& oid)
   return store->get_attrs(
     coll,
     ghobject_t{oid, ghobject_t::NO_GEN, shard}).safe_then(
-      [oid, this](auto &&attrs) -> load_metadata_ertr::future<loaded_object_md_t::ref>{
+      [oid](auto &&attrs) -> load_metadata_ertr::future<loaded_object_md_t::ref>{
        loaded_object_md_t::ref ret(new loaded_object_md_t());
        if (auto oiiter = attrs.find(OI_ATTR); oiiter != attrs.end()) {
          bufferlist bl;
@@ -100,7 +100,7 @@ PGBackend::load_metadata(const hobject_t& oid)
 
        return load_metadata_ertr::make_ready_future<loaded_object_md_t::ref>(
          std::move(ret));
-      }, crimson::ct_error::enoent::handle([oid, this] {
+      }, crimson::ct_error::enoent::handle([oid] {
        logger().debug(
          "load_metadata: object {} doesn't exist, returning empty metadata",
          oid);
@@ -360,7 +360,7 @@ PGBackend::list_objects(const hobject_t& start, uint64_t limit) const
                              gstart,
                              ghobject_t::get_max(),
                              limit)
-    .then([this](std::vector<ghobject_t> gobjects, ghobject_t next) {
+    .then([](std::vector<ghobject_t> gobjects, ghobject_t next) {
       std::vector<hobject_t> objects;
       boost::copy(gobjects |
         boost::adaptors::filtered([](const ghobject_t& o) {
index 642a18c64be5865734dadeb9b10736e4ff52b951..6ca3f00f6b9a5cd8532b5552f05a413fa6160445 100644 (file)
@@ -63,7 +63,7 @@ seastar::future<pg_info_t, PastIntervals> PGMeta::load()
                                  string{info_key},
                                  string{biginfo_key},
                                  string{fastinfo_key}});
-  }).then([this](auto&& values) {
+  }).then([](auto&& values) {
     {
       // sanity check
       auto infover = find_value<__u8>(values, infover_key);