From patchwork Wed May 20 20:57:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 6449441 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B729A9F1CC for ; Wed, 20 May 2015 20:59:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E24EB203FB for ; Wed, 20 May 2015 20:59:48 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8A41203F3 for ; Wed, 20 May 2015 20:59:47 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BC893182745; Wed, 20 May 2015 13:59:47 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id B605118260E for ; Wed, 20 May 2015 13:59:46 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 20 May 2015 13:59:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,466,1427785200"; d="scan'208";a="496248506" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.23.232.36]) by FMSMGA003.fm.intel.com with ESMTP; 20 May 2015 13:59:46 -0700 Subject: [PATCH v3 10/21] pmem: Dynamically allocate partition numbers From: Dan Williams To: axboe@kernel.dk Date: Wed, 20 May 2015 16:57:06 -0400 Message-ID: <20150520205706.32249.99479.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150520205536.32249.89779.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20150520205536.32249.89779.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 Cc: linux-nvdimm@lists.01.org, neilb@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, hch@lst.de, linux-acpi@vger.kernel.org, mingo@kernel.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_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: Ross Zwisler Dynamically allocate minor numbers for partitions instead of statically preallocating them. It gives us a simpler minors scheme, and makes it so we get a consistent major when moving past partition 16. Here's what happens with the current code: pmem0 249:0 0 63.5G 0 rom ??pmem0p1 249:1 0 1G 0 part ??pmem0p2 249:2 0 1G 0 part ??pmem0p3 249:3 0 1G 0 part ??pmem0p4 249:4 0 1G 0 part ??pmem0p5 249:5 0 1G 0 part ??pmem0p6 249:6 0 1G 0 part ??pmem0p7 249:7 0 1G 0 part ??pmem0p8 249:8 0 1G 0 part ??pmem0p9 249:9 0 1G 0 part ??pmem0p10 249:10 0 1G 0 part ??pmem0p11 249:11 0 1G 0 part ??pmem0p12 249:12 0 1G 0 part ??pmem0p13 249:13 0 1G 0 part ??pmem0p14 249:14 0 1G 0 part ??pmem0p15 249:15 0 1G 0 part ??pmem0p16 259:0 0 1G 0 part ??pmem0p17 259:1 0 1G 0 part ??pmem0p18 259:2 0 1G 0 part Signed-off-by: Ross Zwisler Signed-off-by: Dan Williams --- drivers/block/nd/pmem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/block/nd/pmem.c b/drivers/block/nd/pmem.c index 529a1444a918..fc34677d0f48 100644 --- a/drivers/block/nd/pmem.c +++ b/drivers/block/nd/pmem.c @@ -26,8 +26,6 @@ #include #include "nd.h" -#define PMEM_MINORS 16 - struct pmem_device { struct request_queue *pmem_queue; struct gendisk *pmem_disk; @@ -156,12 +154,12 @@ static struct pmem_device *pmem_alloc(struct device *dev, struct resource *res, blk_queue_max_hw_sectors(pmem->pmem_queue, 1024); blk_queue_bounce_limit(pmem->pmem_queue, BLK_BOUNCE_ANY); - disk = alloc_disk(PMEM_MINORS); + disk = alloc_disk(0); if (!disk) goto out_free_queue; disk->major = pmem_major; - disk->first_minor = PMEM_MINORS * id; + disk->first_minor = 0; disk->fops = &pmem_fops; disk->private_data = pmem; disk->queue = pmem->pmem_queue;