From 82fa7f2d0f082e015469b8c717425667b064ae0b Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 2 Dec 2010 11:11:22 -0800 Subject: [PATCH] logging: LogClient: refactor handle_log_ack Signed-off-by: Colin McCabe --- src/common/LogClient.cc | 11 ++++++++--- src/common/LogClient.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index 179b04c0704a9..b3900c8a852bf 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -108,9 +108,14 @@ void LogClient::handle_log_ack(MLogAck *m) dout(10) << "handle_log_ack " << *m << dendl; version_t last = m->last; - while (log_queue.size() && log_queue.begin()->seq <= last) { - dout(10) << " logged " << log_queue.front() << dendl; - log_queue.pop_front(); + + deque::iterator q = log_queue.begin(); + while (q != log_queue.end()) { + const LogEntry &entry(*q); + if (entry.seq > last) + break; + dout(10) << " logged " << entry << dendl; + q = log_queue.erase(q); } m->put(); } diff --git a/src/common/LogClient.h b/src/common/LogClient.h index aad5eb9d1adcb..1738269ae03f1 100644 --- a/src/common/LogClient.h +++ b/src/common/LogClient.h @@ -110,7 +110,7 @@ private: bool is_synchronous; Mutex log_lock; version_t last_log; - deque log_queue; + std::deque log_queue; friend class LogClientTemp; }; -- 2.39.5