* Patch - make config_max_raw_devices work
@ 2004-03-16 0:53 Kenneth Chen
2004-03-16 2:14 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Kenneth Chen @ 2004-03-16 0:53 UTC (permalink / raw)
To: linux-kernel
Even though there is a CONFIG_MAX_RAW_DEVS option, it doesn't actually
increase the number of raw devices beyond 256 because during the char
registration, it uses the standard register_chrdev() interface which
has hard coded 256 minor in it. Here is a patch that fix this problem
by using register_chrdev_region() and cdev_(init/add/del) functions.
I'm also thinking this config option probably should be converted into
module_param. Would that be worthwhile?
- Ken
diff -Nurp linux-2.6.4/drivers/char/raw.c linux-2.6.4-raw/drivers/char/raw.c
--- linux-2.6.4/drivers/char/raw.c 2004-03-10 18:55:34.000000000 -0800
+++ linux-2.6.4-raw/drivers/char/raw.c 2004-03-15 15:51:19.000000000 -0800
@@ -17,6 +17,7 @@
#include <linux/raw.h>
#include <linux/capability.h>
#include <linux/uio.h>
+#include <linux/cdev.h>
#include <asm/uaccess.h>
@@ -260,11 +261,26 @@ static struct file_operations raw_ctl_fo
.owner = THIS_MODULE,
};
+static struct cdev raw_cdev = {
+ .kobj = {.name = "raw", },
+ .owner = THIS_MODULE,
+};
+
static int __init raw_init(void)
{
int i;
+ dev_t dev = MKDEV(RAW_MAJOR, 0);
+
+ if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw"))
+ goto error;
+
+ cdev_init(&raw_cdev, &raw_fops);
+ if (cdev_add(&raw_cdev, dev, MAX_RAW_MINORS)) {
+ kobject_put(&raw_cdev.kobj);
+ unregister_chrdev_region(dev, MAX_RAW_MINORS);
+ goto error;
+ }
- register_chrdev(RAW_MAJOR, "raw", &raw_fops);
devfs_mk_cdev(MKDEV(RAW_MAJOR, 0),
S_IFCHR | S_IRUGO | S_IWUGO,
"raw/rawctl");
@@ -273,6 +289,10 @@ static int __init raw_init(void)
S_IFCHR | S_IRUGO | S_IWUGO,
"raw/raw%d", i);
return 0;
+
+error:
+ printk(KERN_ERR "error register raw device\n");
+ return 1;
}
static void __exit raw_exit(void)
@@ -283,7 +303,8 @@ static void __exit raw_exit(void)
devfs_remove("raw/raw%d", i);
devfs_remove("raw/rawctl");
devfs_remove("raw");
- unregister_chrdev(RAW_MAJOR, "raw");
+ cdev_del(&raw_cdev);
+ unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS);
}
module_init(raw_init);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch - make config_max_raw_devices work
2004-03-16 0:53 Patch - make config_max_raw_devices work Kenneth Chen
@ 2004-03-16 2:14 ` Andrew Morton
2004-03-16 2:39 ` Anton Blanchard
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2004-03-16 2:14 UTC (permalink / raw)
To: Kenneth Chen; +Cc: linux-kernel
"Kenneth Chen" <kenneth.w.chen@intel.com> wrote:
>
> Even though there is a CONFIG_MAX_RAW_DEVS option, it doesn't actually
> increase the number of raw devices beyond 256 because during the char
> registration, it uses the standard register_chrdev() interface which
> has hard coded 256 minor in it. Here is a patch that fix this problem
> by using register_chrdev_region() and cdev_(init/add/del) functions.
Badari wrote basically the same patch a couple of months back. I dropped
it then, too ;)
raw is a deprecated interface and if we keep on adding new features to it,
we will never be rid of the thing. If your application requires more than
256 raw devices, please convert it to open the block device directly,
passing in the O_DIRECT flag.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch - make config_max_raw_devices work
2004-03-16 2:14 ` Andrew Morton
@ 2004-03-16 2:39 ` Anton Blanchard
2004-03-16 4:17 ` Kenneth Chen
2004-03-16 5:03 ` Andrew Morton
0 siblings, 2 replies; 5+ messages in thread
From: Anton Blanchard @ 2004-03-16 2:39 UTC (permalink / raw)
To: Andrew Morton; +Cc: Kenneth Chen, linux-kernel
> Badari wrote basically the same patch a couple of months back. I dropped
> it then, too ;)
>
> raw is a deprecated interface and if we keep on adding new features to it,
> we will never be rid of the thing. If your application requires more than
> 256 raw devices, please convert it to open the block device directly,
> passing in the O_DIRECT flag.
We only deprecated this thing on the 4th Feb 2004. I want to see the raw
driver die but we cant expect apps to change their interfaces in the space
of a month.
Can we reach a compromise? :)
Anton
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Patch - make config_max_raw_devices work
2004-03-16 2:39 ` Anton Blanchard
@ 2004-03-16 4:17 ` Kenneth Chen
2004-03-16 5:03 ` Andrew Morton
1 sibling, 0 replies; 5+ messages in thread
From: Kenneth Chen @ 2004-03-16 4:17 UTC (permalink / raw)
To: 'Anton Blanchard', Andrew Morton; +Cc: linux-kernel
Anton Blanchard on Mon, March 15, 2004 6:40 PM
> > Badari wrote basically the same patch a couple of months back. I dropped
> > it then, too ;)
> >
> > raw is a deprecated interface and if we keep on adding new features to it,
> > we will never be rid of the thing. If your application requires more than
> > 256 raw devices, please convert it to open the block device directly,
> > passing in the O_DIRECT flag.
>
> We only deprecated this thing on the 4th Feb 2004. I want to see the raw
> driver die but we cant expect apps to change their interfaces in the space
> of a month.
>
> Can we reach a compromise? :)
I second that with Anton. It takes awhile for application to convert to
O_DIRECT. We are already educating OSV to convert that. At mean time, this
is required for legacy application used in production environment (legacy in
The sense that went in production a couple month ago).
- Ken
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch - make config_max_raw_devices work
2004-03-16 2:39 ` Anton Blanchard
2004-03-16 4:17 ` Kenneth Chen
@ 2004-03-16 5:03 ` Andrew Morton
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2004-03-16 5:03 UTC (permalink / raw)
To: Anton Blanchard; +Cc: kenneth.w.chen, linux-kernel
Anton Blanchard <anton@samba.org> wrote:
>
>
> > Badari wrote basically the same patch a couple of months back. I dropped
> > it then, too ;)
> >
> > raw is a deprecated interface and if we keep on adding new features to it,
> > we will never be rid of the thing. If your application requires more than
> > 256 raw devices, please convert it to open the block device directly,
> > passing in the O_DIRECT flag.
>
> We only deprecated this thing on the 4th Feb 2004. I want to see the raw
> driver die but we cant expect apps to change their interfaces in the space
> of a month.
Nobody has complained about the 256-device limit thus far. I fully
expected to lose this one, but I don't think I've bitched about it enough
yet.
> Can we reach a compromise? :)
OK, how about a udelay(10) in each I/O?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-16 5:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-16 0:53 Patch - make config_max_raw_devices work Kenneth Chen
2004-03-16 2:14 ` Andrew Morton
2004-03-16 2:39 ` Anton Blanchard
2004-03-16 4:17 ` Kenneth Chen
2004-03-16 5:03 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®