#define QUOTA_DQACQ_FL_REPORT 0x8 /* report usage */
/* Quota types currently supported */
-enum {
+enum lquota_type {
LQUOTA_TYPE_USR = 0x00, /* maps to USRQUOTA */
LQUOTA_TYPE_GRP = 0x01, /* maps to GRPQUOTA */
LQUOTA_TYPE_PRJ = 0x02, /* maps to PRJQUOTA */
* - inodes on the MDTs
* - blocks on the OSTs
*/
-enum {
+enum lquota_res_type {
LQUOTA_RES_MD = 0x01, /* skip 0 to avoid null oid in FID */
LQUOTA_RES_DT = 0x02,
LQUOTA_LAST_RES,
if (fid_is_acct(fid)) {
seq_printf(p, "%s:\n", oid2name(fid_oid(fid)));
} else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB) {
- int rtype, qtype;
+ enum lquota_res_type rtype;
+ enum lquota_type qtype;
rc = lquota_extract_fid(fid, &rtype, &qtype);
if (rc)
qti->qti_fid.f_seq = FID_SEQ_QUOTA;
qti->qti_fid.f_ver = 0;
if (local) {
- int pool_type, qtype;
+ enum lquota_res_type pool_type;
+ enum lquota_type qtype;
rc = lquota_extract_fid(glb_fid, &pool_type, &qtype);
if (rc)
struct dt_object *acct_obj_lookup(const struct lu_env *, struct dt_device *,
int);
void lquota_generate_fid(struct lu_fid *, int, int);
-int lquota_extract_fid(const struct lu_fid *, int *, int *);
+int lquota_extract_fid(const struct lu_fid *, enum lquota_res_type *,
+ enum lquota_type *);
const struct dt_index_features *glb_idx_feature(struct lu_fid *);
int lquota_obj_iter(const struct lu_env *env, struct dt_device *dev,
struct dt_object *obj, struct obd_quotactl *oqctl,
* Helper routine used to extract pool type and quota type from a
* given FID.
*/
-int lquota_extract_fid(const struct lu_fid *fid, int *pool_type,
- int *quota_type)
+int lquota_extract_fid(const struct lu_fid *fid,
+ enum lquota_res_type *pool_type,
+ enum lquota_type *quota_type)
{
unsigned int lqtype;
ENTRY;
* \retval slave type(QMT_STYPE_MDT or QMT_STYPE_OST)
* \retval -EINVAL wrong uuid
*/
-int qmt_uuid2idx(struct obd_uuid *uuid, int *idx)
+enum qmt_stype qmt_uuid2idx(struct obd_uuid *uuid, int *idx)
{
char *uuid_str, *name, *dash;
int rc = -EINVAL;
struct quota_body *qbody, *repbody;
struct obd_uuid *uuid;
struct ldlm_lock *lock;
- int rtype, qtype;
- int rc, idx, stype;
+ enum lquota_res_type rtype;
+ enum lquota_type qtype;
+ enum qmt_stype stype;
+ int rc, idx;
struct obd_device *obd = NULL;
ENTRY;
/* Since DOM support, data resources can exist
* on both MDT and OST targets. */
-enum {
+enum qmt_stype {
QMT_STYPE_MDT,
QMT_STYPE_OST,
QMT_STYPE_CNT
__u64 time, __u32 valid, bool is_default, bool is_updated);
int qmt_dqacq0(const struct lu_env *, struct qmt_device *, struct obd_uuid *,
__u32, __u64, __u64, struct quota_body *, int);
-int qmt_uuid2idx(struct obd_uuid *, int *);
+enum qmt_stype qmt_uuid2idx(struct obd_uuid *, int *);
/* qmt_lock.c */
int qmt_intent_policy(const struct lu_env *, struct lu_device *,
switch (it->opc) {
case IT_QUOTA_DQACQ: {
- struct lquota_entry *lqe;
- struct ldlm_lock *lock;
- int idx, stype;
+ struct lquota_entry *lqe;
+ struct ldlm_lock *lock;
+ enum qmt_stype stype;
+ int idx;
if (res->lr_name.name[LUSTRE_RES_ID_QUOTA_SEQ_OFF] == 0)
/* acquire on global lock? something is wrong ... */
*/
int qmt_lvbo_init(struct lu_device *ld, struct ldlm_resource *res)
{
- struct lu_env *env;
- struct qmt_thread_info *qti;
- struct qmt_device *qmt = lu2qmt_dev(ld);
- int pool_type, qtype;
- int rc;
+ struct lu_env *env;
+ struct qmt_thread_info *qti;
+ struct qmt_device *qmt = lu2qmt_dev(ld);
+ enum lquota_res_type pool_type;
+ enum lquota_type qtype;
+ int rc;
ENTRY;
LASSERT(res != NULL);
int qmt_lvbo_update(struct lu_device *ld, struct ldlm_resource *res,
struct ptlrpc_request *req, int increase_only)
{
- struct lu_env *env;
- struct qmt_thread_info *qti;
- struct qmt_device *qmt = lu2qmt_dev(ld);
- struct lquota_entry *lqe;
- struct lquota_lvb *lvb;
- struct ldlm_lock *lock;
- struct obd_export *exp;
- bool need_revoke;
- int rc = 0, idx, stype;
+ struct lu_env *env;
+ struct qmt_thread_info *qti;
+ struct qmt_device *qmt = lu2qmt_dev(ld);
+ struct lquota_entry *lqe;
+ struct lquota_lvb *lvb;
+ struct ldlm_lock *lock;
+ struct obd_export *exp;
+ bool need_revoke;
+ enum qmt_stype stype;
+ int rc = 0, idx;
ENTRY;
LASSERT(res != NULL);
struct lquota_entry *lqe = res->lr_lvb_data;
struct qmt_device *qmt;
struct obd_uuid *uuid;
+ enum qmt_stype stype;
int idx;
uuid = &(lock)->l_export->exp_client_uuid;
- rc = qmt_uuid2idx(uuid, &idx);
- if (rc < 0)
- RETURN(rc);
+ stype = qmt_uuid2idx(uuid, &idx);
+ if (stype < 0)
+ RETURN(stype);
qmt = lu2qmt_dev(ld);
/* return current qunit value & edquot flags in lvb */
lqe_getref(lqe);
- rc = qmt_pool_lqes_lookup(env, qmt, lqe_rtype(lqe), rc,
+ rc = qmt_pool_lqes_lookup(env, qmt, lqe_rtype(lqe), stype,
lqe_qtype(lqe), &lqe->lqe_id,
NULL, idx);
if (!rc) {
struct lquota_entry *lqe)
{
struct obd_uuid *uuid = &(lock)->l_export->exp_client_uuid;
- int idx, stype;
+ enum qmt_stype stype;
+ int idx;
__u64 qunit;
bool edquot;
{
struct obd_uuid *uuid = &(lock)->l_export->exp_client_uuid;
struct lqe_glbl_data *lgd = lqe->lqe_glbl_data;
+ enum qmt_stype stype;
int idx;
- int stype = qmt_uuid2idx(uuid, &idx);
+ stype = qmt_uuid2idx(uuid, &idx);
LASSERT(stype == QMT_STYPE_OST || stype == QMT_STYPE_MDT);
CDEBUG(D_QUOTA, "stype %d rtype %d idx %d uuid %s\n",
#define qmt_sarr_pool_add_locked(qpi, idx, stype) \
_qmt_sarr_pool_add(qpi, idx, stype, true)
static inline int _qmt_sarr_pool_add(struct qmt_pool_info *qpi,
- int idx, int min, bool locked);
+ int idx, enum qmt_stype min, bool locked);
static inline int qmt_sarr_pool_rem(struct qmt_pool_info *qpi, int idx);
static inline void qmt_sarr_pool_free(struct qmt_pool_info *qpi);
static inline int qmt_sarr_check_idx(struct qmt_pool_info *qpi, int idx);
{
struct obd_uuid uuid;
struct qmt_pool_info *qpi = arg;
- int stype, qtype, idx;
- int rc;
+ enum lquota_type qtype;
+ enum qmt_stype stype;
+ int idx, rc;
rc = lquota_extract_fid(glb_fid, NULL, &qtype);
LASSERT(!rc);
struct lu_fid *glb_fid, struct lu_fid *slv_fid,
__u64 *slv_ver, struct obd_uuid *uuid)
{
- struct qmt_pool_info *pool;
- struct dt_object *slv_obj;
- int pool_type, qtype, stype;
- bool created = false;
- int idx, i, rc = 0;
+ struct qmt_pool_info *pool;
+ struct dt_object *slv_obj;
+ enum lquota_res_type pool_type;
+ enum lquota_type qtype;
+ enum qmt_stype stype;
+ bool created = false;
+ int idx, i, rc = 0;
stype = qmt_uuid2idx(uuid, &idx);
if (stype < 0)
CDEBUG(D_QUOTA, "add tgt idx:%d pool_type:%d qtype:%d stype:%d\n",
idx, pool_type, qtype, stype);
- if (!qmt_dom(qtype, stype)) {
+ if (!qmt_dom(pool_type, stype)) {
qmt_sarr_write_down(pool);
rc = qmt_sarr_pool_add_locked(pool, idx, stype);
if (!rc) {
}
static inline int
-_qmt_sarr_pool_add(struct qmt_pool_info *qpi, int idx, int stype, bool locked)
+_qmt_sarr_pool_add(struct qmt_pool_info *qpi, int idx, enum qmt_stype stype,
+ bool locked)
{
/* We don't have an array for DOM */
if (qmt_dom(qpi->qpi_rtype, stype))
}
run_test 33c "Mount ost with a large index number"
+test_33d() {
+ setup
+ stack_trap cleanup
+
+ mkdir_on_mdt0 $DIR/$tdir || error "cannot create $DIR/$tdir"
+ touch $DIR/$tfile
+ $LFS setquota -p 1 -I1K $MOUNT
+
+ do_facet mgs $LCTL set_param osd*.*.quota_slave.enabled=p
+ $LFS project -p 1 $DIR/
+}
+run_test 33d "Don't panic when enable project quota"
+
test_34a() {
setup
do_facet client "bash runmultiop_bg_pause $DIR/file O_c"