diff options
author | Alex Elder <elder@inktank.com> | 2012-08-29 18:11:07 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 15:30:52 -0400 |
commit | 0f308a3188b37f36bc5a078f5fe039a41714476e (patch) | |
tree | 89a847eb16afdea9712f8fbbdf7086e57762baaf /drivers/block/rbd.c | |
parent | 85ae8926751db5e09b9a12ee44609ee9e74b7aad (diff) |
rbd: call rbd_init_disk() sooner
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>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 7a600ca2dbcf..27988045b48e 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2623,10 +2623,16 @@ static ssize_t rbd_add(struct bus_type *bus, | |||
2623 | goto err_out_id; | 2623 | goto err_out_id; |
2624 | rbd_dev->major = rc; | 2624 | rbd_dev->major = rc; |
2625 | 2625 | ||
2626 | rc = rbd_bus_add_dev(rbd_dev); | 2626 | /* Set up the blkdev mapping. */ |
2627 | |||
2628 | rc = rbd_init_disk(rbd_dev); | ||
2627 | if (rc) | 2629 | if (rc) |
2628 | goto err_out_blkdev; | 2630 | goto err_out_blkdev; |
2629 | 2631 | ||
2632 | rc = rbd_bus_add_dev(rbd_dev); | ||
2633 | if (rc) | ||
2634 | goto err_out_disk; | ||
2635 | |||
2630 | /* | 2636 | /* |
2631 | * At this point cleanup in the event of an error is the job | 2637 | * At this point cleanup in the event of an error is the job |
2632 | * of the sysfs code (initiated by rbd_bus_del_dev()). | 2638 | * of the sysfs code (initiated by rbd_bus_del_dev()). |
@@ -2638,12 +2644,6 @@ static ssize_t rbd_add(struct bus_type *bus, | |||
2638 | if (rc) | 2644 | if (rc) |
2639 | goto err_out_bus; | 2645 | goto err_out_bus; |
2640 | 2646 | ||
2641 | /* Set up the blkdev mapping. */ | ||
2642 | |||
2643 | rc = rbd_init_disk(rbd_dev); | ||
2644 | if (rc) | ||
2645 | goto err_out_bus; | ||
2646 | |||
2647 | /* Everything's ready. Announce the disk to the world. */ | 2647 | /* Everything's ready. Announce the disk to the world. */ |
2648 | 2648 | ||
2649 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | 2649 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); |
@@ -2664,6 +2664,8 @@ err_out_bus: | |||
2664 | kfree(options); | 2664 | kfree(options); |
2665 | return rc; | 2665 | return rc; |
2666 | 2666 | ||
2667 | err_out_disk: | ||
2668 | rbd_free_disk(rbd_dev); | ||
2667 | err_out_blkdev: | 2669 | err_out_blkdev: |
2668 | unregister_blkdev(rbd_dev->major, rbd_dev->name); | 2670 | unregister_blkdev(rbd_dev->major, rbd_dev->name); |
2669 | err_out_id: | 2671 | err_out_id: |