[PATCH 2/8] pmem: KISS, remove register_blkdev
From: Boaz Harrosh
Date: Thu Mar 05 2015 - 06:55:59 EST
Though this looks revolutionary, it actually does nothing
but removes dead code.
Since the move of pmem to the dynamic BLOCK_EXT_MAJOR
range, by Ross, pmem_major returned from register_blkdev
is not used.
If inspecting the code at add_disk() we can see that
whatever number we will put at
disk->major = ...
disk->first_minor = ...
will be immediately overwritten with the BLOCK_EXT_MAJOR
and a dynamically allocated minor. Regardless of the
registration and/or what ever we put at disk->major.
I have tested all the tests that I know how to perform
on the devices, fdisk, partitions, multiple pmemX devices,
mknode, lsblk, blkid, and it all behaves exactly as
before this patch.
I have also done:
find /sys/ -name "*pmem*"
find /proc/ -name "*pmem*"
find /dev/ -name "*pmem*"
And get the same output as before this patch.
The only thing missing is an entry in /proc/devices of
the form: "250 pmem" (250 or what ever is free at the moment)
But this is good because if one tries to look for 250
devices after loading pmem he will fail because pmem
is always registered as 259 (blkext) now.
If anyone knows of what would work differently after this
patch please do tell.
But it looks like the calls to register_blkdev is just dead
code for us right now
Thanks
Signed-off-by: Boaz Harrosh <boaz@xxxxxxxxxxxxx>
---
drivers/block/pmem.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c
index 02cd118..bba53af 100644
--- a/drivers/block/pmem.c
+++ b/drivers/block/pmem.c
@@ -113,7 +113,6 @@ MODULE_PARM_DESC(map,
"mapS=nn[KMG]$ss[KMG] or mapS=nn[KMG]@ss[KMG], nn=size, ss=offset.");
static LIST_HEAD(pmem_devices);
-static int pmem_major;
/* pmem->phys_addr and pmem->size need to be set.
* Will then set virt_addr if successful.
@@ -204,8 +203,6 @@ static struct pmem_device *pmem_alloc(phys_addr_t phys_addr, size_t disk_size,
goto out_free_queue;
}
- disk->major = pmem_major;
- disk->first_minor = 0;
disk->fops = &pmem_fops;
disk->private_data = pmem;
disk->queue = pmem->pmem_queue;
@@ -268,12 +265,6 @@ static int __init pmem_init(void)
return -EINVAL;
}
- result = register_blkdev(0, "pmem");
- if (unlikely(result < 0))
- return -EIO;
-
- pmem_major = result;
-
map_dup = pmem_map = kstrdup(map, GFP_KERNEL);
if (unlikely(!pmem_map)) {
pr_debug("pmem_init strdup(%s) failed\n", map);
@@ -312,7 +303,6 @@ out_free:
pmem_free(pmem);
}
kfree(map_dup);
- unregister_blkdev(pmem_major, "pmem");
return result;
}
@@ -324,7 +314,6 @@ static void __exit pmem_exit(void)
list_for_each_entry_safe(pmem, next, &pmem_devices, pmem_list)
pmem_del_one(pmem);
- unregister_blkdev(pmem_major, "pmem");
pr_info("pmem: module unloaded\n");
}
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/