+static inline int
+lmv_find_target_index(struct lmv_obd *lmv, const struct lu_fid *fid)
+{
+ struct lmv_tgt_desc *ltd;
+ mdsno_t mdt_idx = 0;
+ int index = 0;
+
+ if (lmv->desc.ld_tgt_count > 1) {
+ int rc;
+ rc = lmv_fld_lookup(lmv, fid, &mdt_idx);
+ if (rc < 0)
+ return rc;
+ }
+
+ ltd = lmv_get_target(lmv, mdt_idx, &index);
+ if (IS_ERR(ltd))
+ return PTR_ERR(ltd);
+
+ return index;
+}
+