From: Giuseppe Di Natale Date: Thu, 12 May 2016 20:39:36 +0000 (-0700) Subject: LU-8100 lmv: Correctly generate target_obd X-Git-Tag: 2.8.54~16 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e5bb5a373cb3548ec8f5989c7e08fa7a3c8259f3 LU-8100 lmv: Correctly generate target_obd The target_obd proc file was not being generated correctly in cases where nonconsecutive MDT indices were used when generating a filesystem. Signed-off-by: Giuseppe Di Natale Change-Id: I4bd3aaffd56707ea29b9b2d4366de5e20b3d3760 Reviewed-on: http://review.whamcloud.com/20336 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index 251dd93..02ea071 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -160,7 +160,15 @@ static void *lmv_tgt_seq_start(struct seq_file *p, loff_t *pos) { struct obd_device *dev = p->private; struct lmv_obd *lmv = &dev->u.lmv; - return (*pos >= lmv->desc.ld_tgt_count) ? NULL : lmv->tgts[*pos]; + + while (*pos < lmv->tgts_size) { + if (lmv->tgts[*pos] != NULL) + return lmv->tgts[*pos]; + + ++*pos; + } + + return NULL; } static void lmv_tgt_seq_stop(struct seq_file *p, void *v) @@ -172,8 +180,16 @@ static void *lmv_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) { struct obd_device *dev = p->private; struct lmv_obd *lmv = &dev->u.lmv; + ++*pos; - return (*pos >= lmv->desc.ld_tgt_count) ? NULL : lmv->tgts[*pos]; + while (*pos < lmv->tgts_size) { + if (lmv->tgts[*pos] != NULL) + return lmv->tgts[*pos]; + + ++*pos; + } + + return NULL; } static int lmv_tgt_seq_show(struct seq_file *p, void *v)