Message ID | 1430757781.5434.6.camel@theros.lm.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, May 04, 2015 at 10:43:01AM -0600, Ross Zwisler wrote: > > Yes, if CONFIG_DEBUG_BLOCK_EXT_DEVT isn't set that code doesn't work at all. > > I can't figure out a use case that breaks when using dynamically allocated > minors without CONFIG_DEBUG_BLOCK_EXT_DEVT. The patch that I've been testing > against is at the bottom of this mail. > > Here are the minors that I get when creating a bunch of partitions using the > current code with PMEM_MINORS=16, with CONFIG_DEBUG_BLOCK_EXT_DEVT turned off: FYI, your patch below works fine for me, but the original one certainly didn't. One big difference was that it also removed the register_blkdev call and thus assigning a major number. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/07/2015 10:26 AM, Christoph Hellwig wrote: > On Mon, May 04, 2015 at 10:43:01AM -0600, Ross Zwisler wrote: >>> Yes, if CONFIG_DEBUG_BLOCK_EXT_DEVT isn't set that code doesn't work at all. >> >> I can't figure out a use case that breaks when using dynamically allocated >> minors without CONFIG_DEBUG_BLOCK_EXT_DEVT. The patch that I've been testing >> against is at the bottom of this mail. >> >> Here are the minors that I get when creating a bunch of partitions using the >> current code with PMEM_MINORS=16, with CONFIG_DEBUG_BLOCK_EXT_DEVT turned off: > > FYI, your patch below works fine for me, but the original one certainly > didn't. One big difference was that it also removed the register_blkdev > call and thus assigning a major number. > assigning a major number for what? That "assigned major number" is then never used *anywhere* in the code at all until it is unregistered. All the devices come up with the dynamic (259) major the register_blkdev is just dead code. I have experimented with this a lot, I have audited the all code stack, that major is never used, when doing the: alloc_disk(0) disk->flags |= GENHD_FL_EXT_DEVT The: disk->major = X Is completely ignored and is immediately over written. The only relic of that major registration is the pmem_major global member collecting dust. Sigh, bad habits die hard, I don't really care you can keep it. Sorry for the noise. Cheers Boaz -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/block/nd/pmem.c b/drivers/block/nd/pmem.c index 900dad61a6b9..b977def8981e 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; @@ -185,12 +183,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 * pmem->id; + disk->first_minor = 0; disk->fops = &pmem_fops; disk->private_data = pmem; disk->queue = pmem->pmem_queue;