Hi,
The following patch provides a separate queue for each ramdisk instance
and the BUG is not seen now.
Please check whether it is ok or not.
Thanks,
Maneesh
drivers/block/rd.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff -puN drivers/block/rd.c~multiqueue_ramdisk drivers/block/rd.c
--- linux-2.5.69/drivers/block/rd.c~multiqueue_ramdisk 2003-05-23 16:04:38.000000000 +0530
+++ linux-2.5.69-maneesh/drivers/block/rd.c 2003-05-23 17:45:24.000000000 +0530
@@ -67,6 +67,7 @@
static struct gendisk *rd_disks[NUM_RAMDISKS];
static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
+static struct request_queue *rd_queue;
/*
* Parameters for the boot-loading of the RAM disk. These are set by
@@ -308,12 +309,11 @@ static void __exit rd_cleanup (void)
del_gendisk(rd_disks[i]);
put_disk(rd_disks[i]);
}
-
+ kfree(rd_queue);
devfs_remove("rd");
unregister_blkdev(RAMDISK_MAJOR, "ramdisk" );
}
-static struct request_queue rd_queue;
/* This is the registration and initialization section of the RAM disk driver */
static int __init rd_init (void)
{
@@ -333,23 +333,28 @@ static int __init rd_init (void)
goto out;
}
+ rd_queue = kmalloc(NUM_RAMDISKS * sizeof(struct request_queue),
+ GFP_KERNEL);
+ if (!rd_queue)
+ goto out;
+
if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) {
err = -EIO;
- goto out;
+ goto out_queue;
}
- blk_queue_make_request(&rd_queue, &rd_make_request);
-
devfs_mk_dir("rd");
for (i = 0; i < NUM_RAMDISKS; i++) {
struct gendisk *disk = rd_disks[i];
+ blk_queue_make_request(&rd_queue[i], &rd_make_request);
+
/* rd_size is given in kB */
disk->major = RAMDISK_MAJOR;
disk->first_minor = i;
disk->fops = &rd_bd_op;
- disk->queue = &rd_queue;
+ disk->queue = &rd_queue[i];
sprintf(disk->disk_name, "ram%d", i);
sprintf(disk->devfs_name, "rd/%d", i);
set_capacity(disk, rd_size * 2);
@@ -362,6 +367,8 @@ static int __init rd_init (void)
NUM_RAMDISKS, rd_size, rd_blocksize);
return 0;
+out_queue:
+ kfree(rd_queue);
out:
while (i--)
put_disk(rd_disks[i]);
_
-- Maneesh Soni IBM Linux Technology Center, IBM India Software Lab, Bangalore. Phone: +91-80-5044999 email: maneesh@in.ibm.com http://lse.sourceforge.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/