]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
journal: use reverse iterator search to find flush record
authorJason Dillaman <dillaman@redhat.com>
Thu, 29 Sep 2016 12:19:52 +0000 (08:19 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 5 Oct 2016 01:31:54 +0000 (21:31 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/journal/ObjectRecorder.cc

index 1079b0a8db7874ead22a21465724a02722cf072e..f329c1fbed7093e2375f939820b32f006ffb3fd0 100644 (file)
@@ -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;