From: "Christian Löhle" <CLoehle@hyperstone.com>
To: "axboe@kernel.dk" <axboe@kernel.dk>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Cc: "Avri Altman" <Avri.Altman@wdc.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"vincent.whitchurch@axis.com" <vincent.whitchurch@axis.com>,
"Christian Löhle" <CLoehle@hyperstone.com>
Subject: [PATCH 3/3] mmc: block: Requeue on block size restrictions
Date: Wed, 26 Oct 2022 07:30:44 +0000 [thread overview]
Message-ID: <f3b05a9103ba4c46ae78a96f8cdc700d@hyperstone.com> (raw)
The block layer does not conform to all our sector count restrictions, so
requeue in case we had to modify the number of blocks sent instead of
going through the normal completion.
Note that the normal completion used before does not lead to a bug,
this change is just the nicer thing to do.
An example of such a restriction is max_blk_count = 1 and 512 blksz,
but the block layer continues to use requests of size PAGE_SIZE.
Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
drivers/mmc/core/block.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 54cd009aee50..c434d3964880 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1519,8 +1519,10 @@ static void mmc_blk_cqe_req_done(struct mmc_request *mrq)
/*
* Block layer timeouts race with completions which means the normal
* completion path cannot be used during recovery.
+ * Also do not use it if we had to modify the block count to satisfy
+ * host controller needs.
*/
- if (mq->in_recovery)
+ if (mq->in_recovery || mrq->data->blocks != blk_rq_sectors(req))
mmc_blk_cqe_complete_rq(mq, req);
else if (likely(!blk_should_fake_timeout(req->q)))
blk_mq_complete_request(req);
@@ -2051,8 +2053,10 @@ static void mmc_blk_hsq_req_done(struct mmc_request *mrq)
/*
* Block layer timeouts race with completions which means the normal
* completion path cannot be used during recovery.
+ * Also do not use it if we had to modify the block count to satisfy
+ * host controller needs.
*/
- if (mq->in_recovery)
+ if (mq->in_recovery || mrq->data->blocks != blk_rq_sectors(req))
mmc_blk_cqe_complete_rq(mq, req);
else if (likely(!blk_should_fake_timeout(req->q)))
blk_mq_complete_request(req);
@@ -2115,8 +2119,10 @@ static void mmc_blk_mq_post_req(struct mmc_queue *mq, struct request *req,
/*
* Block layer timeouts race with completions which means the normal
* completion path cannot be used during recovery.
+ * Also do not use it if we had to modify the block count to satisfy
+ * host controller needs.
*/
- if (mq->in_recovery) {
+ if (mq->in_recovery || mrq->data->blocks != blk_rq_sectors(req)) {
mmc_blk_mq_complete_rq(mq, req);
} else if (likely(!blk_should_fake_timeout(req->q))) {
if (can_sleep)
--
2.37.3
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
next reply other threads:[~2022-10-26 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-26 7:30 Christian Löhle [this message]
2022-11-18 11:34 ` [PATCH 3/3] mmc: block: Requeue on block size restrictions Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f3b05a9103ba4c46ae78a96f8cdc700d@hyperstone.com \
--to=cloehle@hyperstone.com \
--cc=Avri.Altman@wdc.com \
--cc=adrian.hunter@intel.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.whitchurch@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).