]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/.../tri_mutex: lock() methods return normal future
authorSamuel Just <sjust@redhat.com>
Thu, 13 Jun 2024 00:47:08 +0000 (00:47 +0000)
committerSamuel Just <sjust@redhat.com>
Mon, 24 Jun 2024 00:53:42 +0000 (17:53 -0700)
commitdbdbbbd97163f08dc0b341772347deae3613c306
treeb11f28653f9accdd037a48e741efb8c069385523
parent4e14b21f03c5aa1801c1694136b35071186c19e4
crimson/.../tri_mutex: lock() methods return normal future

f63d76a2 modified the lock() variants on tri_mutex so that the obc
loading pathway wouldn't invoke .then() on returned future known
statically to be ready.  Now that the loading pathway uses demotion
mechanisms that cannot block and do not return futures, we no longer
have any users like that and can drop the extra std::nullopt
possibility.

In a larger sense, if lock() *can* return a non-ready future in a
particular pathway, there's no semantic difference between returning
std::optional<future<>> and future<> as the caller would still have to
deal with a possible non-ready future return even if std::nullopt is
also possible.  If the pathway can be demonstrated statically to be
non-blocking, as with the obc loading mechanism, we really want to use a
mechanism that obviously cannot block rather relying on a mechanism with
a return signature of std::optional<future<>> to return std::nullopt.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/tri_mutex.cc
src/crimson/common/tri_mutex.h
src/crimson/osd/object_context.h