+ struct dt_object *next = dt_object_child(dt);
+ struct lod_it *it = &lod_env_info(env)->lti_it;
+ struct dt_it *it_next;
+
+
+ it_next = next->do_index_ops->dio_it.init(env, next, attr, capa);
+ if (IS_ERR(it_next))
+ return it_next;
+
+ /* currently we do not use more than one iterator per thread
+ * so we store it in thread info. if at some point we need
+ * more active iterators in a single thread, we can allocate
+ * additional ones */
+ LASSERT(it->lit_obj == NULL);
+
+ it->lit_it = it_next;
+ it->lit_obj = next;
+
+ return (struct dt_it *)it;
+}
+
+#define LOD_CHECK_IT(env, it) \
+{ \
+ /* IT is supposed to be in thread info always */ \
+ LASSERT((it) == &lod_env_info(env)->lti_it); \
+ LASSERT((it)->lit_obj != NULL); \
+ LASSERT((it)->lit_it != NULL); \
+} while(0)
+
+void lod_it_fini(const struct lu_env *env, struct dt_it *di)
+{
+ struct lod_it *it = (struct lod_it *)di;
+
+ LOD_CHECK_IT(env, it);
+ it->lit_obj->do_index_ops->dio_it.fini(env, it->lit_it);
+
+ /* the iterator not in use any more */
+ it->lit_obj = NULL;
+ it->lit_it = NULL;
+}
+
+int lod_it_get(const struct lu_env *env, struct dt_it *di,
+ const struct dt_key *key)
+{
+ const struct lod_it *it = (const struct lod_it *)di;
+
+ LOD_CHECK_IT(env, it);
+ return it->lit_obj->do_index_ops->dio_it.get(env, it->lit_it, key);
+}
+
+void lod_it_put(const struct lu_env *env, struct dt_it *di)
+{
+ struct lod_it *it = (struct lod_it *)di;
+
+ LOD_CHECK_IT(env, it);
+ return it->lit_obj->do_index_ops->dio_it.put(env, it->lit_it);
+}
+
+int lod_it_next(const struct lu_env *env, struct dt_it *di)
+{
+ struct lod_it *it = (struct lod_it *)di;
+
+ LOD_CHECK_IT(env, it);
+ return it->lit_obj->do_index_ops->dio_it.next(env, it->lit_it);
+}
+
+struct dt_key *lod_it_key(const struct lu_env *env, const struct dt_it *di)
+{
+ const struct lod_it *it = (const struct lod_it *)di;
+
+ LOD_CHECK_IT(env, it);
+ return it->lit_obj->do_index_ops->dio_it.key(env, it->lit_it);
+}
+
+int lod_it_key_size(const struct lu_env *env, const struct dt_it *di)
+{
+ struct lod_it *it = (struct lod_it *)di;