Skip to contentSkip to conversation

number of rd's in Kconfig

PATCH In review Marc Leeman 2 participants 2 messages Nov 27, 2004 – Nov 30, 2004 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 number of rd's in Kconfig

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

Signature · 2 lines
ash nazg durbatulûk, ash nazg gimbatul,
ash nazg thrakatulûk agh burzum-ishi krimpatul
drivers/block/Kconfig +9 -0
@@ -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
drivers/block/rd.c +7 -10
@@ -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:
#1 lore raw
Quoted 6 lines

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

The last time I checked my kernel tree (it's a suse, but nevermind), I was able to freely choose the ramdisk size, i.e. there is an input field for a number.
I have not seen some number field to specify the _number_ of disks, though!

Jan Engelhardt

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de