]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: avoid checking completed_reqs.empty() every time. 18419/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 20 Oct 2017 11:45:11 +0000 (19:45 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 20 Oct 2017 11:45:11 +0000 (19:45 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/librbd/internal.cc

index 9b322997014dc7a06943416853be5cdc432389f9..357f24dd3269f6e0535397bdf2ed0ba5ccf2cfdd 100644 (file)
@@ -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();
     }