diff mbox

[6/9] rbd: call rbd_init_disk() sooner

Message ID 504A1687.9080104@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Sept. 7, 2012, 3:45 p.m. UTC
Call rbd_init_disk() from rbd_add() as soon as we have the major
device number for the mapping.

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

Comments

Josh Durgin Sept. 11, 2012, 3:06 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 09/07/2012 08:45 AM, Alex Elder wrote:
> Call rbd_init_disk() from rbd_add() as soon as we have the major
> device number for the mapping.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   16 +++++++++-------
>   1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 53e5308..8e82610 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2619,10 +2619,16 @@ static ssize_t rbd_add(struct bus_type *bus,
>   		goto err_out_id;
>   	rbd_dev->major = rc;
>
> -	rc = rbd_bus_add_dev(rbd_dev);
> +	/* Set up the blkdev mapping. */
> +
> +	rc = rbd_init_disk(rbd_dev);
>   	if (rc)
>   		goto err_out_blkdev;
>
> +	rc = rbd_bus_add_dev(rbd_dev);
> +	if (rc)
> +		goto err_out_disk;
> +
>   	/*
>   	 * At this point cleanup in the event of an error is the job
>   	 * of the sysfs code (initiated by rbd_bus_del_dev()).
> @@ -2634,12 +2640,6 @@ static ssize_t rbd_add(struct bus_type *bus,
>
>   	up_write(&rbd_dev->header_rwsem);
>
> -	/* Set up the blkdev mapping. */
> -
> -	rc = rbd_init_disk(rbd_dev);
> -	if (rc)
> -		goto err_out_bus;
> -
>   	/* Everything's ready.  Announce the disk to the world. */
>
>   	set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
> @@ -2662,6 +2662,8 @@ err_out_bus:
>   	kfree(options);
>   	return rc;
>
> +err_out_disk:
> +	rbd_free_disk(rbd_dev);
>   err_out_blkdev:
>   	unregister_blkdev(rbd_dev->major, rbd_dev->name);
>   err_out_id:
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 53e5308..8e82610 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2619,10 +2619,16 @@  static ssize_t rbd_add(struct bus_type *bus,
 		goto err_out_id;
 	rbd_dev->major = rc;

-	rc = rbd_bus_add_dev(rbd_dev);
+	/* Set up the blkdev mapping. */
+
+	rc = rbd_init_disk(rbd_dev);
 	if (rc)
 		goto err_out_blkdev;

+	rc = rbd_bus_add_dev(rbd_dev);
+	if (rc)
+		goto err_out_disk;
+
 	/*
 	 * At this point cleanup in the event of an error is the job
 	 * of the sysfs code (initiated by rbd_bus_del_dev()).
@@ -2634,12 +2640,6 @@  static ssize_t rbd_add(struct bus_type *bus,

 	up_write(&rbd_dev->header_rwsem);

-	/* Set up the blkdev mapping. */
-
-	rc = rbd_init_disk(rbd_dev);
-	if (rc)
-		goto err_out_bus;
-
 	/* Everything's ready.  Announce the disk to the world. */

 	set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
@@ -2662,6 +2662,8 @@  err_out_bus:
 	kfree(options);
 	return rc;

+err_out_disk:
+	rbd_free_disk(rbd_dev);
 err_out_blkdev:
 	unregister_blkdev(rbd_dev->major, rbd_dev->name);
 err_out_id: