pmem: don't allocate unused major device number
When alloc_disk(0) or alloc_disk-node(0, XX) is used, the ->major number is completely ignored: all devices are allocated with a major of BLOCK_EXT_MAJOR. So there is no point allocating pmem_major. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
af1996ef59
commit
55155291b3
1 changed files with 1 additions and 18 deletions
|
@ -50,8 +50,6 @@ struct pmem_device {
|
||||||
struct badblocks bb;
|
struct badblocks bb;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pmem_major;
|
|
||||||
|
|
||||||
static bool is_bad_pmem(struct badblocks *bb, sector_t sector, unsigned int len)
|
static bool is_bad_pmem(struct badblocks *bb, sector_t sector, unsigned int len)
|
||||||
{
|
{
|
||||||
if (bb->count) {
|
if (bb->count) {
|
||||||
|
@ -231,8 +229,6 @@ static int pmem_attach_disk(struct device *dev,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
disk->major = pmem_major;
|
|
||||||
disk->first_minor = 0;
|
|
||||||
disk->fops = &pmem_fops;
|
disk->fops = &pmem_fops;
|
||||||
disk->private_data = pmem;
|
disk->private_data = pmem;
|
||||||
disk->queue = pmem->pmem_queue;
|
disk->queue = pmem->pmem_queue;
|
||||||
|
@ -579,26 +575,13 @@ static struct nd_device_driver nd_pmem_driver = {
|
||||||
|
|
||||||
static int __init pmem_init(void)
|
static int __init pmem_init(void)
|
||||||
{
|
{
|
||||||
int error;
|
return nd_driver_register(&nd_pmem_driver);
|
||||||
|
|
||||||
pmem_major = register_blkdev(0, "pmem");
|
|
||||||
if (pmem_major < 0)
|
|
||||||
return pmem_major;
|
|
||||||
|
|
||||||
error = nd_driver_register(&nd_pmem_driver);
|
|
||||||
if (error) {
|
|
||||||
unregister_blkdev(pmem_major, "pmem");
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
module_init(pmem_init);
|
module_init(pmem_init);
|
||||||
|
|
||||||
static void pmem_exit(void)
|
static void pmem_exit(void)
|
||||||
{
|
{
|
||||||
driver_unregister(&nd_pmem_driver.drv);
|
driver_unregister(&nd_pmem_driver.drv);
|
||||||
unregister_blkdev(pmem_major, "pmem");
|
|
||||||
}
|
}
|
||||||
module_exit(pmem_exit);
|
module_exit(pmem_exit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue