+ * Implementation of dt_index_operations::dio_declare_insert
+ *
+ * For non-remote transaction, it will add an OUT_INDEX_INSERT sub-request
+ * into the OUT RPC that will be flushed when the transaction start.
+ *
+ * \param[in] env execution environment
+ * \param[in] dt object for which to insert index
+ * \param[in] rec record of the index which will be inserted
+ * \param[in] key key of the index which will be inserted
+ * \param[in] th the transaction handle
+ *
+ * \retval 0 if the insertion succeeds.
+ * \retval negative errno if the insertion fails.
+ */
+static int osp_md_declare_index_insert(const struct lu_env *env,
+ struct dt_object *dt,
+ const struct dt_rec *rec,
+ const struct dt_key *key,
+ struct thandle *th)
+{
+ int rc = 0;
+
+ if (!is_only_remote_trans(th)) {
+ rc = __osp_md_index_insert(env, dt, rec, key, th);
+
+ CDEBUG(D_INFO, "declare index insert "DFID" key %s, rec "DFID
+ ": rc = %d\n", PFID(&dt->do_lu.lo_header->loh_fid),
+ (char *)key,
+ PFID(((struct dt_insert_rec *)rec)->rec_fid), rc);
+ }
+
+ return rc;
+}
+
+/**