Re: [PATCH RFC 04/14] block, bfq: modify the peak-rate estimator

From: Bart Van Assche
Date: Mon Mar 06 2017 - 20:05:38 EST


On Sat, 2017-03-04 at 17:01 +0100, Paolo Valente wrote:
> +static sector_t get_sdist(sector_t last_pos, struct request *rq)
> +{
> + sector_t sdist = 0;
> +
> + if (last_pos) {
> + if (last_pos < blk_rq_pos(rq))
> + sdist = blk_rq_pos(rq) - last_pos;
> + else
> + sdist = last_pos - blk_rq_pos(rq);
> + }
> +
> + return sdist;
> +}

Have you considered to use abs() from <linux/kernel.h>?

Thanks,

Bart.