From: wangdi Date: Sat, 30 Nov 2013 12:22:55 +0000 (-0800) Subject: LU-2802 lmv: get tgt by checking ltd_idx in lmv_find_target. X-Git-Tag: 2.3.63~40 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=57b3da5d4938e38f23593e14cebb3702c9085f3a;hp=aa368474cb4de18361e875ff503a98ba479bc3c6 LU-2802 lmv: get tgt by checking ltd_idx in lmv_find_target. Currently, lmv_find_target return lmv->tgts[mds] according to mdt_index, which is not correct. LMV index is created by mount sequence, while mdt_index by indicated by --index. So we should check ltd_idx in lmv_find_target. Signed-off-by: Wang Di Change-Id: I67a941cca00eb80ba91af6eb3f3441982d4fcab3 Reviewed-on: http://review.whamcloud.com/5412 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 32efb75..bef090c 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -113,7 +113,17 @@ 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 NULL; } static inline struct lmv_tgt_desc *