From patchwork Tue Jun 2 00:15:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 6525231 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 71155C0020 for ; Tue, 2 Jun 2015 00:17:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93B94200E9 for ; Tue, 2 Jun 2015 00:17:56 +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 A59EB2046F for ; Tue, 2 Jun 2015 00:17:55 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 951F21827DC; Mon, 1 Jun 2015 17:17:55 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id 34DED1827C9 for ; Mon, 1 Jun 2015 17:17:54 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 01 Jun 2015 17:17:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,536,1427785200"; d="scan'208";a="739069094" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.23.232.36]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2015 17:17:44 -0700 Subject: [PATCH v5 10/21] pmem: Dynamically allocate partition numbers From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 01 Jun 2015 20:15:03 -0400 Message-ID: <20150602001503.4506.10472.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150602001134.4506.45867.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20150602001134.4506.45867.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 Cc: axboe@kernel.dk, sfr@canb.auug.org.au, rafael@kernel.org, neilb@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, hch@lst.de, linux-acpi@vger.kernel.org, linux-api@vger.kernel.org, akpm@linux-foundation.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/nvdimm/pmem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index cf5d53eda9e5..0842d27ffc8d 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/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;