• Baolin Wang's avatar
    blk-throttle: Avoid calculating bps/iops limitation repeatedly · 4599ea49
    Baolin Wang authored
    The tg_may_dispatch() will call tg_with_in_bps_limit() and
    tg_with_in_iops_limit() to check if we can dispatch a bio or
    not, which will calculate bps/iops limitation multiple times.
    But tg_may_dispatch() is always called under queue lock, which
    means the bps/iops limitation will not change in tg_may_dispatch().
    
    So we can calculate the bps/iops limitation only once, and pass
    them to tg_with_in_bps_limit() and tg_with_in_iops_limit() to
    avoid calculating bps/iops limitation repeatedly.
    Signed-off-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    4599ea49
blk-throttle.c 67.5 KB