// prevent new write ops but allow pending ops to flush to the journal
block_writes();
}
+ if (m_state == STATE_RECORDING) {
+ flush_journal();
+ }
} else if ((state == ImageWatcher::LOCK_UPDATE_STATE_NOT_SUPPORTED ||
state == ImageWatcher::LOCK_UPDATE_STATE_UNLOCKED) &&
m_state != STATE_UNINITIALIZED &&
}
}
+void Journal::flush_journal() {
+ assert(m_lock.is_locked());
+
+ CephContext *cct = m_image_ctx.cct;
+ ldout(cct, 20) << this << " " << __func__ << dendl;
+
+ m_lock.Unlock();
+ C_SaferCond cond_ctx;
+ m_journaler->flush(&cond_ctx);
+ cond_ctx.wait();
+ m_lock.Lock();
+}
+
void Journal::transition_state(State state) {
CephContext *cct = m_image_ctx.cct;
ldout(cct, 20) << this << " " << __func__ << ": new state=" << state << dendl;