From: Omar Sandoval Date: Thu, 16 Mar 2017 15:46:14 +0000 (-0600) Subject: blk-stat: fix blk_stat_sum() if all samples are batched X-Git-Tag: v4.14-rc1~1015^2~321 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d8d00140715a115193bf502fa3b0cfe620f0dd9;p=platform%2Fkernel%2Flinux-rpi3.git blk-stat: fix blk_stat_sum() if all samples are batched 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 Signed-off-by: Jens Axboe --- diff --git a/block/blk-stat.c b/block/blk-stat.c index 9b43efb..186fcb9 100644 --- a/block/blk-stat.c +++ b/block/blk-stat.c @@ -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);