#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
#endif
+#ifndef LL_MAXQUOTAS
+#define LL_MAXQUOTAS 2
+#endif
+
struct lquota_id_info;
struct lquota_trans;
#include <lustre_handles.h>
#include <lustre_intent.h>
#include <lvfs.h>
+#include <lustre_quota.h>
#define MAX_OBD_DEVICES 8192
void *cl_writeback_work;
void *cl_lru_work;
/* hash tables for osc_quota_info */
- struct cfs_hash *cl_quota_hash[MAXQUOTAS];
+ struct cfs_hash *cl_quota_hash[LL_MAXQUOTAS];
};
#define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid)
if (!(cmd & OBD_BRW_NOQUOTA)) {
struct cl_object *obj;
struct cl_attr *attr;
- unsigned int qid[MAXQUOTAS];
+ unsigned int qid[LL_MAXQUOTAS];
obj = cl_object_top(&osc->oo_cl);
attr = &osc_env_info(env)->oti_attr;
int type;
ENTRY;
- for (type = 0; type < MAXQUOTAS; type++) {
+ for (type = 0; type < LL_MAXQUOTAS; type++) {
struct osc_quota_info *oqi;
oqi = cfs_hash_lookup(cli->cl_quota_hash[type], &qid[type]);
if ((valid & (OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA)) == 0)
RETURN(0);
- for (type = 0; type < MAXQUOTAS; type++) {
+ for (type = 0; type < LL_MAXQUOTAS; type++) {
struct osc_quota_info *oqi;
if ((valid & MD_QUOTA_FLAG(type)) == 0)
int i, type;
ENTRY;
- for (type = 0; type < MAXQUOTAS; type++) {
+ for (type = 0; type < LL_MAXQUOTAS; type++) {
cli->cl_quota_hash[type] = cfs_hash_create("QUOTA_HASH",
HASH_QUOTA_CUR_BITS,
HASH_QUOTA_MAX_BITS,
break;
}
- if (type == MAXQUOTAS)
+ if (type == LL_MAXQUOTAS)
RETURN(0);
for (i = 0; i < type; i++)
int type;
ENTRY;
- for (type = 0; type < MAXQUOTAS; type++)
+ for (type = 0; type < LL_MAXQUOTAS; type++)
cfs_hash_putref(cli->cl_quota_hash[type]);
RETURN(0);
/* set/clear over quota flag for a uid/gid */
if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE &&
body->oa.o_valid & (OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA)) {
- unsigned int qid[MAXQUOTAS] = { body->oa.o_uid, body->oa.o_gid };
+ unsigned int qid[LL_MAXQUOTAS] =
+ {body->oa.o_uid, body->oa.o_gid};
CDEBUG(D_QUOTA, "setdq for [%u %u] with valid "LPX64", flags %x\n",
body->oa.o_uid, body->oa.o_gid, body->oa.o_valid,
if (unlikely(qsd == NULL))
return 0;
- LASSERT(qtype >= 0 && qtype < MAXQUOTAS);
+ LASSERT(qtype >= 0 && qtype < LL_MAXQUOTAS);
qi->lqi_type = qtype;
/* inode accounting */
char hashname[15];
ENTRY;
- LASSERT(qtype < MAXQUOTAS);
+ if (qtype >= LL_MAXQUOTAS)
+ RETURN(ERR_PTR(-ENOTSUPP));
OBD_ALLOC_PTR(site);
if (site == NULL)
LASSERT(qmt != NULL);
- if (oqctl->qc_type >= MAXQUOTAS)
+ if (oqctl->qc_type >= LL_MAXQUOTAS)
/* invalid quota type */
RETURN(-EINVAL);
atomic_read(&pool->qpi_ref),
pool->qpi_least_qunit);
- for (type = 0; type < MAXQUOTAS; type++)
+ for (type = 0; type < LL_MAXQUOTAS; type++)
seq_printf(m, " %s:\n"
" #slv: %d\n"
" #lqe: %d\n",
/* release per-quota type site used to manage quota entries as well as
* references to global index files */
- for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
/* release lqe storing grace time */
if (pool->qpi_grace_lqe[qtype] != NULL)
lqe_putref(pool->qpi_grace_lqe[qtype]);
RETURN(PTR_ERR(obj));
pool->qpi_root = obj;
- for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
/* Generating FID of global index in charge of storing
* settings for this quota type */
lquota_generate_fid(&qti->qti_fid, pool_id, pool_type,
continue;
}
- for (type = USRQUOTA; type < MAXQUOTAS; type++) {
+ for (type = USRQUOTA; type < LL_MAXQUOTAS; type++) {
qqi = qsd->qsd_type_array[type];
qsd_start_reint_thread(qqi);
}
*
* This will have to be revisited if new quota types are added in the
* future. For the time being, we can just use an array. */
- struct qsd_qtype_info *qsd_type_array[MAXQUOTAS];
+ struct qsd_qtype_info *qsd_type_array[LL_MAXQUOTAS];
/* per-filesystem quota information */
struct qsd_fsinfo *qsd_fsinfo;
int enabled, pool;
LASSERT(qsd != NULL);
- LASSERT(type < MAXQUOTAS);
+ LASSERT(type < LL_MAXQUOTAS);
if (qsd->qsd_fsinfo == NULL)
return 0;
rc = -EAGAIN;
} else {
/* mark all indexes as stale */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
qsd->qsd_type_array[qtype]->qqi_glb_uptodate = false;
qsd->qsd_type_array[qtype]->qqi_slv_uptodate = false;
}
return rc;
/* kick off reintegration */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
rc = qsd_start_reint_thread(qsd->qsd_type_array[qtype]);
if (rc)
break;
* reintegration procedure (i.e. global lock enqueue and slave
* index transfer) since the space usage reconciliation (i.e.
* step 3) will have to wait for qsd_start() to be called */
- for (type = USRQUOTA; type < MAXQUOTAS; type++) {
+ for (type = USRQUOTA; type < LL_MAXQUOTAS; type++) {
struct qsd_qtype_info *qqi = qsd->qsd_type_array[type];
wake_up(&qqi->qqi_reint_thread.t_ctl_waitq);
}
qsd_stop_upd_thread(qsd);
/* shutdown the reintegration threads */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
if (qsd->qsd_type_array[qtype] == NULL)
continue;
qsd_stop_reint_thread(qsd->qsd_type_array[qtype]);
}
/* free per-quota type data */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++)
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++)
qsd_qtype_fini(env, qsd, qtype);
/* deregister connection to the quota master */
}
/* initialize per-quota type data */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
rc = qsd_qtype_init(env, qsd, qtype);
if (rc)
RETURN(rc);
write_unlock(&qsd->qsd_lock);
/* start reintegration thread for each type, if required */
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
struct qsd_qtype_info *qqi = qsd->qsd_type_array[qtype];
if (qsd_type_enabled(qsd, qtype) && qsd->qsd_acct_failed) {
/* Trigger the 3rd step of reintegration: If usage > granted, acquire
* up to usage; If usage < granted, release down to usage. */
- for (type = USRQUOTA; type < MAXQUOTAS; type++) {
+ for (type = USRQUOTA; type < LL_MAXQUOTAS; type++) {
struct qsd_qtype_info *qqi = qsd->qsd_type_array[type];
wake_up(&qqi->qqi_reint_thread.t_ctl_waitq);
}
return job_pending;
}
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
struct qsd_qtype_info *qqi = qsd->qsd_type_array[qtype];
if (!qsd_type_enabled(qsd, qtype))
if (uptodate)
continue;
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++)
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++)
qsd_start_reint_thread(qsd->qsd_type_array[qtype]);
}
lu_env_fini(env);
{
int qtype;
- for (qtype = USRQUOTA; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = USRQUOTA; qtype < LL_MAXQUOTAS; qtype++) {
struct qsd_upd_rec *upd, *tmp;
struct qsd_qtype_info *qqi = qsd->qsd_type_array[qtype];