* GPL HEADER END
*/
/*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
* Use is subject to license terms.
*/
/* procfs directory where information related to the underlying slaves
* are exported */
- cfs_proc_dir_entry_t *qsd_proc;
+ struct proc_dir_entry *qsd_proc;
/* export used for the connection to quota master */
struct obd_export *qsd_exp;
*
* 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;
/* link into qfs_qsd_list of qfs_fsinfo */
- cfs_list_t qsd_link;
+ struct list_head qsd_link;
/* list of lqe entry which might need quota space adjustment */
- cfs_list_t qsd_adjust_list;
+ struct list_head qsd_adjust_list;
/* lock protecting adjust list */
spinlock_t qsd_adjust_lock;
struct ptlrpc_thread qsd_upd_thread;
/* list of update tasks */
- cfs_list_t qsd_upd_list;
+ struct list_head qsd_upd_list;
/* r/w spinlock protecting:
* - the state flags
* enforced here (via procfs) */
int qsd_timeout;
- unsigned long qsd_is_md:1, /* managing quota for mdt */
- qsd_started:1, /* instance is now started */
- qsd_prepared:1, /* qsd_prepare() successfully
+ unsigned long qsd_is_md:1, /* managing quota for mdt */
+ qsd_started:1, /* instance is now started */
+ qsd_prepared:1, /* qsd_prepare() successfully
* called */
- qsd_exp_valid:1,/* qsd_exp is now valid */
- qsd_stopping:1, /* qsd_instance is stopping */
- qsd_acct_failed:1; /* failed to set up acct
- * for one quota type */
+ qsd_exp_valid:1,/* qsd_exp is now valid */
+ qsd_stopping:1; /* qsd_instance is stopping */
+
};
/*
*/
struct qsd_qtype_info {
/* reference count incremented by each user of this structure */
- cfs_atomic_t qqi_ref;
+ atomic_t qqi_ref;
/* quota type, either USRQUOTA or GRPQUOTA
* immutable after creation. */
struct lprocfs_stats *qqi_stats;
/* deferred update for the global index copy */
- cfs_list_t qqi_deferred_glb;
+ struct list_head qqi_deferred_glb;
/* deferred update for the slave index copy */
- cfs_list_t qqi_deferred_slv;
+ struct list_head qqi_deferred_slv;
/* Various flags representing the current state of the slave for this
* quota type. */
- unsigned long qqi_glb_uptodate:1, /* global index uptodate
+ unsigned long qqi_glb_uptodate:1, /* global index uptodate
with master */
- qqi_slv_uptodate:1, /* slave index uptodate
+ qqi_slv_uptodate:1, /* slave index uptodate
with master */
- qqi_reint:1; /* in reintegration or not */
+ qqi_reint:1, /* in reintegration or not */
+ qqi_acct_failed:1; /* failed to setup acct */
/* A list of references to this instance, for debugging */
- struct lu_ref qqi_reference;
+ struct lu_ref qqi_reference;
+
+ /* default quota setting*/
+ __u64 qqi_default_hardlimit;
+ __u64 qqi_default_softlimit;
+ __u64 qqi_default_gracetime;
};
/*
unsigned int qfs_enabled[LQUOTA_NR_RES];
/* list of all qsd_instance for this fs */
- cfs_list_t qfs_qsd_list;
- struct semaphore qfs_sem;
+ struct list_head qfs_qsd_list;
+ struct mutex qfs_mutex;
/* link to the global quota fsinfo list. */
- cfs_list_t qfs_link;
+ struct list_head qfs_link;
/* reference count */
int qfs_ref;
/* qqi_getref/putref is used to track users of a qqi structure */
static inline void qqi_getref(struct qsd_qtype_info *qqi)
{
- cfs_atomic_inc(&qqi->qqi_ref);
+ atomic_inc(&qqi->qqi_ref);
}
static inline void qqi_putref(struct qsd_qtype_info *qqi)
{
- LASSERT(cfs_atomic_read(&qqi->qqi_ref) > 0);
- cfs_atomic_dec(&qqi->qqi_ref);
+ LASSERT(atomic_read(&qqi->qqi_ref) > 0);
+ atomic_dec(&qqi->qqi_ref);
}
#define QSD_RES_TYPE(qsd) ((qsd)->qsd_is_md ? LQUOTA_RES_MD : LQUOTA_RES_DT)
/* udpate record for slave & global index copy */
struct qsd_upd_rec {
- cfs_list_t qur_link; /* link into qsd_upd_list */
+ struct list_head qur_link; /* link into qsd_upd_list */
union lquota_id qur_qid;
union lquota_rec qur_rec;
struct qsd_qtype_info *qur_qqi;
int enabled, pool;
LASSERT(qsd != NULL);
- LASSERT(type < MAXQUOTAS);
+ LASSERT(type < LL_MAXQUOTAS);
if (qsd->qsd_fsinfo == NULL)
return 0;
{
lqe->lqe_edquot = edquot;
if (edquot)
- lqe->lqe_edquot_time = cfs_time_current_64();
+ lqe->lqe_edquot_time = ktime_get_seconds();
}
#define QSD_WB_INTERVAL 60 /* 60 seconds */
/* qsd_lock.c */
extern struct ldlm_enqueue_info qsd_glb_einfo;
extern struct ldlm_enqueue_info qsd_id_einfo;
+void qsd_update_default_quota(struct qsd_qtype_info *qqi, __u64 hardlimit,
+ __u64 softlimit, __u64 gracetime);
int qsd_id_lock_match(struct lustre_handle *, struct lustre_handle *);
int qsd_id_lock_cancel(const struct lu_env *, struct lquota_entry *);
/* qsd_config.c */
struct qsd_fsinfo *qsd_get_fsinfo(char *, bool);
void qsd_put_fsinfo(struct qsd_fsinfo *);
+int qsd_config(char *valstr, char *fsname, int pool);
int qsd_process_config(struct lustre_cfg *);
/* qsd_handler.c */