On Wed, May 05, 2021 at 10:58:52PM +0800, Ming Lei wrote: > 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@xxxxxxx> > Tested-by: John Garry <john.garry@xxxxxxxxxx> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> Looks good, Reviewed-by: Christoph Hellwig <hch@xxxxxx> Alhought while reviewing this I have to say that the flush code is one hard to follow mess, and the extra reference doesn't help..