#define DEBUG_SUBSYSTEM S_LQUOTA
#include <obd_class.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre/lustre_param.h>
#include "qsd_internal.h"
RETURN(qfs);
}
-/*
- * Quota configuration handlers in charge of processing all per-filesystem quota
- * parameters set via conf_param.
- *
- * \param lcfg - quota configuration log to be processed
- */
-int qsd_process_config(struct lustre_cfg *lcfg)
+int qsd_config(char *valstr, char *fsname, int pool)
{
- struct qsd_fsinfo *qfs;
- char *fsname = lustre_cfg_string(lcfg, 0);
- char *cfgstr = lustre_cfg_string(lcfg, 1);
- char *keystr, *valstr;
- int rc, pool, enabled = 0;
- bool reint = false;
- ENTRY;
-
- CDEBUG(D_QUOTA, "processing quota parameter: fs:%s cfgstr:%s\n", fsname,
- cfgstr);
-
- if (class_match_param(cfgstr, PARAM_QUOTA, &keystr) != 0)
- RETURN(-EINVAL);
-
- if (!class_match_param(keystr, QUOTA_METAPOOL_NAME, &valstr))
- pool = LQUOTA_RES_MD;
- else if (!class_match_param(keystr, QUOTA_DATAPOOL_NAME, &valstr))
- pool = LQUOTA_RES_DT;
- else
- RETURN(-EINVAL);
+ struct qsd_fsinfo *qfs;
+ int rc, enabled = 0, old_enabled = 0;
+ bool reint = false;
+ ENTRY;
qfs = qsd_get_fsinfo(fsname, 0);
if (qfs == NULL) {
CERROR("failed to find quota filesystem information for %s\n",
enabled |= 1 << USRQUOTA;
if (strchr(valstr, 'g'))
enabled |= 1 << GRPQUOTA;
+ if (strchr(valstr, 'p'))
+ enabled |= 1 << PRJQUOTA;
mutex_lock(&qfs->qfs_mutex);
if (qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] == enabled)
if ((qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] & enabled) != enabled)
reint = true;
+ old_enabled = qfs->qfs_enabled[pool - LQUOTA_FIRST_RES];
qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] = enabled;
/* trigger reintegration for all qsd */
read_unlock(&qsd->qsd_lock);
if (skip)
continue;
- if (qsd->qsd_acct_failed) {
- LCONSOLE_ERROR("%s: can't enable quota "
- "enforcement since space "
- "accounting isn't functional. "
- "Please run tunefs.lustre "
- "--quota on an unmounted "
- "filesystem if not done already"
- "\n", qsd->qsd_svname);
- continue;
- }
- for (type = USRQUOTA; type < MAXQUOTAS; type++) {
+ for (type = USRQUOTA; type < LL_MAXQUOTAS; type++) {
qqi = qsd->qsd_type_array[type];
+ /* only trigger reintegration if this
+ * type of quota is not enabled before */
+ if ((old_enabled & 1 << type) ||
+ !(enabled & 1 << type))
+ continue;
+
+ if (qqi->qqi_acct_failed) {
+ LCONSOLE_ERROR("%s: can't enable quota "
+ "enforcement since space "
+ "accounting isn't functional. "
+ "Please run tunefs.lustre "
+ "--quota on an unmounted "
+ "filesystem if not done already"
+ "\n", qsd->qsd_svname);
+ continue;
+ }
qsd_start_reint_thread(qqi);
}
}
qsd_put_fsinfo(qfs);
RETURN(0);
}
+
+/*
+ * Quota configuration handlers in charge of processing all per-filesystem quota
+ * parameters set via conf_param.
+ *
+ * \param lcfg - quota configuration log to be processed
+ */
+int qsd_process_config(struct lustre_cfg *lcfg)
+{
+ char *fsname = lustre_cfg_string(lcfg, 0);
+ char *cfgstr = lustre_cfg_string(lcfg, 1);
+ char *keystr, *valstr;
+ int pool;
+
+ ENTRY;
+ CDEBUG(D_QUOTA, "processing quota parameter: fs:%s cfgstr:%s\n", fsname,
+ cfgstr);
+
+ if (class_match_param(cfgstr, PARAM_QUOTA, &keystr) != 0)
+ RETURN(-EINVAL);
+
+ if (!class_match_param(keystr, QUOTA_METAPOOL_NAME, &valstr))
+ pool = LQUOTA_RES_MD;
+ else if (!class_match_param(keystr, QUOTA_DATAPOOL_NAME, &valstr))
+ pool = LQUOTA_RES_DT;
+ else
+ RETURN(-EINVAL);
+
+ return qsd_config(valstr, fsname, pool);
+}