Whamcloud - gitweb
LU-3536 osp: move update packing into out_lib.c
[fs/lustre-release.git] / lustre / osp / osp_trans.c
index 39a42bc..7d4ace8 100644 (file)
@@ -195,7 +195,7 @@ static int osp_async_update_interpret(const struct lu_env *env,
                index++;
        }
 
-       out_destroy_update_req(dt_update);
+       dt_update_request_destroy(dt_update);
 
        return 0;
 }
@@ -220,7 +220,7 @@ int osp_unplug_async_request(const struct lu_env *env,
        int                              rc;
 
        rc = out_prep_update_req(env, osp->opd_obd->u.cli.cl_import,
-                                update->dur_req, &req);
+                                update->dur_buf.ub_req, &req);
        if (rc != 0) {
                struct osp_async_request *oar;
                struct osp_async_request *next;
@@ -232,7 +232,7 @@ int osp_unplug_async_request(const struct lu_env *env,
                                               oar->oar_data, 0, rc);
                        osp_async_request_fini(env, oar);
                }
-               out_destroy_update_req(update);
+               dt_update_request_destroy(update);
        } else {
                LASSERT(list_empty(&update->dur_list));
 
@@ -265,7 +265,7 @@ osp_find_or_create_async_update_request(struct osp_device *osp)
        if (update != NULL)
                return update;
 
-       update = out_create_update_req(&osp->opd_dt_dev);
+       update = dt_update_request_create(&osp->opd_dt_dev);
        if (!IS_ERR(update))
                osp->opd_async_requests = update;
 
@@ -296,9 +296,9 @@ osp_find_or_create_async_update_request(struct osp_device *osp)
  * \retval                     0 for success
  * \retval                     negative error number on failure
  */
-int osp_insert_async_request(const struct lu_env *env,
-                            int op, struct osp_object *obj, int count,
-                            int *lens, const char **bufs, void *data,
+int osp_insert_async_request(const struct lu_env *env, enum update_type op,
+                            struct osp_object *obj, int count,
+                            __u16 *lens, const void **bufs, void *data,
                             osp_async_request_interpreter_t interpreter)
 {
        struct osp_async_request     *oar;
@@ -316,9 +316,10 @@ int osp_insert_async_request(const struct lu_env *env,
                GOTO(out, rc = PTR_ERR(update));
 
 again:
-       rc = out_insert_update(env, update, op, lu_object_fid(osp2lu_obj(obj)),
-                              count, lens, bufs);
        /* The queue is full. */
+       rc = out_update_pack(env, &update->dur_buf, op,
+                            lu_object_fid(osp2lu_obj(obj)), count, lens, bufs,
+                            0);
        if (rc == -E2BIG) {
                osp->opd_async_requests = NULL;
                mutex_unlock(&osp->opd_async_requests_mutex);
@@ -442,7 +443,7 @@ static int osp_trans_trigger(const struct lu_env *env, struct osp_device *osp,
 
                list_del_init(&dt_update->dur_list);
                rc = out_prep_update_req(env, osp->opd_obd->u.cli.cl_import,
-                                        dt_update->dur_req, &req);
+                                        dt_update->dur_buf.ub_req, &req);
                if (rc == 0) {
                        args = ptlrpc_req_async_args(req);
                        args->oaua_update = dt_update;
@@ -451,7 +452,7 @@ static int osp_trans_trigger(const struct lu_env *env, struct osp_device *osp,
                                osp_async_update_interpret;
                        ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
                } else {
-                       out_destroy_update_req(dt_update);
+                       dt_update_request_destroy(dt_update);
                }
        } else {
                th->th_sync = 1;
@@ -549,8 +550,9 @@ int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,
                goto put;
        }
 
-       if (dt_update->dur_req->ourq_count == 0) {
-               out_destroy_update_req(dt_update);
+       if (dt_update->dur_buf.ub_req == NULL ||
+           dt_update->dur_buf.ub_req->ourq_count == 0) {
+               dt_update_request_destroy(dt_update);
                goto put;
        }
 
@@ -568,7 +570,7 @@ int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,
                        }
 
                        if (rc != 0) {
-                               out_destroy_update_req(dt_update);
+                               dt_update_request_destroy(dt_update);
                                goto put;
                        }
 
@@ -578,14 +580,14 @@ int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,
                                obd_put_request_slot(cli);
                } else {
                        rc = th->th_result;
-                       out_destroy_update_req(dt_update);
+                       dt_update_request_destroy(dt_update);
                }
        } else {
                if (tu->tu_sent_after_local_trans)
                        rc = osp_trans_trigger(env, dt2osp_dev(dt),
                                               dt_update, th, false);
                rc = dt_update->dur_rc;
-               out_destroy_update_req(dt_update);
+               dt_update_request_destroy(dt_update);
        }
 
 put: