rbd: adjust image object request ref counting
authorAlex Elder <elder@inktank.com>
Mon, 15 Apr 2013 19:50:37 +0000 (14:50 -0500)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:19:01 +0000 (21:19 -0700)
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>
drivers/block/rbd.c

index 8e8b876e83c321662c56c5b98f389f9df8c8e138..81751cd8361e409dcf25b3a046b7e55500044593 100644 (file)
@@ -1167,7 +1167,7 @@ static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request,
 {
        rbd_assert(obj_request->img_request == NULL);
 
-       rbd_obj_request_get(obj_request);
+       /* Image request now owns object's original reference */
        obj_request->img_request = img_request;
        obj_request->which = img_request->obj_request_count;
        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)
                ret = rbd_obj_request_submit(osdc, obj_request);
                if (ret)
                        return ret;
-               /*
-                * The image request has its own reference to each
-                * of its object requests, so we can safely drop the
-                * initial one here.
-                */
-               rbd_obj_request_put(obj_request);
        }
 
        return 0;