diff mbox

[7/7] rbd: simplify rbd_init_disk() a bit

Message ID 5049FAB9.30607@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Sept. 7, 2012, 1:46 p.m. UTC
This just simplifies a few things in rbd_init_disk(), now that the
previous patch has moved a bunch of initialization code out if it.
Done separately to facilitate review.

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

Comments

Josh Durgin Sept. 7, 2012, 8:32 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 09/07/2012 06:46 AM, Alex Elder wrote:
> This just simplifies a few things in rbd_init_disk(), now that the
> previous patch has moved a bunch of initialization code out if it.
> Done separately to facilitate review.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 6e735a7..634a16c 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1870,14 +1870,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
>   {
>   	struct gendisk *disk;
>   	struct request_queue *q;
> -	int rc;
>   	u64 segment_size;
>
>   	/* create gendisk info */
> -	rc = -ENOMEM;
>   	disk = alloc_disk(RBD_MINORS_PER_MAJOR);
>   	if (!disk)
> -		goto out;
> +		return -ENOMEM;
>
>   	snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d",
>   		 rbd_dev->dev_id);
> @@ -1887,7 +1885,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
>   	disk->private_data = rbd_dev;
>
>   	/* init rq */
> -	rc = -ENOMEM;
>   	q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock);
>   	if (!q)
>   		goto out_disk;
> @@ -1910,11 +1907,10 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
>   	rbd_dev->disk = disk;
>
>   	return 0;
> -
>   out_disk:
>   	put_disk(disk);
> -out:
> -	return rc;
> +
> +	return -ENOMEM;
>   }
>
>   /*
>

--
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 6e735a7..634a16c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1870,14 +1870,12 @@  static int rbd_init_disk(struct rbd_device *rbd_dev)
 {
 	struct gendisk *disk;
 	struct request_queue *q;
-	int rc;
 	u64 segment_size;

 	/* create gendisk info */
-	rc = -ENOMEM;
 	disk = alloc_disk(RBD_MINORS_PER_MAJOR);
 	if (!disk)
-		goto out;
+		return -ENOMEM;

 	snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d",
 		 rbd_dev->dev_id);
@@ -1887,7 +1885,6 @@  static int rbd_init_disk(struct rbd_device *rbd_dev)
 	disk->private_data = rbd_dev;

 	/* init rq */
-	rc = -ENOMEM;
 	q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock);
 	if (!q)
 		goto out_disk;
@@ -1910,11 +1907,10 @@  static int rbd_init_disk(struct rbd_device *rbd_dev)
 	rbd_dev->disk = disk;

 	return 0;
-
 out_disk:
 	put_disk(disk);
-out:
-	return rc;
+
+	return -ENOMEM;
 }

 /*