diff options
author | Alex Elder <elder@inktank.com> | 2013-04-15 15:50:37 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:19:01 -0400 |
commit | b155e86cf619886388d80ec298b0f13694c83595 (patch) | |
tree | 5805bc6f446d4457b765eae514b5c5107bbf03e0 /drivers/block | |
parent | 49719778bfa5371ec9b5a7d989bb29000e3ac5df (diff) |
rbd: adjust image object request ref counting
An extra reference is taken when an object request is added as one
of the requests making up an image object. A reference is dropped
again when the image's object requests get submitted.
The original reference for the object request will remain throughout
this period, so we don't need to add and then take away an extra
one.
This can be interpreted as the image request inheriting the original
object request's reference.
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 | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8e8b876e83c3..81751cd8361e 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1167,7 +1167,7 @@ static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, | |||
1167 | { | 1167 | { |
1168 | rbd_assert(obj_request->img_request == NULL); | 1168 | rbd_assert(obj_request->img_request == NULL); |
1169 | 1169 | ||
1170 | rbd_obj_request_get(obj_request); | 1170 | /* Image request now owns object's original reference */ |
1171 | obj_request->img_request = img_request; | 1171 | obj_request->img_request = img_request; |
1172 | obj_request->which = img_request->obj_request_count; | 1172 | obj_request->which = img_request->obj_request_count; |
1173 | rbd_assert(!obj_request_img_data_test(obj_request)); | 1173 | rbd_assert(!obj_request_img_data_test(obj_request)); |
@@ -1815,12 +1815,6 @@ static int rbd_img_request_submit(struct rbd_img_request *img_request) | |||
1815 | ret = rbd_obj_request_submit(osdc, obj_request); | 1815 | ret = rbd_obj_request_submit(osdc, obj_request); |
1816 | if (ret) | 1816 | if (ret) |
1817 | return ret; | 1817 | return ret; |
1818 | /* | ||
1819 | * The image request has its own reference to each | ||
1820 | * of its object requests, so we can safely drop the | ||
1821 | * initial one here. | ||
1822 | */ | ||
1823 | rbd_obj_request_put(obj_request); | ||
1824 | } | 1818 | } |
1825 | 1819 | ||
1826 | return 0; | 1820 | return 0; |