rbd: get rid of img_request_layered_clear()
[linux-2.6-microblaze.git] / drivers / block / rbd.c
index 6343402..c61c5dd 100644 (file)
@@ -349,7 +349,6 @@ struct rbd_img_request {
        struct pending_result   pending;
        struct work_struct      work;
        int                     work_result;
-       struct kref             kref;
 };
 
 #define for_each_obj_request(ireq, oreq) \
@@ -1320,15 +1319,6 @@ static void rbd_obj_request_put(struct rbd_obj_request *obj_request)
        kref_put(&obj_request->kref, rbd_obj_request_destroy);
 }
 
-static void rbd_img_request_destroy(struct kref *kref);
-static void rbd_img_request_put(struct rbd_img_request *img_request)
-{
-       rbd_assert(img_request != NULL);
-       dout("%s: img %p (was %d)\n", __func__, img_request,
-               kref_read(&img_request->kref));
-       kref_put(&img_request->kref, rbd_img_request_destroy);
-}
-
 static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request,
                                        struct rbd_obj_request *obj_request)
 {
@@ -1366,18 +1356,10 @@ static void rbd_osd_submit(struct ceph_osd_request *osd_req)
 static void img_request_layered_set(struct rbd_img_request *img_request)
 {
        set_bit(IMG_REQ_LAYERED, &img_request->flags);
-       smp_mb();
-}
-
-static void img_request_layered_clear(struct rbd_img_request *img_request)
-{
-       clear_bit(IMG_REQ_LAYERED, &img_request->flags);
-       smp_mb();
 }
 
 static bool img_request_layered_test(struct rbd_img_request *img_request)
 {
-       smp_mb();
        return test_bit(IMG_REQ_LAYERED, &img_request->flags) != 0;
 }
 
@@ -1659,29 +1641,23 @@ static struct rbd_img_request *rbd_img_request_create(
        INIT_LIST_HEAD(&img_request->lock_item);
        INIT_LIST_HEAD(&img_request->object_extents);
        mutex_init(&img_request->state_mutex);
-       kref_init(&img_request->kref);
 
        return img_request;
 }
 
-static void rbd_img_request_destroy(struct kref *kref)
+static void rbd_img_request_destroy(struct rbd_img_request *img_request)
 {
-       struct rbd_img_request *img_request;
        struct rbd_obj_request *obj_request;
        struct rbd_obj_request *next_obj_request;
 
-       img_request = container_of(kref, struct rbd_img_request, kref);
-
        dout("%s: img %p\n", __func__, img_request);
 
        WARN_ON(!list_empty(&img_request->lock_item));
        for_each_obj_request_safe(img_request, obj_request, next_obj_request)
                rbd_img_obj_request_del(img_request, obj_request);
 
-       if (img_request_layered_test(img_request)) {
-               img_request_layered_clear(img_request);
+       if (img_request_layered_test(img_request))
                rbd_dev_parent_put(img_request->rbd_dev);
-       }
 
        if (rbd_img_is_write(img_request))
                ceph_put_snap_context(img_request->snapc);
@@ -2888,7 +2864,7 @@ static int rbd_obj_read_from_parent(struct rbd_obj_request *obj_req)
                                              obj_req->copyup_bvecs);
        }
        if (ret) {
-               rbd_img_request_put(child_img_req);
+               rbd_img_request_destroy(child_img_req);
                return ret;
        }
 
@@ -3647,7 +3623,7 @@ again:
        if (test_bit(IMG_REQ_CHILD, &img_req->flags)) {
                struct rbd_obj_request *obj_req = img_req->obj_request;
 
-               rbd_img_request_put(img_req);
+               rbd_img_request_destroy(img_req);
                if (__rbd_obj_handle_request(obj_req, &result)) {
                        img_req = obj_req->img_request;
                        goto again;
@@ -3655,7 +3631,7 @@ again:
        } else {
                struct request *rq = img_req->rq;
 
-               rbd_img_request_put(img_req);
+               rbd_img_request_destroy(img_req);
                blk_mq_end_request(rq, errno_to_blk_status(result));
        }
 }
@@ -4801,7 +4777,7 @@ static void rbd_queue_workfn(struct work_struct *work)
        return;
 
 err_img_request:
-       rbd_img_request_put(img_request);
+       rbd_img_request_destroy(img_request);
 err_rq:
        if (result)
                rbd_warn(rbd_dev, "%s %llx at %llx result %d",