- * Prepare OUT-based object destroy RPC.
- *
- * The function allocates a new RPC with OUT format. Then initializes the RPC
- * to contain OUT_DESTROY update against the object specified in the llog
- * record provided by the caller.
- *
- * \param[in] env LU environment provided by the caller
- * \param[in] osp OSP device
- * \param[in] llh llog handle where the record is stored
- * \param[in] h llog record
- * \param[out] reqp request prepared
- *
- * \retval 0 on success
- * \retval negative negated errno on error
- */
-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;
- struct llog_cookie lcookie;
- const void *buf;
- __u16 size;
- int rc;
- ENTRY;
-
- update = dt_update_request_create(&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_update_pack(env, &update->dur_buf, OUT_REF_DEL, &rec->lur_fid,
- 0, NULL, NULL, 0);
- if (rc != 0)
- GOTO(out, rc);
-
- rc = out_update_pack(env, &update->dur_buf, OUT_REF_DEL, &rec->lur_fid,
- 0, NULL, NULL, 0);
- 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 = &lcookie;
-
- rc = out_update_pack(env, &update->dur_buf, OUT_DESTROY, &rec->lur_fid,
- 1, &size, &buf, 0);
- if (rc != 0)
- GOTO(out, rc);
-
- rc = osp_prep_update_req(env, osp->opd_obd->u.cli.cl_import,
- update->dur_buf.ub_req, &req);
- if (rc != 0)
- GOTO(out, rc);
-
- 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)
- dt_update_request_destroy(update);
-
- RETURN(rc);
-}
-
-/**