-
-int client_quota_check(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- struct ptlrpc_request *req;
- struct obd_quotactl *body;
- const struct req_format *rf;
- int ver, opc, rc;
- ENTRY;
-
- if (!strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_MDC_NAME)) {
- rf = &RQF_MDS_QUOTACHECK;
- ver = LUSTRE_MDS_VERSION;
- opc = MDS_QUOTACHECK;
- } else if (!strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_OSC_NAME)) {
- rf = &RQF_OST_QUOTACHECK;
- ver = LUSTRE_OST_VERSION;
- opc = OST_QUOTACHECK;
- } else {
- RETURN(-EINVAL);
- }
-
- req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), rf, ver, opc);
- if (req == NULL)
- RETURN(-ENOMEM);
-
- body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
- *body = *oqctl;
-
- ptlrpc_request_set_replen(req);
-
- /* the next poll will find -ENODATA, that means quotacheck is
- * going on */
- cli->cl_qchk_stat = -ENODATA;
- rc = ptlrpc_queue_wait(req);
- if (rc)
- cli->cl_qchk_stat = rc;
- ptlrpc_req_finished(req);
- RETURN(rc);
-}
-
-int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- int rc;
- ENTRY;
-
- rc = cli->cl_qchk_stat;
-
- /* the client is not the previous one */
- if (rc == CL_NOT_QUOTACHECKED)
- rc = -EINTR;
-
- qchk->obd_uuid = cli->cl_target_uuid;
- /* FIXME change strncmp to strcmp and save the strlen op */
- if (strncmp(exp->exp_obd->obd_type->typ_name, LUSTRE_OSC_NAME,
- strlen(LUSTRE_OSC_NAME)) == 0)
- memcpy(qchk->obd_type, LUSTRE_OST_NAME,
- strlen(LUSTRE_OST_NAME));
- else if (strncmp(exp->exp_obd->obd_type->typ_name, LUSTRE_MDC_NAME,
- strlen(LUSTRE_MDC_NAME)) == 0)
- memcpy(qchk->obd_type, LUSTRE_MDS_NAME,
- strlen(LUSTRE_MDS_NAME));
-
- RETURN(rc);
-}
-
-int lmv_quota_check(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct lmv_obd *lmv = &obd->u.lmv;
- struct lmv_tgt_desc *tgt;
- int i, rc = 0;
- ENTRY;
-
- for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgt++) {
- int err;
-
- if (!tgt->ltd_active) {
- CERROR("lmv idx %d inactive\n", i);
- RETURN(-EIO);
- }
-
- err = obd_quotacheck(tgt->ltd_exp, oqctl);
- if (err && !rc)
- rc = err;
- }
-
- RETURN(rc);
-}
-
-int lov_quota_check(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct lov_obd *lov = &obd->u.lov;
- int i, rc = 0;
- ENTRY;
-
- for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- int err;
-
- if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) {
- CERROR("lov idx %d inactive\n", i);
- RETURN(-EIO);
- }
-
- err = obd_quotacheck(lov->lov_tgts[i]->ltd_exp, oqctl);
- if (err && !rc)
- rc = err;
- }
-
- RETURN(rc);
-}