diff options
author | Alex Elder <elder@inktank.com> | 2013-05-08 23:50:04 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-05-13 16:06:43 -0400 |
commit | fb65d2284c117cfc28d30217d25a14a8e7a75a94 (patch) | |
tree | 6c49037e479805cec6c16b7ace641e51a42725f1 /drivers/block | |
parent | 8785b1d487f0a31afd2c802499786d3b355eccea (diff) |
rbd: define rbd_dev_unparent()
Define rbd_dev_unparent() to encapsulate cleaning up parent data
structures from a layered rbd image.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d861c71b4005..9c2b20a88be2 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1837,6 +1837,17 @@ static void rbd_obj_request_destroy(struct kref *kref) | |||
1837 | kmem_cache_free(rbd_obj_request_cache, obj_request); | 1837 | kmem_cache_free(rbd_obj_request_cache, obj_request); |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | /* It's OK to call this for a device with no parent */ | ||
1841 | |||
1842 | static void rbd_spec_put(struct rbd_spec *spec); | ||
1843 | static void rbd_dev_unparent(struct rbd_device *rbd_dev) | ||
1844 | { | ||
1845 | rbd_dev_remove_parent(rbd_dev); | ||
1846 | rbd_spec_put(rbd_dev->parent_spec); | ||
1847 | rbd_dev->parent_spec = NULL; | ||
1848 | rbd_dev->parent_overlap = 0; | ||
1849 | } | ||
1850 | |||
1840 | /* | 1851 | /* |
1841 | * Caller is responsible for filling in the list of object requests | 1852 | * Caller is responsible for filling in the list of object requests |
1842 | * that comprises the image request, and the Linux request pointer | 1853 | * that comprises the image request, and the Linux request pointer |
@@ -4491,10 +4502,7 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev) | |||
4491 | { | 4502 | { |
4492 | struct rbd_image_header *header; | 4503 | struct rbd_image_header *header; |
4493 | 4504 | ||
4494 | rbd_dev_remove_parent(rbd_dev); | 4505 | rbd_dev_unparent(rbd_dev); |
4495 | rbd_spec_put(rbd_dev->parent_spec); | ||
4496 | rbd_dev->parent_spec = NULL; | ||
4497 | rbd_dev->parent_overlap = 0; | ||
4498 | 4506 | ||
4499 | /* Free dynamic fields from the header, then zero it out */ | 4507 | /* Free dynamic fields from the header, then zero it out */ |
4500 | 4508 | ||
@@ -4570,7 +4578,7 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev) | |||
4570 | return 0; | 4578 | return 0; |
4571 | out_err: | 4579 | out_err: |
4572 | if (parent) { | 4580 | if (parent) { |
4573 | rbd_spec_put(rbd_dev->parent_spec); | 4581 | rbd_dev_unparent(rbd_dev); |
4574 | kfree(rbd_dev->header_name); | 4582 | kfree(rbd_dev->header_name); |
4575 | rbd_dev_destroy(parent); | 4583 | rbd_dev_destroy(parent); |
4576 | } else { | 4584 | } else { |