]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: Overload ShardServices::send_to_osd() to take unique_ptr
authorAmnon Hanuhov <ahanukov@redhat.com>
Tue, 4 May 2021 13:12:43 +0000 (16:12 +0300)
committerAmnon Hanuhov <ahanukov@redhat.com>
Thu, 6 May 2021 17:22:06 +0000 (20:22 +0300)
Signed-off-by: Amnon Hanuhov <ahanukov@redhat.com>
src/crimson/osd/shard_services.cc
src/crimson/osd/shard_services.h

index 9ae11f7132f14bb28f0d38873347591afef07ad8..09246884b573995ed727db333e765ef991136aaa 100644 (file)
@@ -85,8 +85,10 @@ void ShardServices::handle_conf_change(const ConfigProxy& conf,
   }
 }
 
-seastar::future<> ShardServices::send_to_osd(
-  int peer, Ref<Message> m, epoch_t from_epoch) {
+template<class MsgT>
+seastar::future<> ShardServices::do_send_to_osd(
+  int peer, MsgT m, epoch_t from_epoch)
+{
   if (osdmap->is_down(peer)) {
     logger().info("{}: osd.{} is_down", __func__, peer);
     return seastar::now();
@@ -97,10 +99,22 @@ seastar::future<> ShardServices::send_to_osd(
   } else {
     auto conn = cluster_msgr.connect(
         osdmap->get_cluster_addrs(peer).front(), CEPH_ENTITY_TYPE_OSD);
-    return conn->send(m);
+    return conn->send(std::move(m));
   }
 }
 
+seastar::future<> ShardServices::send_to_osd(
+  int peer, MessageRef m, epoch_t from_epoch) 
+{
+  return do_send_to_osd(peer, std::move(m), from_epoch);
+}
+
+seastar::future<> ShardServices::send_to_osd(
+  int peer, MessageURef m, epoch_t from_epoch) 
+{
+  return do_send_to_osd(peer, std::move(m), from_epoch);
+}
+
 seastar::future<> ShardServices::dispatch_context_transaction(
   crimson::os::CollectionRef col, PeeringCtx &ctx) {
   auto ret = store.do_transaction(
index 3bcf0d3e4e46424dc283503138a2fe3679372c50..3e37f608e7c0bd07a7fe0a4a7a9d182fe5424e45 100644 (file)
@@ -59,6 +59,9 @@ class ShardServices : public md_config_obs_t {
   const char** get_tracked_conf_keys() const final;
   void handle_conf_change(const ConfigProxy& conf,
                           const std::set <std::string> &changed) final;
+  template<class MsgT>
+  seastar::future<> do_send_to_osd(int peer, MsgT m, epoch_t from_epoch);
+
 public:
   ShardServices(
     OSDMapService &osdmap_service,
@@ -74,6 +77,11 @@ public:
     MessageRef m,
     epoch_t from_epoch);
 
+  seastar::future<> send_to_osd(
+    int peer,
+    MessageURef m,
+    epoch_t from_epoch);
+
   crimson::os::FuturizedStore &get_store() {
     return store;
   }