From: Kefu Chai Date: Thu, 10 Sep 2020 11:38:02 +0000 (+0800) Subject: crimson/osd: optimize the fast path of get_recovery_read() X-Git-Tag: v16.1.0~1125^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e7ed50a7187f98a28e6831899467396da7385a3e;p=ceph.git crimson/osd: optimize the fast path of get_recovery_read() no need to enqueue if the lock can be acquired without waiting for it. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/object_context.h b/src/crimson/osd/object_context.h index 6a2ba9f2c877..40bda6592e84 100644 --- a/src/crimson/osd/object_context.h +++ b/src/crimson/osd/object_context.h @@ -204,8 +204,9 @@ public: return put_lock_type(RWState::RWREAD); } seastar::future get_recovery_read(bool can_wait = false) { - if (!can_wait) { - return seastar::make_ready_future(rwstate.get_recovery_read()); + if (bool acquired = rwstate.get_recovery_read(); + acquired || !can_wait) { + return seastar::make_ready_future(acquired); } return with_queue([this] { return rwstate.get_recovery_read();