Whamcloud - gitweb
LU-3375 test: use available mdc for replay-single test_44
[fs/lustre-release.git] / lustre / lmv / lmv_internal.h
index 32efb75..15692c5 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -113,7 +113,18 @@ static inline int lmv_get_easize(struct lmv_obd *lmv)
 static inline struct lmv_tgt_desc *
 lmv_get_target(struct lmv_obd *lmv, mdsno_t mds)
 {
-       return lmv->tgts[mds];
+       int count = lmv->desc.ld_tgt_count;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               if (lmv->tgts[i] == NULL)
+                       continue;
+
+               if (lmv->tgts[i]->ltd_idx == mds)
+                       return lmv->tgts[i];
+       }
+
+       return ERR_PTR(-ENODEV);
 }
 
 static inline struct lmv_tgt_desc *