+ struct osp_it *it = (struct osp_it *)di;
+ struct lu_dirent *ent = (struct lu_dirent *)it->ooi_ent;
+ size_t reclen;
+
+ reclen = lu_dirent_calc_size(le16_to_cpu(ent->lde_namelen), attr);
+ memcpy(rec, ent, reclen);
+ return 0;
+}
+
+/**
+ * Implementation of dt_index_operations::dio_it.load
+ *
+ * Locate the iteration cursor to the specified position (cookie).
+ *
+ * \param[in] env pointer to the thread context
+ * \param[in] di pointer to the iteration structure
+ * \param[in] hash the specified position
+ *
+ * \retval positive number for locating to the exactly position
+ * or the next
+ * \retval 0 for arriving at the end of the iteration
+ * \retval negative error number on failure
+ */
+static int osp_it_load(const struct lu_env *env, const struct dt_it *di,
+ __u64 hash)
+{
+ struct osp_it *it = (struct osp_it *)di;
+ int rc;
+
+ it->ooi_next = hash;
+ rc = osp_md_index_it_next(env, (struct dt_it *)di);
+ if (rc == 1)
+ return 0;
+
+ if (rc == 0)
+ return 1;
+
+ return rc;
+}
+
+const struct dt_index_operations osp_md_index_ops = {
+ .dio_lookup = osp_md_index_lookup,
+ .dio_declare_insert = osp_md_declare_index_insert,
+ .dio_insert = osp_md_index_insert,
+ .dio_declare_delete = osp_md_declare_index_delete,
+ .dio_delete = osp_md_index_delete,
+ .dio_it = {
+ .init = osp_it_init,
+ .fini = osp_it_fini,
+ .get = osp_it_get,
+ .put = osp_it_put,
+ .next = osp_md_index_it_next,
+ .key = osp_it_key,
+ .key_size = osp_it_key_size,
+ .rec = osp_md_index_it_rec,
+ .store = osp_it_store,
+ .load = osp_it_load,
+ .key_rec = osp_it_key_rec,
+ }
+};
+
+/**
+ * Implement OSP layer dt_object_operations::do_xattr_list() interface.
+ *
+ * List extended attribute from the specified MDT/OST object, result is not
+ * cached because this is called by directory migration only.
+ *
+ * \param[in] env pointer to the thread context
+ * \param[in] dt pointer to the OSP layer dt_object
+ * \param[out] buf pointer to the lu_buf to hold the extended attribute
+ *
+ * \retval positive bytes used/required in the buffer
+ * \retval negative error number on failure
+ */
+static int osp_md_xattr_list(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf)
+{
+ struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
+ struct osp_object *obj = dt2osp_obj(dt);
+ struct dt_device *dev = &osp->opd_dt_dev;
+ struct lu_buf *rbuf = &osp_env_info(env)->osi_lb2;
+ struct osp_update_request *update = NULL;
+ struct ptlrpc_request *req = NULL;
+ struct object_update_reply *reply;
+ const char *dname = dt->do_lu.lo_dev->ld_obd->obd_name;
+ int rc = 0;