Skip to content

Commit

Permalink
common:bench test bug when <seconds>=0
Browse files Browse the repository at this point in the history
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 <seconds> set as 0

Signed-off-by:PCzhangPC pengcheng.zhang@easystack.cn
  • Loading branch information
PC authored and PCzhangPC committed Aug 8, 2017
1 parent 32297cc commit 7258c99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/obj_bencher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7258c99

Please sign in to comment.