summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2016-09-29 14:19:52 +0200
committerJason Dillaman <dillaman@redhat.com>2016-10-05 03:31:54 +0200
commita96065815558e50361af4c701c23e5248962dfe0 (patch)
treeb23cbfd520f9af33c455d7ff39e580496001c7bb
parentjournal: avoid holding lock while sending journal append (diff)
downloadceph-a96065815558e50361af4c701c23e5248962dfe0.tar.xz
ceph-a96065815558e50361af4c701c23e5248962dfe0.zip
journal: use reverse iterator search to find flush record
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
-rw-r--r--src/journal/ObjectRecorder.cc10
1 files 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;