Skip to content

Commit

Permalink
blk-stat: fix blk_stat_sum() if all samples are batched
Browse files Browse the repository at this point in the history
We need to flush the batch _before_ we check the number of samples,
otherwise we'll miss all of the batched samples.

Fixes: cf43e6b ("block: add scalable completion tracking of requests")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
osandov authored and axboe committed Mar 16, 2017
1 parent 69eea5a commit efd4b81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/blk-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ static void blk_stat_flush_batch(struct blk_rq_stat *stat)

static void blk_stat_sum(struct blk_rq_stat *dst, struct blk_rq_stat *src)
{
blk_stat_flush_batch(src);

if (!src->nr_samples)
return;

blk_stat_flush_batch(src);

dst->min = min(dst->min, src->min);
dst->max = max(dst->max, src->max);

Expand Down

0 comments on commit efd4b81

Please sign in to comment.