From patchwork Wed Jun 29 14:51:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9205551 X-Patchwork-Delegate: snitzer@redhat.com 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 F23906075F for ; Wed, 29 Jun 2016 14:55:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4A9A28666 for ; Wed, 29 Jun 2016 14:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D977428669; Wed, 29 Jun 2016 14:55:43 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 170DE2866A for ; Wed, 29 Jun 2016 14:55:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5TEq5d9003168; Wed, 29 Jun 2016 10:52:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5TEq4oS009798 for ; Wed, 29 Jun 2016 10:52:04 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5TEq45D021643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 29 Jun 2016 10:52:04 -0400 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6A738F02F for ; Wed, 29 Jun 2016 14:52:01 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id r201so14943447wme.0 for ; Wed, 29 Jun 2016 07:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iAjgYXFQU4LSCJMdp0UJmpzTcJDBD4+pJA9zcF6WMMU=; b=RdApdXR1vWPl1v4nlHCa1PRtLbSDAPjmewwm5AKWi0AnR34KU0tHZ2al/lfXBTDARs s951jOgPbNfep2JRWJLBMGA7BrqNNXB3woOjnDUExjyA9Nj4q1fxhTboolDQ+Y2NQMZh xM+XnX9tu10XN6Y+2serC1fJU/zT/0wcUwjwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iAjgYXFQU4LSCJMdp0UJmpzTcJDBD4+pJA9zcF6WMMU=; b=NXRjZPZdi2IDNnXADPmGP7q1gqjAMDkyPPFW4+ZnURFwH/mNNgdjgDCX5xdUEDv9AO qlmUruAda8ZQZu5MvPNw2426mCb2ft+/vpXnFkD0Lt0wEMZ2pQ6+DJ+GP2toOrjZXw7N 8HpdaipRvU9xI9OB9lc3M7kFbhsODiinvWviJ+0gDHE9JJ9mEoWXAUtE2Kl7W7kHhPWg HUI3zWEiMpjDi5qL/ZQmfPTF3R8VceLvglX6OB+cNvrgYZYYQuM2ttdnHN+hYgNW0qAR Et/YqjwmF2WZhM0DC+i17+aic/S6g4AkFvalwpCwQhQfVCAspcAqrkOBIpdkjg6upIHG huQA== X-Gm-Message-State: ALyK8tKFiw+EyfrnYV5E7SdHCXXJraO7lNw1e2L8X6mDVjxdRg6yo8ma9BHLnpOSgylQLQ== X-Received: by 10.28.130.15 with SMTP id e15mr16490202wmd.19.1467211920602; Wed, 29 Jun 2016 07:52:00 -0700 (PDT) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id t1sm4112703wjy.3.2016.06.29.07.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jun 2016 07:52:00 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com, keith.busch@intel.com, linux-nvme@lists.infradead.org, dm-devel@redhat.com Date: Wed, 29 Jun 2016 16:51:38 +0200 Message-Id: <1467211901-26707-4-git-send-email-m@bjorling.me> In-Reply-To: <1467211901-26707-1-git-send-email-m@bjorling.me> References: <1467211901-26707-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 29 Jun 2016 14:52:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 29 Jun 2016 14:52:02 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'m@bjorling.me' RCPT:'' X-RedHat-Spam-Score: -0.121 (BAYES_50, DCC_REPUT_13_19, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.75 on 10.5.110.26 X-loop: dm-devel@redhat.com Cc: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [dm-devel] [PATCH 3/6] blk-mq: register device instead of disk X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP Enable devices without a gendisk instance to register itself with blk-mq and expose the associated multi-queue sysfs entries. Signed-off-by: Matias Bjørling --- block/blk-mq-sysfs.c | 13 +++++-------- block/blk-sysfs.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/blk-mq.h | 4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c index 4ea4dd8..f67b5c1 100644 --- a/block/blk-mq-sysfs.c +++ b/block/blk-mq-sysfs.c @@ -380,9 +380,8 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx) return ret; } -void blk_mq_unregister_disk(struct gendisk *disk) +void blk_mq_unregister_dev(struct device *dev, struct request_queue *q) { - struct request_queue *q = disk->queue; struct blk_mq_hw_ctx *hctx; struct blk_mq_ctx *ctx; int i, j; @@ -402,7 +401,7 @@ void blk_mq_unregister_disk(struct gendisk *disk) kobject_del(&q->mq_kobj); kobject_put(&q->mq_kobj); - kobject_put(&disk_to_dev(disk)->kobj); + kobject_put(&dev->kobj); q->mq_sysfs_init_done = false; blk_mq_enable_hotplug(); @@ -426,10 +425,8 @@ static void blk_mq_sysfs_init(struct request_queue *q) } } -int blk_mq_register_disk(struct gendisk *disk) +int blk_mq_register_dev(struct device *dev, struct request_queue *q) { - struct device *dev = disk_to_dev(disk); - struct request_queue *q = disk->queue; struct blk_mq_hw_ctx *hctx; int ret, i; @@ -450,7 +447,7 @@ int blk_mq_register_disk(struct gendisk *disk) } if (ret) - blk_mq_unregister_disk(disk); + blk_mq_unregister_dev(dev, q); else q->mq_sysfs_init_done = true; out: @@ -458,7 +455,7 @@ out: return ret; } -EXPORT_SYMBOL_GPL(blk_mq_register_disk); +EXPORT_SYMBOL_GPL(blk_mq_register_dev); void blk_mq_sysfs_unregister(struct request_queue *q) { diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 9920596..5223c5f 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -693,7 +693,7 @@ int blk_register_queue(struct gendisk *disk) kobject_uevent(&q->kobj, KOBJ_ADD); if (q->mq_ops) - blk_mq_register_disk(disk); + blk_mq_register_dev(disk_to_dev(disk), q); if (!q->request_fn) return 0; @@ -718,7 +718,7 @@ void blk_unregister_queue(struct gendisk *disk) return; if (q->mq_ops) - blk_mq_unregister_disk(disk); + blk_mq_unregister_dev(disk_to_dev(disk), q); if (q->request_fn) elv_unregister_queue(q); diff --git a/drivers/md/dm.c b/drivers/md/dm.c index aba7ed9..9de3a9c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2798,7 +2798,7 @@ static int dm_mq_init_request_queue(struct mapped_device *md, dm_init_md_queue(md); /* backfill 'mq' sysfs registration normally done in blk_register_queue */ - blk_mq_register_disk(md->disk); + blk_mq_register_dev(disk_to_dev(md->disk), q); return 0; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 2498fdf..ab6fb32 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -176,8 +176,8 @@ enum { struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q); -int blk_mq_register_disk(struct gendisk *); -void blk_mq_unregister_disk(struct gendisk *); +int blk_mq_register_dev(struct device *, struct request_queue *); +void blk_mq_unregister_dev(struct device *, struct request_queue *); int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set); void blk_mq_free_tag_set(struct blk_mq_tag_set *set);