Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5ce2d8c authored by Asutosh Das's avatar Asutosh Das Committed by Matt Wagantall
Browse files

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: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarVenkat Gopalakrishnan <venkatg@codeaurora.org>
parent b413fc08
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -55,9 +55,12 @@ 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) ||
	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",
@@ -86,11 +89,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) {
@@ -100,6 +98,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",