]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: remove extraneous co_return
authorKefu Chai <k.chai@proxmox.com>
Fri, 12 Jun 2026 08:06:33 +0000 (16:06 +0800)
committerKefu Chai <k.chai@proxmox.com>
Wed, 17 Jun 2026 10:54:08 +0000 (18:54 +0800)
no need to use co_return at the end of a coroutine which returns
future<>. despite that this does not incur performance penalty,
because:

co_await func() // func returns future<>

returns void

co_return is called with void operand, this statement is lowered to

promise.return_void()

and a bare "co_await func()" also calls return_void(). so they are
equivalent at runtime. but the extraneous co_return can be dispensed.

also take this opportunity to remove the bare co_return at the end
of a coroutine. it's unnecessary just like a `return` at the end of
a function returning `void`.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/crimson/osd/osd.cc

index d742eef94be19be731b9216bc29db2d4fc041f89..55e01cabef4e38fd2dbc81e668b17652d8b63c22 100644 (file)
@@ -344,7 +344,6 @@ seastar::future<> OSD::mkfs(
   co_await store.umount();
 
   co_await store.stop();
-  co_return;
 }
 
 seastar::future<> OSD::_write_superblock(
@@ -712,7 +711,7 @@ seastar::future<> OSD::_send_boot()
   if (ret == 0) {
     m->metadata["osd_objectstore"] = type;
   }
-  co_return co_await monc->send_message(std::move(m));
+  co_await monc->send_message(std::move(m));
 }
 
 seastar::future<> OSD::_add_device_class()
@@ -744,8 +743,6 @@ seastar::future<> OSD::_add_device_class()
   } else {
     INFO("device_class was set: {}", message);
   }
-
-  co_return;
 }
 
 seastar::future<> OSD::_add_me_to_crush()