Whamcloud - gitweb
LU-8100 lmv: Correctly generate target_obd 36/20336/4
authorGiuseppe Di Natale <dinatale2@llnl.gov>
Thu, 12 May 2016 20:39:36 +0000 (13:39 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 2 Jun 2016 04:41:22 +0000 (04:41 +0000)
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 <dinatale2@llnl.gov>
Change-Id: I4bd3aaffd56707ea29b9b2d4366de5e20b3d3760
Reviewed-on: http://review.whamcloud.com/20336
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lmv/lproc_lmv.c

index 251dd93..02ea071 100644 (file)
@@ -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)