summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-26 15:44:36 -0500
committerSage Weil <sage@inktank.com>2013-05-01 21:19:48 -0700
commitb5156e76da01c23e14e962594553f1735b1db298 (patch)
tree8d8340337d9cece10b521c89e0f712507623f311 /drivers/block
parent129b79d4498581e52175ac5c3ef2168f616b0e5e (diff)
rbd: defer setting disk capacity
Don't set the disk capacity until right before we announce the device as available for use. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f84a11ed25a4..b6024a2d7b86 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3147,8 +3147,6 @@ 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);
@@ -4784,6 +4782,7 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev)
/* Everything's ready. Announce the disk to the world. */
+ set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
add_disk(rbd_dev->disk);