From 2dbf1d6e43d50e8bb93b5c5d2dfb40c59f13ebd8 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Fri, 20 Oct 2017 19:45:11 +0800 Subject: [PATCH] librbd: avoid checking completed_reqs.empty() every time. Signed-off-by: Jianpeng Ma --- src/librbd/internal.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 9b322997014dc..357f24dd3269f 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2269,9 +2269,8 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) { << dendl; int i = 0; Mutex::Locker l(ictx->completed_reqs_lock); + numcomp = std::min(numcomp, (int)ictx->completed_reqs.size()); while (i < numcomp) { - if (ictx->completed_reqs.empty()) - break; comps[i++] = ictx->completed_reqs.front(); ictx->completed_reqs.pop_front(); } -- 2.39.5