linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm mpath: fix missing blk_account_io_done() in error path
@ 2022-01-25 12:26 Yu Kuai
  2022-01-25 20:41 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Kuai @ 2022-01-25 12:26 UTC (permalink / raw)
  To: snitzer, axboe; +Cc: linux-block, linux-kernel, yukuai3, yi.zhang

If blk_mq_request_issue_directly() failed from
blk_insert_cloned_request(), the request will be accounted start.
Currently, blk_insert_cloned_request() is only called by dm, and such
request won't be accounted done by dm.

In normal path, io will be accounted start from blk_mq_bio_to_request(),
when the request is allocated, and such io will be accounted done from
__blk_mq_end_request_acct() whether it succeeded or failed. Thus add
blk_account_io_done() to fix the problem.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-mq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d73bc219a7fa..d73490fe200d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
 	 */
 	blk_mq_run_dispatch_ops(rq->q,
 			ret = blk_mq_request_issue_directly(rq, true));
+	if (ret)
+		blk_account_io_done(rq, ktime_get_ns());
 	return ret;
 }
 EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dm mpath: fix missing blk_account_io_done() in error path
  2022-01-25 12:26 [PATCH] dm mpath: fix missing blk_account_io_done() in error path Yu Kuai
@ 2022-01-25 20:41 ` Christoph Hellwig
  2022-01-26  1:07   ` yukuai (C)
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2022-01-25 20:41 UTC (permalink / raw)
  To: Yu Kuai; +Cc: snitzer, axboe, linux-block, linux-kernel, yi.zhang

On Tue, Jan 25, 2022 at 08:26:54PM +0800, Yu Kuai wrote:
> If blk_mq_request_issue_directly() failed from
> blk_insert_cloned_request(), the request will be accounted start.
> Currently, blk_insert_cloned_request() is only called by dm, and such
> request won't be accounted done by dm.
> 
> In normal path, io will be accounted start from blk_mq_bio_to_request(),
> when the request is allocated, and such io will be accounted done from
> __blk_mq_end_request_acct() whether it succeeded or failed. Thus add
> blk_account_io_done() to fix the problem.

The patch looks good, but the subject is incorrect, this is not in
dm-mpath but in the block layer.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dm mpath: fix missing blk_account_io_done() in error path
  2022-01-25 20:41 ` Christoph Hellwig
@ 2022-01-26  1:07   ` yukuai (C)
  0 siblings, 0 replies; 3+ messages in thread
From: yukuai (C) @ 2022-01-26  1:07 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: snitzer, axboe, linux-block, linux-kernel, yi.zhang

在 2022/01/26 4:41, Christoph Hellwig 写道:
> On Tue, Jan 25, 2022 at 08:26:54PM +0800, Yu Kuai wrote:
>> If blk_mq_request_issue_directly() failed from
>> blk_insert_cloned_request(), the request will be accounted start.
>> Currently, blk_insert_cloned_request() is only called by dm, and such
>> request won't be accounted done by dm.
>>
>> In normal path, io will be accounted start from blk_mq_bio_to_request(),
>> when the request is allocated, and such io will be accounted done from
>> __blk_mq_end_request_acct() whether it succeeded or failed. Thus add
>> blk_account_io_done() to fix the problem.
> 
> The patch looks good, but the subject is incorrect, this is not in
> dm-mpath but in the block layer.
> .
> 

Ok, I'll fix that.

Thanks,
Kuai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-26  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 12:26 [PATCH] dm mpath: fix missing blk_account_io_done() in error path Yu Kuai
2022-01-25 20:41 ` Christoph Hellwig
2022-01-26  1:07   ` yukuai (C)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).