Skip to content

Commit

Permalink
rbd: simplify rbd_init_disk() a bit
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
  • Loading branch information
Alex Elder committed Oct 1, 2012
1 parent 2ac4e75 commit 1fcdb8a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}

/*
Expand Down

0 comments on commit 1fcdb8a

Please sign in to comment.