From: PC Date: Thu, 13 Jul 2017 05:38:46 +0000 (+0800) Subject: common:bench test bug when =0 X-Git-Tag: v13.0.0~165^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16382%2Fhead;p=ceph.git common:bench test bug when =0 Fixes: src/common/obj_bencher.cc b/src/common/obj_bencher.cc :write_bench(),seq_read_bench(),rand_read_bench() the program may fall into a dead loop if the set as 0 Signed-off-by:PCzhangPC pengcheng.zhang@easystack.cn --- diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index 4eaeba3471f7..411dac3dd9d6 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -460,7 +460,7 @@ int ObjBencher::write_bench(int secondsToRun, stopTime = data.start_time + runtime; slot = 0; lock.Lock(); - while (!secondsToRun || ceph_clock_now() < stopTime) { + while (secondsToRun && ceph_clock_now() < stopTime) { bool found = false; while (1) { int old_slot = slot; @@ -690,7 +690,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre bufferlist *cur_contents; slot = 0; - while ((!seconds_to_run || ceph_clock_now() < finish_time) && + while ((seconds_to_run && ceph_clock_now() < finish_time) && num_objects > data.started) { lock.Lock(); int old_slot = slot; @@ -920,7 +920,7 @@ int ObjBencher::rand_read_bench(int seconds_to_run, int num_objects, int concurr int rand_id; slot = 0; - while ((!seconds_to_run || ceph_clock_now() < finish_time)) { + while ((seconds_to_run && ceph_clock_now() < finish_time)) { lock.Lock(); int old_slot = slot; bool found = false;