]> www.infradead.org Git - users/hch/block.git/commit
block: avoid double io accounting for flush request
authorMing Lei <ming.lei@redhat.com>
Tue, 11 May 2021 15:22:33 +0000 (23:22 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 17 May 2021 15:10:30 +0000 (09:10 -0600)
commitbd9043aa34af87826d76bc6e160dfb9ea178aec4
treeb4c8277949383d54a19ca94b39ea7683a237d3dd
parent3e61083a0ff1dc7ec83b79b86fd6daa1e36c04f8
block: avoid double io accounting for flush request

For flush request, rq->end_io() may be called two times, one is from
timeout handling(blk_mq_check_expired()), another is from normal
completion(__blk_mq_end_request()).

Move blk_account_io_flush() after flush_rq->ref drops to zero, so
io accounting can be done just once for flush request.

Fixes: b68663186577 ("block: add iostat counters for flush requests")
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: John Garry <john.garry@huawei.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20210511152236.763464-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-flush.c