rbd: set initial capacity in rbd_init_disk()
authorAlex Elder <elder@inktank.com>
Wed, 29 Aug 2012 22:11:07 +0000 (17:11 -0500)
committerAlex Elder <elder@inktank.com>
Mon, 1 Oct 2012 19:30:52 +0000 (14:30 -0500)
Move the setting of the initial capacity for an rbd image mapping
into rb_init_disk().

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c

index fa99b94b9dbb633479633d55c0ccb1f57a2d2a56..3274943b234220b17366f244b4a0d28af8c7b73e 100644 (file)
@@ -1901,6 +1901,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
 
        rbd_dev->disk = disk;
 
+       set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
+
        return 0;
 out_disk:
        put_disk(disk);
@@ -2646,7 +2648,6 @@ static ssize_t rbd_add(struct bus_type *bus,
 
        /* Everything's ready.  Announce the disk to the world. */
 
-       set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
        add_disk(rbd_dev->disk);
        pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name,
                (unsigned long long) rbd_dev->mapping.size);