From patchwork Wed Sep 14 16:29:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 9331949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48C4F6089F for ; Wed, 14 Sep 2016 16:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B7A12A1C2 for ; Wed, 14 Sep 2016 16:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3067D2A1C8; Wed, 14 Sep 2016 16:29:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CED422A1C6 for ; Wed, 14 Sep 2016 16:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757915AbcINQ3o (ORCPT ); Wed, 14 Sep 2016 12:29:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45426 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759121AbcINQ3n (ORCPT ); Wed, 14 Sep 2016 12:29:43 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C18DC0DA371; Wed, 14 Sep 2016 16:29:43 +0000 (UTC) Received: from localhost (vpn-49-123.rdu2.redhat.com [10.10.49.123]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8EGTg5G005860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 14 Sep 2016 12:29:43 -0400 From: Mike Snitzer To: axboe@kernel.dk, dm-devel@redhat.com Cc: linux-block@vger.kernel.org Subject: [PATCH v2 4/6] dm rq: introduce dm_mq_kick_requeue_list() Date: Wed, 14 Sep 2016 12:29:34 -0400 Message-Id: <1473870576-54331-5-git-send-email-snitzer@redhat.com> In-Reply-To: <1473870576-54331-1-git-send-email-snitzer@redhat.com> References: <1473870576-54331-1-git-send-email-snitzer@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 14 Sep 2016 16:29:43 +0000 (UTC) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make it possible for a request-based target to kick the DM device's blk-mq request_queue's requeue_list. Signed-off-by: Mike Snitzer Reviewed-by: Hannes Reinecke --- drivers/md/dm-rq.c | 17 +++++++++++++---- drivers/md/dm-rq.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index bdbfe05..726cb3b 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -336,19 +336,28 @@ static void dm_old_requeue_request(struct request *rq) spin_unlock_irqrestore(q->queue_lock, flags); } -static void dm_mq_delay_requeue_request(struct request *rq, unsigned long msecs) +static void __dm_mq_kick_requeue_list(struct request_queue *q, unsigned long msecs) { - struct request_queue *q = rq->q; unsigned long flags; - blk_mq_requeue_request(rq); - spin_lock_irqsave(q->queue_lock, flags); if (!blk_queue_stopped(q)) blk_mq_delay_kick_requeue_list(q, msecs_to_jiffies(msecs)); spin_unlock_irqrestore(q->queue_lock, flags); } +void dm_mq_kick_requeue_list(struct mapped_device *md) +{ + __dm_mq_kick_requeue_list(dm_get_md_queue(md), 0); +} +EXPORT_SYMBOL(dm_mq_kick_requeue_list); + +static void dm_mq_delay_requeue_request(struct request *rq, unsigned long msecs) +{ + blk_mq_requeue_request(rq); + __dm_mq_kick_requeue_list(rq->q, msecs); +} + static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_requeue) { struct mapped_device *md = tio->md; diff --git a/drivers/md/dm-rq.h b/drivers/md/dm-rq.h index 9e6f0a3..4da06ca 100644 --- a/drivers/md/dm-rq.h +++ b/drivers/md/dm-rq.h @@ -55,6 +55,8 @@ void dm_mq_cleanup_mapped_device(struct mapped_device *md); void dm_start_queue(struct request_queue *q); void dm_stop_queue(struct request_queue *q); +void dm_mq_kick_requeue_list(struct mapped_device *md); + unsigned dm_get_reserved_rq_based_ios(void); ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf);