Commit 7fb3bbad authored by Marc Leeman's avatar Marc Leeman Committed by Linus Torvalds

[PATCH] make number of ramdisks Kconfigurable

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fcd4b4d0
...@@ -331,6 +331,14 @@ config BLK_DEV_RAM ...@@ -331,6 +331,14 @@ config BLK_DEV_RAM
Most normal users won't need the RAM disk functionality, and can Most normal users won't need the RAM disk functionality, and can
thus say N here. thus say N here.
config BLK_DEV_RAM_COUNT
int "Default number of RAM disks" if BLK_DEV_RAM
default "16"
help
The default value is 16 RAM disks. Change this if you know what
are doing. If you boot from a filesystem that needs to be extracted
in memory, you will need at least one RAM disk (e.g. root on cramfs).
config BLK_DEV_RAM_SIZE config BLK_DEV_RAM_SIZE
int "Default RAM disk size (kbytes)" int "Default RAM disk size (kbytes)"
depends on BLK_DEV_RAM depends on BLK_DEV_RAM
......
...@@ -61,15 +61,12 @@ ...@@ -61,15 +61,12 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* The RAM disk size is now a parameter */
#define NUM_RAMDISKS 16 /* This cannot be overridden (yet) */
/* Various static variables go here. Most are used only in the RAM disk code. /* Various static variables go here. Most are used only in the RAM disk code.
*/ */
static struct gendisk *rd_disks[NUM_RAMDISKS]; static struct gendisk *rd_disks[CONFIG_BLK_DEV_RAM_COUNT];
static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */ static struct block_device *rd_bdev[CONFIG_BLK_DEV_RAM_COUNT];/* Protected device data */
static struct request_queue *rd_queue[NUM_RAMDISKS]; static struct request_queue *rd_queue[CONFIG_BLK_DEV_RAM_COUNT];
/* /*
* Parameters for the boot-loading of the RAM disk. These are set by * Parameters for the boot-loading of the RAM disk. These are set by
...@@ -403,7 +400,7 @@ static void __exit rd_cleanup(void) ...@@ -403,7 +400,7 @@ static void __exit rd_cleanup(void)
{ {
int i; int i;
for (i = 0; i < NUM_RAMDISKS; i++) { for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
struct block_device *bdev = rd_bdev[i]; struct block_device *bdev = rd_bdev[i];
rd_bdev[i] = NULL; rd_bdev[i] = NULL;
if (bdev) { if (bdev) {
...@@ -433,7 +430,7 @@ static int __init rd_init(void) ...@@ -433,7 +430,7 @@ static int __init rd_init(void)
rd_blocksize = BLOCK_SIZE; rd_blocksize = BLOCK_SIZE;
} }
for (i = 0; i < NUM_RAMDISKS; i++) { for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
rd_disks[i] = alloc_disk(1); rd_disks[i] = alloc_disk(1);
if (!rd_disks[i]) if (!rd_disks[i])
goto out; goto out;
...@@ -446,7 +443,7 @@ static int __init rd_init(void) ...@@ -446,7 +443,7 @@ static int __init rd_init(void)
devfs_mk_dir("rd"); devfs_mk_dir("rd");
for (i = 0; i < NUM_RAMDISKS; i++) { for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
struct gendisk *disk = rd_disks[i]; struct gendisk *disk = rd_disks[i];
rd_queue[i] = blk_alloc_queue(GFP_KERNEL); rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
...@@ -471,7 +468,7 @@ static int __init rd_init(void) ...@@ -471,7 +468,7 @@ static int __init rd_init(void)
/* rd_size is given in kB */ /* rd_size is given in kB */
printk("RAMDISK driver initialized: " printk("RAMDISK driver initialized: "
"%d RAM disks of %dK size %d blocksize\n", "%d RAM disks of %dK size %d blocksize\n",
NUM_RAMDISKS, rd_size, rd_blocksize); CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize);
return 0; return 0;
out_queue: out_queue:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment