From 059a877f05bd3d25d50a5c7f867f509d2979ff76 Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 1 Dec 2016 18:59:26 +0000 Subject: [PATCH] osdc/Journaler: add have_waiter() Allows users of wait_for_readable to conveniently see if there is already a waiter. Yes, they could do this themselves, but I'd rather peek at an existing variable than add a new one caller-side. Signed-off-by: John Spray --- src/osdc/Journaler.cc | 9 ++++++++- src/osdc/Journaler.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 629450d030f..22e5327c11c 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -946,7 +946,9 @@ void Journaler::_assimilate_prefetch() if ((got_any && !was_readable && readable) || read_pos == write_pos) { // readable! - ldout(cct, 10) << "_finish_read now readable (or at journal end)" << dendl; + ldout(cct, 10) << "_finish_read now readable (or at journal end) readable=" + << readable << " read_pos=" << read_pos << " write_pos=" + << write_pos << dendl; if (on_readable) { C_OnFinisher *f = on_readable; on_readable = 0; @@ -1216,6 +1218,11 @@ void Journaler::wait_for_readable(Context *onreadable) } } +bool Journaler::have_waiter() const +{ + return on_readable != nullptr; +} + diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index cf0e08c63e9..5532d5c07c6 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -442,6 +442,7 @@ public: void wait_for_flush(Context *onsafe = 0); void flush(Context *onsafe = 0); void wait_for_readable(Context *onfinish); + bool have_waiter() const; // Synchronous setters // =================== -- 2.47.3