Whamcloud - gitweb
LU-12624 obdclass: lu_tgt_descs cleanup
[fs/lustre-release.git] / lustre / lmv / lproc_lmv.c
index 981b032..97faa02 100644 (file)
@@ -44,10 +44,8 @@ static ssize_t numobd_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *dev = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lmv_desc *desc;
 
-        desc = &dev->u.lmv.desc;
-       return sprintf(buf, "%u\n", desc->ld_tgt_count);
+       return sprintf(buf, "%u\n", dev->u.lmv.lmv_mdt_count);
 }
 LUSTRE_RO_ATTR(numobd);
 
@@ -56,10 +54,9 @@ static ssize_t activeobd_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *dev = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lmv_desc *desc;
 
-        desc = &dev->u.lmv.desc;
-       return sprintf(buf, "%u\n", desc->ld_active_tgt_count);
+       return sprintf(buf, "%u\n",
+               dev->u.lmv.lmv_mdt_descs.ltd_lmv_desc.ld_active_tgt_count);
 }
 LUSTRE_RO_ATTR(activeobd);
 
@@ -68,10 +65,9 @@ static ssize_t desc_uuid_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *dev = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lmv_desc *desc;
 
-       desc = &dev->u.lmv.desc;
-       return sprintf(buf, "%s\n", desc->ld_uuid.uuid);
+       return sprintf(buf, "%s\n",
+                      dev->u.lmv.lmv_mdt_descs.ltd_lmv_desc.ld_uuid.uuid);
 }
 LUSTRE_RO_ATTR(desc_uuid);
 
@@ -82,7 +78,8 @@ static ssize_t qos_maxage_show(struct kobject *kobj,
        struct obd_device *dev = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
 
-       return sprintf(buf, "%u\n", dev->u.lmv.desc.ld_qos_maxage);
+       return sprintf(buf, "%u\n",
+                      dev->u.lmv.lmv_mdt_descs.ltd_lmv_desc.ld_qos_maxage);
 }
 
 static ssize_t qos_maxage_store(struct kobject *kobj,
@@ -99,7 +96,7 @@ static ssize_t qos_maxage_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       dev->u.lmv.desc.ld_qos_maxage = val;
+       dev->u.lmv.lmv_mdt_descs.ltd_lmv_desc.ld_qos_maxage = val;
 
        return count;
 }
@@ -181,16 +178,19 @@ LUSTRE_RW_ATTR(qos_threshold_rr);
 #ifdef CONFIG_PROC_FS
 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;
+       struct obd_device *dev = p->private;
+       struct lmv_obd *lmv = &dev->u.lmv;
+       struct lu_tgt_desc *tgt;
+
+       while (*pos < lmv->lmv_mdt_descs.ltd_tgts_size) {
+               tgt = lmv_tgt(lmv, (__u32)*pos);
+               if (tgt)
+                       return tgt;
 
-       while (*pos < lmv->tgts_size) {
-               if (lmv->tgts[*pos])
-                       return lmv->tgts[*pos];
                ++*pos;
        }
 
-       return  NULL;
+       return NULL;
 }
 
 static void lmv_tgt_seq_stop(struct seq_file *p, void *v)
@@ -199,17 +199,20 @@ static void lmv_tgt_seq_stop(struct seq_file *p, void *v)
 
 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;
+       struct obd_device *dev = p->private;
+       struct lmv_obd *lmv = &dev->u.lmv;
+       struct lu_tgt_desc *tgt;
 
        ++*pos;
-       while (*pos < lmv->tgts_size) {
-               if (lmv->tgts[*pos])
-                       return lmv->tgts[*pos];
+       while (*pos < lmv->lmv_mdt_descs.ltd_tgts_size) {
+               tgt = lmv_tgt(lmv, (__u32)*pos);
+               if (tgt)
+                       return tgt;
+
                ++*pos;
        }
 
-       return  NULL;
+       return NULL;
 }
 
 static int lmv_tgt_seq_show(struct seq_file *p, void *v)