diff mbox

[3/4] rbd: defer setting disk capacity

Message ID 517BC5A2.5000604@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder April 27, 2013, 12:33 p.m. UTC
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>
---
 drivers/block/rbd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b04e3e1..12bc89f 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);
@@ -4778,6 +4776,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);