From a96065815558e50361af4c701c23e5248962dfe0 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 29 Sep 2016 08:19:52 -0400 Subject: [PATCH] journal: use reverse iterator search to find flush record Signed-off-by: Jason Dillaman --- src/journal/ObjectRecorder.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/journal/ObjectRecorder.cc b/src/journal/ObjectRecorder.cc index 1079b0a8db7..f329c1fbed7 100644 --- a/src/journal/ObjectRecorder.cc +++ b/src/journal/ObjectRecorder.cc @@ -132,12 +132,16 @@ void ObjectRecorder::flush(const FutureImplPtr &future) { return; } - AppendBuffers::iterator it; - for (it = m_append_buffers.begin(); it != m_append_buffers.end(); ++it) { - if (it->first == future) { + AppendBuffers::reverse_iterator r_it; + for (r_it = m_append_buffers.rbegin(); r_it != m_append_buffers.rend(); + ++r_it) { + if (r_it->first == future) { break; } } + assert(r_it != m_append_buffers.rend()); + + auto it = (++r_it).base(); assert(it != m_append_buffers.end()); ++it; -- 2.39.5