[RFC PATCH 10/21] pmem: Dynamically allocate partition numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>

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 <ross.zwisler@xxxxxxxxxxxxxxx>
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 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 cf5d53eda9e5..0842d27ffc8d 100644
--- a/drivers/block/nd/pmem.c
+++ b/drivers/block/nd/pmem.c
@@ -26,8 +26,6 @@
 #include <linux/nd.h>
 #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;

--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux