handle_unblocked_stack(stacks, blocked_stack, &blocked_count);
}
- if (blocked_count >= ops_window) {
- int ret = completion_mgr.get_next((void **)&blocked_stack);
- if (ret < 0) {
- ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
- }
- handle_unblocked_stack(stacks, blocked_stack, &blocked_count);
- }
-
++iter;
stacks.pop_front();
- while (iter == stacks.end() && blocked_count > 0) {
+
+ while (stacks.empty() && blocked_count > 0) {
int ret = completion_mgr.get_next((void **)&blocked_stack);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
handle_unblocked_stack(stacks, blocked_stack, &blocked_count);
iter = stacks.begin();
}
+
+ if (iter == stacks.end()) {
+ iter = stacks.begin();
+ }
}
return 0;