* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
/* only when block qunit is reduced, boardcast to osts */
if ((adjust_res & LQS_BLK_DECREASE) && QAQ_IS_ADJBLK(oqaq))
- rc = obd_quota_adjust_qunit(mds->mds_osc_exp, oqaq, qctxt);
+ rc = obd_quota_adjust_qunit(mds->mds_lov_exp, oqaq, qctxt);
out:
lustre_dqput(dquot);
oqctl->qc_cmd = Q_FINVALIDATE;
rc = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
if (!rc)
- rc = obd_quotactl(mds->mds_osc_exp, oqctl);
+ rc = obd_quotactl(mds->mds_lov_exp, oqctl);
cfs_up_write(&mds->mds_qonoff_sem);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
GOTO(out, rc1);
}
- rc = obd_quotactl(mds->mds_osc_exp, oqctl);
+ rc = obd_quotactl(mds->mds_lov_exp, oqctl);
if (rc && rc != -EALREADY) {
CWARN("mds remote quota[%d] is failed to be off for %d\n",
oqctl->qc_type, rc);
id[GRPQUOTA] = oqctl->qc_id;
/* initialize all slave's limit */
- rc = obd_quotactl(mds->mds_osc_exp, ioqc);
+ rc = obd_quotactl(mds->mds_lov_exp, ioqc);
rc = qctxt_adjust_qunit(obd, &obd->u.obt.obt_qctxt, id, 1, 0, NULL);
if (rc == -EDQUOT || rc == -EBUSY) {
/* adjust remote lqs */
if (QAQ_IS_ADJBLK(qaq)) {
- rc = obd_quota_adjust_qunit(obd->u.mds.mds_osc_exp, qaq, qctxt);
+ rc = obd_quota_adjust_qunit(obd->u.mds.mds_lov_exp, qaq, qctxt);
if (rc < 0)
CERROR("adjust slaves' qunit size failed!(rc=%d)\n", rc);
{
struct mds_obd *mds = &obd->u.mds;
struct lustre_quota_ctxt *qctxt = &mds->mds_obt.obt_qctxt;
- struct obd_device *lov_obd = class_exp2obd(mds->mds_osc_exp);
+ struct obd_device *lov_obd = class_exp2obd(mds->mds_lov_exp);
struct lov_obd *lov = &lov_obd->u.lov;
struct quota_adjust_qunit *oqaq = NULL;
struct lustre_quota_info *qinfo = &mds->mds_quota_info;
/* get block usage from OSS */
soqc->qc_dqblk.dqb_curspace = 0;
- rc = obd_quotactl(obd->u.mds.mds_osc_exp, soqc);
+ rc = obd_quotactl(obd->u.mds.mds_lov_exp, soqc);
if (!rc || rc == -EREMOTEIO) {
oqctl->qc_dqblk.dqb_curspace = soqc->qc_dqblk.dqb_curspace;
oqctl->qc_dqblk.dqb_valid |= QIF_SPACE;
dqblk->dqb_curinodes = 0;
dqblk->dqb_curspace = 0;
rc = mds_get_space(obd, oqctl);
+
+ /*
+ * Querying of curinodes and/or curspace may have failed, administrative
+ * quota data are likely to be better approximation to the real usage in
+ * this case.
+ */
+ if (!(dqblk->dqb_valid & QIF_INODES) && dquot->dq_dqb.dqb_curinodes > 0)
+ dqblk->dqb_curinodes = dquot->dq_dqb.dqb_curinodes;
+
+ if (!(dqblk->dqb_valid & QIF_SPACE) && dquot->dq_dqb.dqb_curspace > 0)
+ dqblk->dqb_curspace = dquot->dq_dqb.dqb_curspace;
+
RETURN(rc);
out:
qctl->qc_type = type;
qctl->qc_id = id;
qctl->qc_stat = QUOTA_RECOVERING;
- rc = obd_quotactl(mds->mds_osc_exp, qctl);
+ rc = obd_quotactl(mds->mds_lov_exp, qctl);
cfs_down_write(&mds->mds_qonoff_sem);
if (rc)
GOTO(out, rc);
/* for mds */
class_incref(obd, "qmaster_recovd_mds", obd);
/* for lov */
- class_incref(mds->mds_osc_obd, "qmaster_recovd_lov", mds->mds_osc_obd);
+ class_incref(mds->mds_lov_obd, "qmaster_recovd_lov", mds->mds_lov_obd);
cfs_complete(&data->comp);
}
}
cfs_up_write(&mds->mds_qonoff_sem);
- class_decref(mds->mds_osc_obd, "qmaster_recovd_lov", mds->mds_osc_obd);
+ class_decref(mds->mds_lov_obd, "qmaster_recovd_lov", mds->mds_lov_obd);
class_decref(obd, "qmaster_recovd_mds", obd);
RETURN(rc);
}