-static int osp_prep_unlink_update_req(const struct lu_env *env,
- struct osp_device *osp,
- struct llog_handle *llh,
- struct llog_rec_hdr *h,
- struct ptlrpc_request **reqp)
-{
- struct llog_unlink64_rec *rec = (struct llog_unlink64_rec *)h;
- struct dt_update_request *update = NULL;
- struct ptlrpc_request *req;
- const char *buf;
- struct llog_cookie lcookie;
- int size;
- int rc;
- ENTRY;
-
- update = out_create_update_req(&osp->opd_dt_dev);
- if (IS_ERR(update))
- RETURN(PTR_ERR(update));
-
- /* This can only happens for unlink slave directory, so decrease
- * ref for ".." and "." */
- rc = out_insert_update(env, update, OUT_REF_DEL, &rec->lur_fid, 0,
- NULL, NULL);
- if (rc != 0)
- GOTO(out, rc);
-
- rc = out_insert_update(env, update, OUT_REF_DEL, &rec->lur_fid, 0,
- NULL, NULL);
- if (rc != 0)
- GOTO(out, rc);
-
- lcookie.lgc_lgl = llh->lgh_id;
- lcookie.lgc_subsys = LLOG_MDS_OST_ORIG_CTXT;
- lcookie.lgc_index = h->lrh_index;
- size = sizeof(lcookie);
- buf = (const char *)&lcookie;
-
- rc = out_insert_update(env, update, OUT_DESTROY, &rec->lur_fid, 1,
- &size, &buf);
- if (rc != 0)
- GOTO(out, rc);
-
- rc = out_prep_update_req(env, osp->opd_obd->u.cli.cl_import,
- update->dur_req, &req);
- if (rc != 0)
- GOTO(out, rc);
-
- INIT_LIST_HEAD(&req->rq_exp_list);
- req->rq_svc_thread = (void *)OSP_JOB_MAGIC;
-
- req->rq_interpret_reply = osp_sync_interpret;
- req->rq_commit_cb = osp_sync_request_commit_cb;
- req->rq_cb_data = osp;
-
- ptlrpc_request_set_replen(req);
- *reqp = req;
-out:
- if (update != NULL)
- out_destroy_update_req(update);
-
- RETURN(rc);
-}
-
-static int osp_sync_new_unlink64_job(const struct lu_env *env,
- struct osp_device *d,
+/**
+ * Generate a request for unlink change.
+ *
+ * The function prepares a new RPC, initializes it with unlink(destroy)
+ * specific bits and sends the RPC. Depending on the target (MDT or OST)
+ * two different protocols are used. For MDT we use OUT (basically OSD API
+ * updates transferred via a network). For OST we still use the old
+ * protocol (OBD?), originally for compatibility. Later we can start to
+ * use OUT for OST as well, this will allow batching and better code
+ * unification.
+ *
+ * \param[in] d OSP device
+ * \param[in] llh llog handle where the record is stored
+ * \param[in] h llog record
+ *
+ * \retval 0 on success
+ * \retval negative negated errno on error
+ */
+static int osp_sync_new_unlink64_job(struct osp_device *d,