summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsutosh Das <asutoshd@codeaurora.org>2015-05-01 14:22:16 +0530
committerSubhash Jadavani <subhashj@codeaurora.org>2016-05-31 15:26:34 -0700
commit4d105602c48b145b4871ec951d2d51e587033e26 (patch)
treed148e8cf2a0960b5208d440e346e8c6d27c610b5
parent5bec5e8420699f14d23f0e9589ff10f916dc213b (diff)
mmc: queue: issue requests when dcmd is in progress
Requests can still be issued when dcmd is in progress. Only when discard is in progress, should the requests not be issued. Change-Id: Ief70cf2f86e9eb3817f8a390626be8433180ed87 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
-rw-r--r--drivers/mmc/card/queue.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index d47b18c20e71..98afbee58302 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -56,11 +56,14 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
}
static inline bool mmc_cmdq_should_pull_reqs(struct mmc_host *host,
- struct mmc_cmdq_context_info *ctx)
+ struct mmc_cmdq_context_info *ctx,
+ struct request *req)
+
{
- if (test_bit(CMDQ_STATE_DCMD_ACTIVE, &ctx->curr_state) ||
- mmc_host_halt(host) ||
- test_bit(CMDQ_STATE_ERR, &ctx->curr_state)) {
+ if (((req->cmd_flags & (REQ_FLUSH | REQ_DISCARD)) &&
+ test_bit(CMDQ_STATE_DCMD_ACTIVE, &ctx->curr_state)) ||
+ mmc_host_halt(host) ||
+ test_bit(CMDQ_STATE_ERR, &ctx->curr_state)) {
pr_debug("%s: %s: skip pulling reqs: state: %lu\n",
mmc_hostname(host), __func__, ctx->curr_state);
return false;
@@ -87,11 +90,6 @@ static int mmc_cmdq_thread(void *d)
while (1) {
int ret = 0;
- if (!mmc_cmdq_should_pull_reqs(host, ctx)) {
- test_and_set_bit(0, &ctx->req_starved);
- schedule();
- }
-
spin_lock_irqsave(q->queue_lock, flags);
req = blk_peek_request(q);
if (req) {
@@ -101,6 +99,16 @@ static int mmc_cmdq_thread(void *d)
test_and_set_bit(0, &ctx->req_starved);
schedule();
} else {
+ if (!mmc_cmdq_should_pull_reqs(host, ctx,
+ req)) {
+ spin_lock_irqsave(q->queue_lock, flags);
+ blk_requeue_request(q, req);
+ spin_unlock_irqrestore(q->queue_lock,
+ flags);
+ test_and_set_bit(0, &ctx->req_starved);
+ schedule();
+ continue;
+ }
ret = mq->cmdq_issue_fn(mq, req);
if (ret) {
pr_err("%s: failed (%d) to issue req, requeue\n",