[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230104142259.2673013-9-shikemeng@huaweicloud.com>
Date: Wed, 4 Jan 2023 22:22:54 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: axboe@...nel.dk, dwagner@...e.de, hare@...e.de,
ming.lei@...hat.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: hch@....de, john.garry@...wei.com, jack@...e.cz
Subject: [PATCH v2 08/13] blk-mq: simplify flush check in blk_mq_dispatch_rq_list
For busy error BLK_STS*_RESOURCE, request will always be added
back to list, so need_resource will not be true and ret will
not be == BLK_STS_DEV_RESOURCE if list is empty. We could remove
these dead check.
If list is empty, we only need to send extra flush
if error happens at last request in the list which is stored in
ret. So send a extra flush if ret is not BLK_STS_OK instead of
errors is non-zero to avoid unnecessary flush for error at middle
request in list.
Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
block/blk-mq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a9e88037550b..c543c14fdb47 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2085,8 +2085,8 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
/* If we didn't flush the entire list, we could have told the driver
* there was more coming, but that turned out to be a lie.
*/
- if ((!list_empty(list) || errors || needs_resource ||
- ret == BLK_STS_DEV_RESOURCE) && q->mq_ops->commit_rqs && queued)
+ if ((!list_empty(list) || ret != BLK_STS_OK) &&
+ q->mq_ops->commit_rqs && queued)
q->mq_ops->commit_rqs(hctx);
/*
* Any items that need requeuing? Stuff them into hctx->dispatch,
--
2.30.0
Powered by blists - more mailing lists