[patch] number of rd's in Kconfig
From: Marc Leeman
Date: Sat Nov 27 2004 - 02:01:59 EST
In dedicated systems or small systems; the number of required ramdisks
is by default (16) too large. Like the size of the ramdisks; these
patches add that the number of rds can be configured in the kernel
configuration.
These patches are against the 2.6.9
--
ash nazg durbatulûk, ash nazg gimbatul,
ash nazg thrakatulûk agh burzum-ishi krimpatul
--- linux-2.6.9/drivers/block/Kconfig 2004-10-18 23:53:43.000000000 +0200
+++ linux-2.6.9.barco/drivers/block/Kconfig 2004-11-25 09:00:56.000000000 +0100
@@ -329,6 +329,15 @@ config BLK_DEV_RAM
Most normal users won't need the RAM disk functionality, and can
thus say N here.
+config BLK_DEV_RAM_COUNT
+ int "Default number of RAM disks"
+ depends on 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
int "Default RAM disk size (kbytes)"
depends on BLK_DEV_RAM
--- linux-2.6.9/drivers/block/rd.c 2004-10-18 23:54:37.000000000 +0200
+++ linux-2.6.9.barco/drivers/block/rd.c 2004-11-25 09:02:02.000000000 +0100
@@ -60,15 +60,12 @@
#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.
*/
-static struct gendisk *rd_disks[NUM_RAMDISKS];
-static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
-static struct request_queue *rd_queue[NUM_RAMDISKS];
+static struct gendisk *rd_disks[CONFIG_BLK_DEV_RAM_COUNT];
+static struct block_device *rd_bdev[CONFIG_BLK_DEV_RAM_COUNT];/* Protected device data */
+static struct request_queue *rd_queue[CONFIG_BLK_DEV_RAM_COUNT];
/*
* Parameters for the boot-loading of the RAM disk. These are set by
@@ -402,7 +399,7 @@ static void __exit rd_cleanup(void)
{
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];
rd_bdev[i] = NULL;
if (bdev) {
@@ -432,7 +429,7 @@ static int __init rd_init(void)
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);
if (!rd_disks[i])
goto out;
@@ -445,7 +442,7 @@ static int __init rd_init(void)
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];
rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
@@ -470,7 +467,7 @@ static int __init rd_init(void)
/* rd_size is given in kB */
printk("RAMDISK driver initialized: "
"%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;
out_queue: