linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tanya Brokhman <tlinder@codeaurora.org>
To: jaxboe@fusionio.com
Cc: linux-arm-msm@vger.kernel.org, philippedeswert@gmail.com,
	jengelh@inai.de, jh80.chung@samsung.com, tgih.jun@samsung.com,
	arnd.bergmann@linaro.org, venkat@linaro.org,
	linux-mmc@vger.kernel.org,
	Tanya Brokhman <tlinder@codeaurora.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v3 1/2] row: Adding support for reinsert already dispatched req
Date: Tue, 11 Dec 2012 15:43:19 +0200	[thread overview]
Message-ID: <1355233400-26269-2-git-send-email-tlinder@codeaurora.org> (raw)
In-Reply-To: <1355233400-26269-1-git-send-email-tlinder@codeaurora.org>

Add support for reinserting already dispatched request back to the
schedulers internal data structures.
The request will be reinserted back to the queue (head) it was
dispatched from as if it was never dispatched.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
---
v3: Update error handling when row queue is not set for a request  
v2: Nothing changed. Resend
v1: Initial version

diff --git a/block/row-iosched.c b/block/row-iosched.c
index 1f50180..b3204d6 100644
--- a/block/row-iosched.c
+++ b/block/row-iosched.c
@@ -274,7 +274,39 @@ static void row_add_request(struct request_queue *q,
 	row_log_rowq(rd, rqueue->prio, "added request");
 }
 
-/*
+/**
+ * row_reinsert_req() - Reinsert request back to the scheduler
+ * @q:	requests queue
+ * @rq:	request to add
+ *
+ * Reinsert the given request back to the queue it was
+ * dispatched from as if it was never dispatched.
+ *
+ * Returns 0 on success, error code otherwise
+ */
+static int row_reinsert_req(struct request_queue *q,
+			    struct request *rq)
+{
+	struct row_data    *rd = q->elevator->elevator_data;
+	struct row_queue   *rqueue = RQ_ROWQ(rq);
+
+	/* Verify rqueue is legitimate */
+	if (rqueue->prio >= ROWQ_MAX_PRIO) {
+		pr_err("\n\nROW BUG: row_reinsert_req() rqueue->prio = %d\n",
+			   rqueue->prio);
+		blk_dump_rq_flags(rq, "");
+		return -EIO;
+	}
+
+	list_add(&rq->queuelist, &rqueue->fifo);
+	rd->nr_reqs[rq_data_dir(rq)]++;
+
+	row_log_rowq(rd, rqueue->prio, "request reinserted");
+
+	return 0;
+}
+
+/**
  * row_remove_request() -  Remove given request from scheduler
  * @q:	requests queue
  * @rq:	request to remove
@@ -664,6 +696,7 @@ static struct elevator_type iosched_row = {
 		.elevator_merge_req_fn		= row_merged_requests,
 		.elevator_dispatch_fn		= row_dispatch_requests,
 		.elevator_add_req_fn		= row_add_request,
+		.elevator_reinsert_req_fn	= row_reinsert_req,
 		.elevator_former_req_fn		= elv_rb_former_request,
 		.elevator_latter_req_fn		= elv_rb_latter_request,
 		.elevator_set_req_fn		= row_set_request,
-- 
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. 
Is a member of Code Aurora Forum, hosted by the Linux Foundation

       reply	other threads:[~2012-12-11 13:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1355233400-26269-1-git-send-email-tlinder@codeaurora.org>
2012-12-11 13:43 ` Tanya Brokhman [this message]
2012-12-11 13:43 ` [PATCH/RESEND v3 2/2] row: Add support for urgent request handling Tanya Brokhman

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=1355233400-26269-2-git-send-email-tlinder@codeaurora.org \
    --to=tlinder@codeaurora.org \
    --cc=arnd.bergmann@linaro.org \
    --cc=jaxboe@fusionio.com \
    --cc=jengelh@inai.de \
    --cc=jh80.chung@samsung.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=philippedeswert@gmail.com \
    --cc=tgih.jun@samsung.com \
    --cc=venkat@linaro.org \
    /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).