*
* 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. */
*
* 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. */
/* per-filesystem quota information */
struct qsd_fsinfo *qsd_fsinfo;
/* link into qfs_qsd_list of qfs_fsinfo */
/* per-filesystem quota information */
struct qsd_fsinfo *qsd_fsinfo;
/* link into qfs_qsd_list of qfs_fsinfo */
/* dedicated thread for updating slave index files. */
struct ptlrpc_thread qsd_upd_thread;
/* list of update tasks */
/* dedicated thread for updating slave index files. */
struct ptlrpc_thread qsd_upd_thread;
/* list of update tasks */
/* Default quota settings which apply to all identifiers */
/* when blk qunit reaches this value, later write reqs from client
* should be sync. b=16642 */
unsigned long qsd_sync_threshold;
/* Default quota settings which apply to all identifiers */
/* when blk qunit reaches this value, later write reqs from client
* should be sync. b=16642 */
unsigned long qsd_sync_threshold;
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 */
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_stopping:1, /* qsd_instance is stopping */
+ qsd_acct_failed:1; /* failed to set up acct
+ * for one quota type */
/* quota type, either USRQUOTA or GRPQUOTA
* immutable after creation. */
/* quota type, either USRQUOTA or GRPQUOTA
* immutable after creation. */
/* qqi_getref/putref is used to track users of a qqi structure */
static inline void qqi_getref(struct qsd_qtype_info *qqi)
{
/* qqi_getref/putref is used to track users of a qqi structure */
static inline void qqi_getref(struct qsd_qtype_info *qqi)
{
-/* all kind of operations supported by qsd_dqacq() */
-enum qsd_ops {
- QSD_ADJ, /* adjust quota space based on current qunit */
- QSD_ACQ, /* acquire space for requests */
- QSD_REL, /* release all space quota space uncondionnally */
- QSD_REP, /* report space usage during reintegration */
-};
-
#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 {
#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 {
+/* helper function to set/clear edquot flag */
+static inline void qsd_set_edquot(struct lquota_entry *lqe, bool edquot)
+{
+ lqe->lqe_edquot = edquot;
+ if (edquot)
+ lqe->lqe_edquot_time = cfs_time_current_64();
+}
+
+/* helper function calculating how long a service thread should be waiting for
+ * quota space */
+static inline int qsd_wait_timeout(struct qsd_instance *qsd)
+{
+ if (qsd->qsd_timeout != 0)
+ return qsd->qsd_timeout;
+ return min_t(int, at_max / 2, obd_timeout / 2);
+}
+
/* qsd_entry.c */
extern struct lquota_entry_operations qsd_lqe_ops;
int qsd_refresh_usage(const struct lu_env *, struct lquota_entry *);
/* qsd_entry.c */
extern struct lquota_entry_operations qsd_lqe_ops;
int qsd_refresh_usage(const struct lu_env *, struct lquota_entry *);
int qsd_send_dqacq(const struct lu_env *, struct obd_export *,
struct quota_body *, bool, qsd_req_completion_t,
struct qsd_qtype_info *, struct lustre_handle *,
struct lquota_entry *);
int qsd_intent_lock(const struct lu_env *, struct obd_export *,
struct quota_body *, bool, int, qsd_req_completion_t,
int qsd_send_dqacq(const struct lu_env *, struct obd_export *,
struct quota_body *, bool, qsd_req_completion_t,
struct qsd_qtype_info *, struct lustre_handle *,
struct lquota_entry *);
int qsd_intent_lock(const struct lu_env *, struct obd_export *,
struct quota_body *, bool, int, qsd_req_completion_t,
- struct idx_info *, unsigned int, cfs_page_t **, bool *);
+ struct idx_info *, unsigned int, struct page **, bool *);
-int qsd_dqacq(const struct lu_env *, struct lquota_entry *, enum qsd_ops);
-__u64 qsd_calc_grants(struct lquota_entry *, __u64, __u32);
+int qsd_adjust(const struct lu_env *, struct lquota_entry *);