Whamcloud - gitweb
LU-14535 quota: get all quota info in LFS
[fs/lustre-release.git] / lustre / lov / lov_obd.c
index c3b10a0..a0f7cb9 100644 (file)
@@ -1255,6 +1255,7 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
        struct lov_obd *lov = &obd->u.lov;
        struct lov_tgt_desc *tgt;
        struct lov_pool_desc *pool = NULL;
+       struct list_head *lst = NULL;
        __u64 curspace = 0;
        __u64 bhardlimit = 0;
        int i, rc = 0;
@@ -1262,7 +1263,8 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
        ENTRY;
        if (oqctl->qc_cmd != Q_GETOQUOTA &&
            oqctl->qc_cmd != LUSTRE_Q_SETQUOTA &&
-           oqctl->qc_cmd != LUSTRE_Q_GETQUOTAPOOL) {
+           oqctl->qc_cmd != LUSTRE_Q_GETQUOTAPOOL &&
+           oqctl->qc_cmd != LUSTRE_Q_ITEROQUOTA) {
                rc = -EFAULT;
                CERROR("%s: bad quota opc %x for lov obd: rc = %d\n",
                       obd->obd_name, oqctl->qc_cmd, rc);
@@ -1278,6 +1280,9 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
                oqctl->qc_cmd = Q_GETOQUOTA;
        }
 
+       if (oqctl->qc_cmd == LUSTRE_Q_ITEROQUOTA)
+               lst = (struct list_head *)oqctl->qc_iter_list;
+
        /* for lov tgt */
        lov_tgts_getref(obd);
        for (i = 0; i < lov->desc.ld_tgt_count; i++) {
@@ -1304,7 +1309,11 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
                        continue;
                }
 
-               err = obd_quotactl(tgt->ltd_exp, oqctl);
+               if (oqctl->qc_cmd == LUSTRE_Q_ITEROQUOTA)
+                       err = obd_quota_iter(tgt->ltd_exp, oqctl, lst);
+               else
+                       err = obd_quotactl(tgt->ltd_exp, oqctl);
+
                if (err) {
                        if (tgt->ltd_active && !rc)
                                rc = err;
@@ -1324,6 +1333,7 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
                oqctl->qc_dqblk.dqb_curspace = curspace;
                oqctl->qc_dqblk.dqb_bhardlimit = bhardlimit;
        }
+
        RETURN(rc);
 }