From: John Spray Date: Thu, 1 Dec 2016 18:59:26 +0000 (+0000) Subject: osdc/Journaler: add have_waiter() X-Git-Tag: v12.0.1~140^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=059a877f05bd3d25d50a5c7f867f509d2979ff76;p=ceph.git 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 --- diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 629450d030fa..22e5327c11c1 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 cf0e08c63e96..5532d5c07c6f 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 // ===================