and changed files
[powerpc.git] / drivers / block / rd.c
index 3cf246a..a1512da 100644 (file)
@@ -84,7 +84,7 @@ int rd_size = CONFIG_BLK_DEV_RAM_SIZE;                /* Size of the RAM disks */
  * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that
  * supposes the filesystem in the image uses a BLOCK_SIZE blocksize).
  */
-static int rd_blocksize = BLOCK_SIZE;          /* blocksize of the RAM disks */
+static int rd_blocksize = CONFIG_BLK_DEV_RAM_BLOCKSIZE;
 
 /*
  * Copyright (C) 2000 Linus Torvalds.
@@ -151,7 +151,7 @@ static int ramdisk_commit_write(struct file *file, struct page *page,
 }
 
 /*
- * ->writepage to the the blockdev's mapping has to redirty the page so that the
+ * ->writepage to the blockdev's mapping has to redirty the page so that the
  * VM doesn't go and steal it.  We return AOP_WRITEPAGE_ACTIVATE so that the VM
  * won't try to (pointlessly) write the page again for a while.
  *
@@ -403,7 +403,7 @@ static void __exit rd_cleanup(void)
                struct block_device *bdev = rd_bdev[i];
                rd_bdev[i] = NULL;
                if (bdev) {
-                       invalidate_bdev(bdev, 1);
+                       invalidate_bdev(bdev);
                        blkdev_put(bdev);
                }
                del_gendisk(rd_disks[i]);
@@ -432,6 +432,12 @@ static int __init rd_init(void)
                rd_disks[i] = alloc_disk(1);
                if (!rd_disks[i])
                        goto out;
+
+               rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
+               if (!rd_queue[i]) {
+                       put_disk(rd_disks[i]);
+                       goto out;
+               }
        }
 
        if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) {
@@ -442,10 +448,6 @@ static int __init rd_init(void)
        for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
                struct gendisk *disk = rd_disks[i];
 
-               rd_queue[i] = blk_alloc_queue(GFP_KERNEL);
-               if (!rd_queue[i])
-                       goto out_queue;
-
                blk_queue_make_request(rd_queue[i], &rd_make_request);
                blk_queue_hardsect_size(rd_queue[i], rd_blocksize);
 
@@ -466,8 +468,6 @@ static int __init rd_init(void)
                CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize);
 
        return 0;
-out_queue:
-       unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
 out:
        while (i--) {
                put_disk(rd_disks[i]);