diff mbox

[4/4] rbd: defer setting the mapping size and features

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

Commit Message

Alex Elder April 27, 2013, 12:33 p.m. UTC
There's no need to set the size/features for a mapped device until
we're about to make it available for use.  So wait until then to do
it.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


@@ -4774,10 +4770,15 @@ static int rbd_dev_probe_finish(struct
rbd_device *rbd_dev)
 	if (ret)
 		goto err_out_bus;

-	/* Everything's ready.  Announce the disk to the world. */
+	ret = rbd_dev_set_mapping(rbd_dev);
+	if (ret)
+		goto err_out_bus;

 	set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
 	set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
+
+	/* Everything's ready.  Announce the disk to the world. */
+
 	add_disk(rbd_dev->disk);

 	pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name,
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 12bc89f..b10348c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4712,10 +4712,6 @@  static int rbd_dev_probe_finish(struct rbd_device
*rbd_dev)
 	if (ret)
 		goto err_out_snaps;

-	ret = rbd_dev_set_mapping(rbd_dev);
-	if (ret)
-		goto err_out_snaps;
-
 	/* generate unique id: find highest unique id, add one */
 	rbd_dev_id_get(rbd_dev);