From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BD11C47080 for ; Mon, 24 May 2021 06:47:46 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B23E6109E for ; Mon, 24 May 2021 06:47:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B23E6109E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-342-bXJ9H0VtMbOc13bly21Z6w-1; Mon, 24 May 2021 02:47:42 -0400 X-MC-Unique: bXJ9H0VtMbOc13bly21Z6w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 204D2180FD69; Mon, 24 May 2021 06:47:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0295B5D9F2; Mon, 24 May 2021 06:47:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C833D55356; Mon, 24 May 2021 06:47:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14LHiILj025800 for ; Fri, 21 May 2021 13:44:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02B581692BA; Fri, 21 May 2021 17:44:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F150B1692C7 for ; Fri, 21 May 2021 17:44:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DBA10101D232 for ; Fri, 21 May 2021 17:44:14 +0000 (UTC) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-148-Q_XhjA9YMse5aa8eelpcyw-1; Fri, 21 May 2021 13:44:10 -0400 X-MC-Unique: Q_XhjA9YMse5aa8eelpcyw-1 Received: by mail-pg1-f173.google.com with SMTP id l70so14812993pga.1; Fri, 21 May 2021 10:44:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lcP+zO2F1IGQjzr8jBvO9rG6CcCMMr/Whp/T20TGCRM=; b=bkUZx2KTcJ4wqOf0AYFSLpW7UKPjgViT6yqZ1tkIDV9jcSVseve3AkFV2aMpkhVhPQ /d1/0gvftUGXdFyEgnaUCthRKqvWfEky9pezZEufx7GpRKvy+SYPmM95jAf5/VDBphlx 8UJdOY5M6Gwh+NRYWSGWITnxn2g2m0JBMsPPBVW9XLbDTJdSggGmSAhNPAGScWaj58hE HU3pzzpnQ3cmCAZaiZu7U6lLYtM3rdGSEblNW7putGGmb6gblkpsne24KLEpaZwVR+Aw ahqra8mpEIFVJTQCJLdWuz/h1+hu3OZpC635humenGtDrL88vzc0bMdIAFhFc2J7X0RR h5jw== X-Gm-Message-State: AOAM532uVfbkKq5wFfgn+dA/XF19hUcnrwuwHCrXA3lQ0rRAsyRMpwyU eF9B3kiyeE3BgvP5pFw1Qjg= X-Google-Smtp-Source: ABdhPJx2cr14kVfs56RCS6Lg1N9a0F2CxWXa6sTYNwZ2wWHW3RuCIJw00Zxq6x/ufjwVbJsYm0Ya2A== X-Received: by 2002:a05:6a00:15d4:b029:2de:a538:c857 with SMTP id o20-20020a056a0015d4b02902dea538c857mr11480779pfu.51.1621619049288; Fri, 21 May 2021 10:44:09 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id o3sm4974976pgh.22.2021.05.21.10.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:44:08 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 766BF423A3; Fri, 21 May 2021 17:44:07 +0000 (UTC) Date: Fri, 21 May 2021 17:44:07 +0000 From: Luis Chamberlain To: Christoph Hellwig Message-ID: <20210521174407.GA25291@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-6-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20210521055116.1053587-6-hch@lst.de> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 24 May 2021 02:47:09 -0400 Cc: nvdimm@lists.linux.dev, Ulf Hansson , Mike Snitzer , linux-m68k@vger.kernel.org, linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, Joshua Morris , linux-s390@vger.kernel.org, Dave Jiang , Maxim Levitsky , Vishal Verma , Christian Borntraeger , Geert Uytterhoeven , Matias Bjorling , Nitin Gupta , Vasily Gorbik , linux-xtensa@linux-xtensa.org, Alex Dubov , Heiko Carstens , Coly Li , linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, drbd-dev@tron.linbit.com, Philip Kelleher , Dan Williams , Jens Axboe , Chris Zankel , Max Filippov , linux-mmc@vger.kernel.org, Philipp Reisner , Jim Paris , Minchan Kim , Lars Ellenberg , linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, May 21, 2021 at 07:50:55AM +0200, Christoph Hellwig wrote: > Add two new APIs to allocate and free a gendisk including the > request_queue for use with BIO based drivers. This is to avoid > boilerplate code in drivers. > > Signed-off-by: Christoph Hellwig > --- > block/genhd.c | 35 +++++++++++++++++++++++++++++++++++ > include/linux/genhd.h | 22 ++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > > diff --git a/block/genhd.c b/block/genhd.c > index e4974af3d729..6d4ce962866d 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1302,6 +1302,25 @@ struct gendisk *__alloc_disk_node(int minors, int node_id) > } > EXPORT_SYMBOL(__alloc_disk_node); > > +struct gendisk *__blk_alloc_disk(int node) > +{ > + struct request_queue *q; > + struct gendisk *disk; > + > + q = blk_alloc_queue(node); > + if (!q) > + return NULL; > + > + disk = __alloc_disk_node(0, node); > + if (!disk) { > + blk_cleanup_queue(q); > + return NULL; > + } > + disk->queue = q; > + return disk; > +} > +EXPORT_SYMBOL(__blk_alloc_disk); Its not obvious to me why using this new API requires you then to set minors explicitly to 1, and yet here underneath we see the minors argument passed is 0. Nor is it clear from the documentation. Luis -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 249C7C4707A for ; Fri, 21 May 2021 17:44:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0185261261 for ; Fri, 21 May 2021 17:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238163AbhEURpe (ORCPT ); Fri, 21 May 2021 13:45:34 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:45938 "EHLO mail-pf1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234062AbhEURpc (ORCPT ); Fri, 21 May 2021 13:45:32 -0400 Received: by mail-pf1-f178.google.com with SMTP id d16so15425095pfn.12; Fri, 21 May 2021 10:44:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lcP+zO2F1IGQjzr8jBvO9rG6CcCMMr/Whp/T20TGCRM=; b=Bc3IOJsb6hW7LCU1Q2P3RSUaJfScE8RASrZEW3tsmIq9R0cdf4wYkDnBojCmniGGGc lZMBmwXGZBiG8YDNK5KbQyZgfpBK0tfC7y5/vNsJq32v4vxnjeM5Bq3a7O30K4mUOu2l cnG9ea6S5lLHKifIcSUB4+XJ5GKMAMsDmoZ6XUwpKnYYPM++/HknpJJGBwW0hmp7U7cn 30jjpC7cYOjWpaP1eAq14iq52fgearQM5pa7F870t8PoSHaoMx8ttREPnY/ELRwGDUtf oKenOBp+WP0DNTlb1U3sYa9w25HJ9+3GK0GAW1U0kpAgdWp098kvKzZDuHTyQzBjKlqR ETRQ== X-Gm-Message-State: AOAM531GnK4APq1a32wKtVDfR57xmcFfvFio/TY12QFi8NTWSA8BKosd c88tppVkZxKSPoiCm6Arlns= X-Google-Smtp-Source: ABdhPJx2cr14kVfs56RCS6Lg1N9a0F2CxWXa6sTYNwZ2wWHW3RuCIJw00Zxq6x/ufjwVbJsYm0Ya2A== X-Received: by 2002:a05:6a00:15d4:b029:2de:a538:c857 with SMTP id o20-20020a056a0015d4b02902dea538c857mr11480779pfu.51.1621619049288; Fri, 21 May 2021 10:44:09 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id o3sm4974976pgh.22.2021.05.21.10.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:44:08 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 766BF423A3; Fri, 21 May 2021 17:44:07 +0000 (UTC) Date: Fri, 21 May 2021 17:44:07 +0000 From: Luis Chamberlain To: Christoph Hellwig Cc: Jens Axboe , Geert Uytterhoeven , Chris Zankel , Max Filippov , Philipp Reisner , Lars Ellenberg , Jim Paris , Joshua Morris , Philip Kelleher , Minchan Kim , Nitin Gupta , Matias Bjorling , Coly Li , Mike Snitzer , Song Liu , Maxim Levitsky , Alex Dubov , Ulf Hansson , Dan Williams , Vishal Verma , Dave Jiang , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-xtensa@linux-xtensa.org, linux-m68k@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-mmc@vger.kernel.org, linux-bcache@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, drbd-dev@tron.linbit.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs Message-ID: <20210521174407.GA25291@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-6-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521055116.1053587-6-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-bcache@vger.kernel.org On Fri, May 21, 2021 at 07:50:55AM +0200, Christoph Hellwig wrote: > Add two new APIs to allocate and free a gendisk including the > request_queue for use with BIO based drivers. This is to avoid > boilerplate code in drivers. > > Signed-off-by: Christoph Hellwig > --- > block/genhd.c | 35 +++++++++++++++++++++++++++++++++++ > include/linux/genhd.h | 22 ++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > > diff --git a/block/genhd.c b/block/genhd.c > index e4974af3d729..6d4ce962866d 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1302,6 +1302,25 @@ struct gendisk *__alloc_disk_node(int minors, int node_id) > } > EXPORT_SYMBOL(__alloc_disk_node); > > +struct gendisk *__blk_alloc_disk(int node) > +{ > + struct request_queue *q; > + struct gendisk *disk; > + > + q = blk_alloc_queue(node); > + if (!q) > + return NULL; > + > + disk = __alloc_disk_node(0, node); > + if (!disk) { > + blk_cleanup_queue(q); > + return NULL; > + } > + disk->queue = q; > + return disk; > +} > +EXPORT_SYMBOL(__blk_alloc_disk); Its not obvious to me why using this new API requires you then to set minors explicitly to 1, and yet here underneath we see the minors argument passed is 0. Nor is it clear from the documentation. Luis From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 797D7C04FF3 for ; Mon, 24 May 2021 19:49:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34F1E6109F for ; Mon, 24 May 2021 19:49:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34F1E6109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sh3QinEOarJls8xqhxUOw1r1pSvFP5ug8b1nxgs983g=; b=yx3dEtXGfE+yHm LTFxCVGZSIt5NRAugmGLWeY0AnelSJSBYAtnC6glh0CD9becUtB7WVZgStRKwESh8bLPGKQgbMvgV JBvFEzutDq3YS3K/ThVmaJ+F+1dNRqaHy4UKYOch86+4mS00AuK7iL3Shc6J1V+Q1AbYEdncSne+f 18/t9nkq1kgaJ3x1I8+Vk39gPgxtuREI4q7CEVPWR/pS/HiJpio+Vt/9+bfQt/xJVEqSV3c+rqs2W CO8pRgKLNFOLG5Gq7XUmKMPkJmh/h1XWD0gVrOO+4WgUV8HJF2p89ipdpx0B0UuUWUodNJ7JFhQCw u2Ov+2NvxI6SCrzyYJQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1llGZl-001jse-4u; Mon, 24 May 2021 19:49:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk9C1-000Zce-0j for linux-nvme@desiato.infradead.org; Fri, 21 May 2021 17:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lcP+zO2F1IGQjzr8jBvO9rG6CcCMMr/Whp/T20TGCRM=; b=uRIe6SngE61oLufOBCGMPt0rFX txEBrbNRNkCU//WZhpUkSrahgJKTnLB+EfFjRoOIxuiZQmmcMRDux+lb/InjhSPpfl5hg43dY75Gv gpwPCph1ajbUuv0o/QsSvDdve98YA9cKxnCM/oIJ1YWBtVxCbGLMywztxfWLIffdaFPMIjttbqDW6 7uBTTMpfEEYWRo9/Gn46VaKq/qgWZY2qguRdPr05hptZ74mRiYr7BsQO2HoWtF1auxLp3ulPmhshi 8bnnvAvQhwxUzs0a6QZYPaRO0dX4ZaTOyv0MJ0uMJhQKB1uI/bRW6fe6DbESvcTZXk4qAZSVe40tf +RLAM8YQ==; Received: from mail-pg1-f181.google.com ([209.85.215.181]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk9By-00HK6f-Dz for linux-nvme@lists.infradead.org; Fri, 21 May 2021 17:44:11 +0000 Received: by mail-pg1-f181.google.com with SMTP id m124so14772241pgm.13 for ; Fri, 21 May 2021 10:44:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lcP+zO2F1IGQjzr8jBvO9rG6CcCMMr/Whp/T20TGCRM=; b=Hq/oGzz3HdOse6pwC7F3MTRrARIivdrsAO4OMfSp3Xpet3CE5siY+r1c1J0+Z0Rc2R I/HoZB1nEau+de92I1YMbQzvP63330EFb8BbXH673CsKNfVVhW7Raba7FznjG+l9UW7N YmYwvpznItOV3eviiEGpC1PcwjXe69NAZ0/tSmE0UU1MtGowQetF2pew3Ftg4SQHi7Th LalXCUOT1TrsPU9c7AfPK/XIHUKr+MVsbek/OIoCO4Ijn3IxKQ/fFAcMA3YuRc1UIb/q YslokqMoX0hZtx1oHY/UurwDXK6vVF2Ro2DJ9/mJTiDlLQi6jEy02+sVQtcH2v2bMX6N FYJg== X-Gm-Message-State: AOAM533066DcQ3g7xFkIcnMBa34Qn8kIeFCM35bdPdHJcdKN+30oWX4p VAlg1ESJAu/GPWIf7DFmEbU= X-Google-Smtp-Source: ABdhPJx2cr14kVfs56RCS6Lg1N9a0F2CxWXa6sTYNwZ2wWHW3RuCIJw00Zxq6x/ufjwVbJsYm0Ya2A== X-Received: by 2002:a05:6a00:15d4:b029:2de:a538:c857 with SMTP id o20-20020a056a0015d4b02902dea538c857mr11480779pfu.51.1621619049288; Fri, 21 May 2021 10:44:09 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id o3sm4974976pgh.22.2021.05.21.10.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:44:08 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 766BF423A3; Fri, 21 May 2021 17:44:07 +0000 (UTC) Date: Fri, 21 May 2021 17:44:07 +0000 From: Luis Chamberlain To: Christoph Hellwig Cc: Jens Axboe , Geert Uytterhoeven , Chris Zankel , Max Filippov , Philipp Reisner , Lars Ellenberg , Jim Paris , Joshua Morris , Philip Kelleher , Minchan Kim , Nitin Gupta , Matias Bjorling , Coly Li , Mike Snitzer , Song Liu , Maxim Levitsky , Alex Dubov , Ulf Hansson , Dan Williams , Vishal Verma , Dave Jiang , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-xtensa@linux-xtensa.org, linux-m68k@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-mmc@vger.kernel.org, linux-bcache@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, drbd-dev@tron.linbit.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs Message-ID: <20210521174407.GA25291@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-6-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210521055116.1053587-6-hch@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_104410_491056_E1EE3AEF X-CRM114-Status: GOOD ( 23.32 ) X-Mailman-Approved-At: Mon, 24 May 2021 11:59:45 -0700 X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Fri, May 21, 2021 at 07:50:55AM +0200, Christoph Hellwig wrote: > Add two new APIs to allocate and free a gendisk including the > request_queue for use with BIO based drivers. This is to avoid > boilerplate code in drivers. > > Signed-off-by: Christoph Hellwig > --- > block/genhd.c | 35 +++++++++++++++++++++++++++++++++++ > include/linux/genhd.h | 22 ++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > > diff --git a/block/genhd.c b/block/genhd.c > index e4974af3d729..6d4ce962866d 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1302,6 +1302,25 @@ struct gendisk *__alloc_disk_node(int minors, int node_id) > } > EXPORT_SYMBOL(__alloc_disk_node); > > +struct gendisk *__blk_alloc_disk(int node) > +{ > + struct request_queue *q; > + struct gendisk *disk; > + > + q = blk_alloc_queue(node); > + if (!q) > + return NULL; > + > + disk = __alloc_disk_node(0, node); > + if (!disk) { > + blk_cleanup_queue(q); > + return NULL; > + } > + disk->queue = q; > + return disk; > +} > +EXPORT_SYMBOL(__blk_alloc_disk); Its not obvious to me why using this new API requires you then to set minors explicitly to 1, and yet here underneath we see the minors argument passed is 0. Nor is it clear from the documentation. Luis _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47D99C4707A for ; Fri, 21 May 2021 17:44:38 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA56F61261 for ; Fri, 21 May 2021 17:44:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA56F61261 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FmvBB3Jq5z308T for ; Sat, 22 May 2021 03:44:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.215.182; helo=mail-pg1-f182.google.com; envelope-from=mcgrof@gmail.com; receiver=) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Fmv9m2fsHz2xv2 for ; Sat, 22 May 2021 03:44:11 +1000 (AEST) Received: by mail-pg1-f182.google.com with SMTP id v14so12074772pgi.6 for ; Fri, 21 May 2021 10:44:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lcP+zO2F1IGQjzr8jBvO9rG6CcCMMr/Whp/T20TGCRM=; b=DizJw4nSDQuXGA18xC49fQqeIhcOipDI1nAFCaST6Gh0VYnotfv3432GUZFyiWJu4V ym2B8iUKGl7k7ZKxo3Ui0RgBl/WePhVi+7GVHRVw1HquALis7BPcT0sLLhqfARwEdwjT ShTPtKJHGOqkJqAx+ODm4mbbVN1xM9OIf1HBDXwZHeThskQ6TbZN5Fyd8TL0KjTfwuT+ oHE8s4Mp9DNVYhPCANuaija8m0+Qx8VdQn9dqliscKdDica15GbJ0zRQj4GSwDT1AQdw SeCt+cl5HNa72AI+K7IFT23wIIztV0kyOZXn9AGm4SjGV8jfTppEOLCS5HmSN3RidmiW o9tQ== X-Gm-Message-State: AOAM530fJPCybEiOGsXzliwpSNVB2oEGT2gncGZdjunWzgf6CUGeEZl5 9AbmVm2u4qXawt2byrrWEBY= X-Google-Smtp-Source: ABdhPJx2cr14kVfs56RCS6Lg1N9a0F2CxWXa6sTYNwZ2wWHW3RuCIJw00Zxq6x/ufjwVbJsYm0Ya2A== X-Received: by 2002:a05:6a00:15d4:b029:2de:a538:c857 with SMTP id o20-20020a056a0015d4b02902dea538c857mr11480779pfu.51.1621619049288; Fri, 21 May 2021 10:44:09 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id o3sm4974976pgh.22.2021.05.21.10.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:44:08 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 766BF423A3; Fri, 21 May 2021 17:44:07 +0000 (UTC) Date: Fri, 21 May 2021 17:44:07 +0000 From: Luis Chamberlain To: Christoph Hellwig Subject: Re: [dm-devel] [PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs Message-ID: <20210521174407.GA25291@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-6-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521055116.1053587-6-hch@lst.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nvdimm@lists.linux.dev, Ulf Hansson , Mike Snitzer , linux-m68k@vger.kernel.org, linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, Joshua Morris , linux-s390@vger.kernel.org, Dave Jiang , Maxim Levitsky , Vishal Verma , Christian Borntraeger , Geert Uytterhoeven , Matias Bjorling , Nitin Gupta , Vasily Gorbik , linux-xtensa@linux-xtensa.org, Alex Dubov , Heiko Carstens , Coly Li , linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, drbd-dev@tron.linbit.com, Philip Kelleher , Dan Williams , Jens Axboe , Chris Zankel , Max Filippov , linux-mmc@vger.kernel.org, Philipp Reisner , Jim Paris , Minchan Kim , Lars Ellenberg , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, May 21, 2021 at 07:50:55AM +0200, Christoph Hellwig wrote: > Add two new APIs to allocate and free a gendisk including the > request_queue for use with BIO based drivers. This is to avoid > boilerplate code in drivers. > > Signed-off-by: Christoph Hellwig > --- > block/genhd.c | 35 +++++++++++++++++++++++++++++++++++ > include/linux/genhd.h | 22 ++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > > diff --git a/block/genhd.c b/block/genhd.c > index e4974af3d729..6d4ce962866d 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1302,6 +1302,25 @@ struct gendisk *__alloc_disk_node(int minors, int node_id) > } > EXPORT_SYMBOL(__alloc_disk_node); > > +struct gendisk *__blk_alloc_disk(int node) > +{ > + struct request_queue *q; > + struct gendisk *disk; > + > + q = blk_alloc_queue(node); > + if (!q) > + return NULL; > + > + disk = __alloc_disk_node(0, node); > + if (!disk) { > + blk_cleanup_queue(q); > + return NULL; > + } > + disk->queue = q; > + return disk; > +} > +EXPORT_SYMBOL(__blk_alloc_disk); Its not obvious to me why using this new API requires you then to set minors explicitly to 1, and yet here underneath we see the minors argument passed is 0. Nor is it clear from the documentation. Luis