From patchwork Thu Nov 1 12:41:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tlinder X-Patchwork-Id: 1684941 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 16699DFE75 for ; Thu, 1 Nov 2012 12:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754294Ab2KAMlN (ORCPT ); Thu, 1 Nov 2012 08:41:13 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:49718 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772Ab2KAMlM (ORCPT ); Thu, 1 Nov 2012 08:41:12 -0400 X-IronPort-AV: E=McAfee;i="5400,1158,6882"; a="3397767" Received: from pdmz-ns-mip.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.114.10]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Nov 2012 05:41:12 -0700 Received: from lx-tlinder2.qi.qualcomm.com (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 8E3FE10004BF; Thu, 1 Nov 2012 05:41:09 -0700 (PDT) From: tlinder To: linux-mmc@vger.kernel.org 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, Tatyana Brokhman , linux-kernel@vger.kernel.org (open list) Subject: [RFC/PATCH v2 1/2] block:row: Adding support for reinsert already dispatched req Date: Thu, 1 Nov 2012 14:41:03 +0200 Message-Id: <1351773663-19604-1-git-send-email-tlinder@codeaurora.org> X-Mailer: git-send-email 1.7.6 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Tatyana Brokhman 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 diff --git a/block/row-iosched.c b/block/row-iosched.c index b7965c6..62789a4 100644 --- a/block/row-iosched.c +++ b/block/row-iosched.c @@ -273,6 +273,33 @@ static void row_add_request(struct request_queue *q, } /* + * row_reinsert_req() - Reinsert request back to the scheduler + * @q: dispatch 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 */ + BUG_ON(rqueue != &rd->row_queues[rqueue->prio].rqueue); + + 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 @@ -656,6 +683,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,