Re: [PATCH 5/9 v2] SQUASHME: prd: Last fixes for partitions

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

 



On 08/26/2014 11:18 AM, Boaz Harrosh wrote:
> On 08/25/2014 11:10 PM, Ross Zwisler wrote:
> <>
>> I think we can still have a working probe by instead comparing the passed in
>> dev_t against the dev_t we get back from disk_to_dev(prd->prd_disk), but I'd
>> really like a use case so I can test this.  Until then I think I'm just going
>> to stub out prd/pmem_probe() with a BUG() so we can see if anyone hits it.
>>
>> It seems like this is preferable to just registering NULL for probe, as that
>> would cause an oops in kobj_lookup(() when probe() is blindly called without
>> checking for NULL.
>>
> 
> I have a version I think you will love it removes the probe and bunch of
> other stuff.
> 
> I tested it heavily it just works
> 
> Comming soon, I'm preparing trees right now
> Thanks
> Boaz

Ross hi

It is getting late around here and I will not be pushing new trees
tonight, first thing tomorrow morning. (Your last push caused me lots
of extra work, you must not do like you did when working on a rebasing
out-off-tree project involving more then one person, but more on the proper
procedure tomorrow with the push of the trees)

So I hope you are not doing any big changes, do not apply any of my patches
just yet, wait for the new trees tomorrow please I have everything all ready
on top of the rename to pmem

Meanwhile without any explanations, these will come tomorrow, I'm attaching
the most interesting bit which you have not seen before.

If you want you can inspect a preview of what's to come here:
	http://git.open-osd.org/gitweb.cgi?p=pmem.git;a=summary

I have created a new pmem.git tree just for us.

Thanks
Boaz

>From 748370b1220693b755b6b92828e651cc0bac7846 Mon Sep 17 00:00:00 2001
From: Boaz Harrosh <boaz@xxxxxxxxxxxxx>
Date: Thu, 21 Aug 2014 19:03:48 +0300
Subject: [PATCH 12/12] SQUASHME: pmem: KISS, remove the all pmem_major
 registration

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, all this stuff is not used by the Kernel.

Note that with current code pmem_major defaults to ZERO
but even if I run with
	modprobe pmem map=1G@1G pmem_major=17

I still ever get:
brw-rw----. 1 root disk 259, 0 Aug 21 19:02 /dev/pmem0
brw-rw----. 1 root disk 259, 1 Aug 21 19:02 /dev/pmem0p1
brw-rw----. 1 root disk 259, 2 Aug 21 19:02 /dev/pmem0p2

>From the BLOCK_EXT_MAJOR (259) range. Even Though the
registration of pmem_major=17 succeeded just fine, and
	disk->major = 17;
was set in pmem_alloc()

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.

If anyone knows of what would work differently after this
patch please do tell.

But it looks like the calls to register_blkdev +
blk_register_region are just dead code for us right now

Thanks

Signed-off-by: Boaz Harrosh <boaz@xxxxxxxxxxxxx>
---
 drivers/block/pmem.c | 45 +--------------------------------------------
 1 file changed, 1 insertion(+), 44 deletions(-)

diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c
index a272c43..014bba7 100644
--- a/drivers/block/pmem.c
+++ b/drivers/block/pmem.c
@@ -228,9 +228,6 @@ static const struct block_device_operations pmem_fops = {
 };
 
 /* Kernel module stuff */
-static int pmem_major;
-module_param(pmem_major, int, 0);
-MODULE_PARM_DESC(pmem_major,  "Major number to request for this driver");
 
 static char *map;
 module_param(map, charp, S_IRUGO);
@@ -239,7 +236,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 DEFINE_MUTEX(pmem_devices_mutex);
 
 #ifdef CONFIG_BLK_DEV_PMEM_USE_PAGES
 static int pmem_add_page_mapping(phys_addr_t phys_addr, size_t total_size,
@@ -455,7 +451,7 @@ static struct pmem_device *pmem_alloc(phys_addr_t phys_addr, size_t disk_size,
 		err = -ENOMEM;
 		goto out_free_queue;
 	}
-	disk->major		= pmem_major;
+	disk->major		= BLOCK_EXT_MAJOR;
 	disk->first_minor	= 0;
 	disk->fops		= &pmem_fops;
 	disk->private_data	= pmem;
@@ -492,30 +488,6 @@ static void pmem_del_one(struct pmem_device *pmem)
 	pmem_free(pmem);
 }
 
-/*FIXME: Actually in our driver pmem_probe is never used. Can be removed */
-static struct kobject *pmem_probe(dev_t dev, int *part, void *data)
-{
-	struct pmem_device *pmem;
-	struct kobject *kobj;
-	int number = MINOR(dev);
-
-	mutex_lock(&pmem_devices_mutex);
-
-	list_for_each_entry(pmem, &pmem_devices, pmem_list) {
-		if (pmem->pmem_number == number) {
-			kobj = get_disk(pmem->pmem_disk);
-			goto out;
-		}
-	}
-
-	pr_err("pmem: pmem_probe: Unexpected parameter=%d\n", number);
-	kobj = NULL;
-
-out:
-	mutex_unlock(&pmem_devices_mutex);
-	return kobj;
-}
-
 static int pmem_parse_map_one(char *map, phys_addr_t *start, size_t *size)
 {
 	char *p = map;
@@ -540,13 +512,6 @@ static int __init pmem_init(void)
 		return -EINVAL;
 	}
 
-	result = register_blkdev(pmem_major, "pmem");
-	if (result < 0) {
-		result = -EIO;
-		goto out;
-	} else if (result > 0)
-		pmem_major = result;
-
 	i = 0;
 	while ((p = strsep(&pmem_map, ",")) != NULL) {
 		phys_addr_t phys_addr;
@@ -570,9 +535,6 @@ static int __init pmem_init(void)
 	list_for_each_entry(pmem, &pmem_devices, pmem_list)
 		add_disk(pmem->pmem_disk);
 
-	blk_register_region(MKDEV(pmem_major, 0), 0,
-				  THIS_MODULE, pmem_probe, NULL, NULL);
-
 	pr_info("pmem: module loaded\n");
 	return 0;
 
@@ -581,8 +543,6 @@ out_free:
 		list_del(&pmem->pmem_list);
 		pmem_free(pmem);
 	}
-	unregister_blkdev(pmem_major, "pmem");
-out:
 	return result;
 }
 
@@ -590,12 +550,9 @@ static void __exit pmem_exit(void)
 {
 	struct pmem_device *pmem, *next;
 
-	blk_unregister_region(MKDEV(pmem_major, 0), 0);
-
 	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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]