Skip to content

Commit

Permalink
row: Adding support for reinsert already dispatched req
Browse files Browse the repository at this point in the history
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.

Change-Id: I70954df300774409c25b5821465fb3aa33d8feb5
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
  • Loading branch information
Tatyana Brokhman authored and Daz Jones committed Oct 12, 2013
1 parent 329c71e commit dbd65e6
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion block/row-iosched.c
Expand Up @@ -272,7 +272,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
Expand Down Expand Up @@ -656,6 +688,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,
Expand Down

0 comments on commit dbd65e6

Please sign in to comment.