+/**
+ * Implement OSP layer dt_object_operations::do_declare_destroy() interface.
+ *
+ * Create the dt_update_request to track the update for this OSP
+ * in the transaction.
+ *
+ * \param[in] env pointer to the thread context
+ * \param[in] dt pointer to the OSP layer dt_object to be destroyed
+ * \param[in] th pointer to the transaction handler
+ *
+ * \retval 0 for success
+ * \retval negative error number on failure
+ */
+int osp_md_declare_object_destroy(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ return osp_trans_update_request_create(th);
+}
+
+/**
+ * Interpreter call for object destroy
+ *
+ * Object destroy interpreter, which will be called after destroying
+ * the remote object to set flags and status.
+ *
+ * \param[in] env execution environment
+ * \param[in] reply update reply
+ * \param[in] req ptlrpc update request for destroying object
+ * \param[in] obj object to be destroyed
+ * \param[in] data data used in this function.
+ * \param[in] index index(position) of destroy update in the whole
+ * updates
+ * \param[in] rc update result on the remote MDT.
+ *
+ * \retval only return 0 for now
+ */
+static int osp_md_object_destroy_interpreter(const struct lu_env *env,
+ struct object_update_reply *reply,
+ struct ptlrpc_request *req,
+ struct osp_object *obj,
+ void *data, int index, int rc)
+{
+ /* not needed in cache any more */
+ set_bit(LU_OBJECT_HEARD_BANSHEE,
+ &obj->opo_obj.do_lu.lo_header->loh_flags);
+ return 0;
+}
+
+/**
+ * Implement OSP layer dt_object_operations::do_destroy() interface.
+ *
+ * Pack the destroy update into the RPC buffer, which will be sent
+ * to the remote MDT during transaction stop.
+ *
+ * It also marks the object as non-cached.
+ *
+ * \param[in] env pointer to the thread context
+ * \param[in] dt pointer to the OSP layer dt_object to be destroyed
+ * \param[in] th pointer to the transaction handler
+ *
+ * \retval 0 for success
+ * \retval negative error number on failure
+ */
+int osp_md_object_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
+{
+ struct osp_object *o = dt2osp_obj(dt);
+ struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
+ struct osp_update_request *update;
+ int rc = 0;
+
+ ENTRY;
+ o->opo_non_exist = 1;
+
+ LASSERT(osp->opd_connect_mdt);
+ update = thandle_to_osp_update_request(th);
+ LASSERT(update != NULL);
+
+ rc = osp_update_rpc_pack(env, object_destroy, update, OUT_DESTROY,
+ lu_object_fid(&dt->do_lu));
+ if (rc != 0)
+ RETURN(rc);
+
+ rc = osp_insert_update_callback(env, update, dt2osp_obj(dt), NULL,
+ osp_md_object_destroy_interpreter);
+ RETURN(rc);
+}
+