From patchwork Tue Feb 4 10:54:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 3574951 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8C3079F39A for ; Tue, 4 Feb 2014 10:58:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE71920158 for ; Tue, 4 Feb 2014 10:58:58 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id D118C20179 for ; Tue, 4 Feb 2014 10:58:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s14AtQQj013953; Tue, 4 Feb 2014 05:55:27 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s14Asi40023547 for ; Tue, 4 Feb 2014 05:54:44 -0500 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s14Asiec031711; Tue, 4 Feb 2014 05:54:44 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s14Asgk3020768; Tue, 4 Feb 2014 05:54:42 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 54FBEAC8A; Tue, 4 Feb 2014 10:54:42 +0000 (UTC) From: Hannes Reinecke To: Alasdair Kergon Date: Tue, 4 Feb 2014 11:54:35 +0100 Message-Id: <1391511280-29325-3-git-send-email-hare@suse.de> In-Reply-To: <1391511280-29325-1-git-send-email-hare@suse.de> References: <1391511280-29325-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.835 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: "Jun'ichi Nomura" , dm-devel@redhat.com, Mike Snitzer Subject: [dm-devel] [PATCH 2/7] dm table: add dm_table_run_md_queue_async X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mike Snitzer Introduce dm_table_run_md_queue_async() to run the request_queue of the mapped_device associated with a request-based DM table. Also add dm_md_get_queue() wrapper to extract the request_queue from a mapped_device. Signed-off-by: Mike Snitzer Signed-off-by: Hannes Reinecke Reviewed-by: Jun'ichi Nomura --- drivers/md/dm-table.c | 19 +++++++++++++++++++ drivers/md/dm.c | 5 +++++ drivers/md/dm.h | 1 + include/linux/device-mapper.h | 5 +++++ 4 files changed, 30 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 6a7f2b8..8df63ed 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1618,6 +1618,25 @@ struct mapped_device *dm_table_get_md(struct dm_table *t) } EXPORT_SYMBOL(dm_table_get_md); +void dm_table_run_md_queue_async(struct dm_table *t) +{ + struct mapped_device *md; + struct request_queue *queue; + unsigned long flags; + + if (!dm_table_request_based(t)) + return; + + md = dm_table_get_md(t); + queue = dm_get_md_queue(md); + if (queue) { + spin_lock_irqsave(queue->queue_lock, flags); + blk_run_queue_async(queue); + spin_unlock_irqrestore(queue->queue_lock, flags); + } +} +EXPORT_SYMBOL(dm_table_run_md_queue_async); + static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data) { diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8c53b09..341991f 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -475,6 +475,11 @@ sector_t dm_get_size(struct mapped_device *md) return get_capacity(md->disk); } +struct request_queue *dm_get_md_queue(struct mapped_device *md) +{ + return md->queue; +} + struct dm_stats *dm_get_stats(struct mapped_device *md) { return &md->stats; diff --git a/drivers/md/dm.h b/drivers/md/dm.h index c4569f0..1b2ca8a 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -189,6 +189,7 @@ int dm_lock_for_deletion(struct mapped_device *md, bool mark_deferred, bool only int dm_cancel_deferred_remove(struct mapped_device *md); int dm_request_based(struct mapped_device *md); sector_t dm_get_size(struct mapped_device *md); +struct request_queue *dm_get_md_queue(struct mapped_device *md); struct dm_stats *dm_get_stats(struct mapped_device *md); int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action, diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ed419c6..250225b 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -466,6 +466,11 @@ struct mapped_device *dm_table_get_md(struct dm_table *t); void dm_table_event(struct dm_table *t); /* + * Run the queue for request-based targets. + */ +void dm_table_run_md_queue_async(struct dm_table *t); + +/* * The device must be suspended before calling this method. * Returns the previous table, which the caller must destroy. */