From 93598473ebe9057322df85c09e2f69e3867b566b Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 20 Nov 2015 08:44:53 -0500 Subject: [PATCH] librbd: commit journal op events immediately Op events are split into a start and finish record, so they can be immediately marked as committed within the journal. Signed-off-by: Jason Dillaman --- src/librbd/Journal.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index 5b610988672..d83438c6023 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -318,17 +318,20 @@ uint64_t Journal::append_op_event(journal::EventEntry &event_entry) { bufferlist bl; ::encode(event_entry, bl); - m_journaler->append("", bl); + m_journaler->committed(m_journaler->append("", bl)); } CephContext *cct = m_image_ctx.cct; - ldout(cct, 20) << this << " " << __func__ << ": " + ldout(cct, 10) << this << " " << __func__ << ": " << "event=" << event_entry.get_event_type() << ", " << "tid=" << tid << dendl; return tid; } void Journal::commit_op_event(uint64_t tid, int r) { + CephContext *cct = m_image_ctx.cct; + ldout(cct, 10) << this << " " << __func__ << ": tid=" << tid << dendl; + journal::EventEntry event_entry((journal::OpFinishEvent(tid, r))); bufferlist bl; @@ -338,7 +341,7 @@ void Journal::commit_op_event(uint64_t tid, int r) { Mutex::Locker locker(m_lock); assert(m_state == STATE_RECORDING); - m_journaler->append("", bl); + m_journaler->committed(m_journaler->append("", bl)); } } -- 2.47.3