Whamcloud - gitweb
LU-16339 quota: notify OSTs until lge_qunit_nu is set
[fs/lustre-release.git] / lustre / quota / qmt_internal.h
index ba72a1e..1474a8a 100644 (file)
@@ -58,17 +58,6 @@ struct qmt_device {
        /* pointer to ldlm namespace to be used for quota locks */
        struct ldlm_namespace   *qmt_ns;
 
-       /* Hash table containing a qmt_pool_info structure for each pool
-        * this quota master is in charge of. We only have 2 pools in this
-        * hash for the time being:
-        * - one for quota management on the default metadata pool
-        * - one for quota managment on the default data pool
-        *
-        * Once we support quota on non-default pools, then more pools will
-        * be added to this hash table and pool master setup would have to be
-        * handled via configuration logs */
-       struct cfs_hash         *qmt_pool_hash;
-
        /* List of pools managed by this master target */
        struct list_head         qmt_pool_list;
        /* rw semaphore to protect pool list */
@@ -108,9 +97,14 @@ enum {
        QMT_STYPE_CNT
 };
 
+#define qmt_dom(rtype, stype) \
+       ((rtype == LQUOTA_RES_DT && \
+        stype == QMT_STYPE_MDT) ? true : false)
+
 enum {
        /* set while recalc_thread is working */
        QPI_FLAG_RECALC_OFFSET,
+       QPI_FLAG_STATE_INITED,
 };
 
 /*
@@ -129,7 +123,7 @@ struct qmt_pool_info {
 
        union qmt_sarray         qpi_sarr;
        /* recalculation thread pointer */
-       struct ptlrpc_thread     qpi_recalc_thread;
+       struct task_struct      *qpi_recalc_task;
        /* rw semaphore to avoid acquire/release during
         * pool recalculation. */
        struct rw_semaphore      qpi_recalc_sem;
@@ -284,6 +278,7 @@ struct qmt_thread_info *qmt_info(const struct lu_env *env)
 }
 
 #define qti_lqes_num(env)      (qmt_info(env)->qti_lqes_num)
+#define qti_lqes_inited(env)   (qmt_info(env)->qti_lqes_num)
 #define qti_lqes_cnt(env)      (qmt_info(env)->qti_lqes_cnt)
 #define qti_glbl_lqe_idx(env)  (qmt_info(env)->qti_glbl_lqe_idx)
 #define qti_lqes(env)          (qti_lqes_num(env) > QMT_MAX_POOL_NUM ? \
@@ -462,7 +457,7 @@ int qmt_sarr_get_idx(struct qmt_pool_info *qpi, int arr_idx);
 unsigned int qmt_sarr_count(struct qmt_pool_info *qpi);
 
 /* qmt_entry.c */
-extern struct lquota_entry_operations qmt_lqe_ops;
+extern const struct lquota_entry_operations qmt_lqe_ops;
 int qmt_lqe_set_default(const struct lu_env *env, struct qmt_pool_info *pool,
                        struct lquota_entry *lqe, bool create_record);
 struct thandle *qmt_trans_start_with_slv(const struct lu_env *,
@@ -483,13 +478,13 @@ bool qmt_adjust_qunit(const struct lu_env *, struct lquota_entry *);
 bool qmt_adjust_edquot(struct lquota_entry *, __u64);
 
 #define qmt_adjust_edquot_notify(env, qmt, now, qb_flags) \
-         qmt_adjust_edquot_qunit_notify(env, qmt, now, true, false, qb_flags)
-#define qmt_adjust_qunit_notify(env, qmt, qb_flags) \
-         qmt_adjust_edquot_qunit_notify(env, qmt, 0, false, true, qb_flags)
-#define qmt_adjust_and_notify(env, qmt, now, qb_flags) \
-         qmt_adjust_edquot_qunit_notify(env, qmt, now, true, true, qb_flags)
+         qmt_adjust_edquot_qunit_notify(env, qmt, now, true, \
+                                        false, qb_flags, -1)
+#define qmt_adjust_notify_nu(env, qmt, now, qb_flags, idx) \
+         qmt_adjust_edquot_qunit_notify(env, qmt, now, true, \
+                                        true, qb_flags, idx)
 bool qmt_adjust_edquot_qunit_notify(const struct lu_env *, struct qmt_device *,
-                                   __u64, bool, bool, __u32);
+                                   __u64, bool, bool, __u32, int idx);
 bool qmt_revalidate(const struct lu_env *, struct lquota_entry *);
 void qmt_revalidate_lqes(const struct lu_env *, struct qmt_device *, __u32);
 __u64 qmt_alloc_expand(struct lquota_entry *, __u64, __u64);
@@ -498,7 +493,7 @@ void qti_lqes_init(const struct lu_env *env);
 int qti_lqes_add(const struct lu_env *env, struct lquota_entry *lqe);
 void qti_lqes_del(const struct lu_env *env, int index);
 void qti_lqes_fini(const struct lu_env *env);
-int qti_lqes_min_qunit(const struct lu_env *env);
+__u64 qti_lqes_min_qunit(const struct lu_env *env);
 int qti_lqes_edquot(const struct lu_env *env);
 int qti_lqes_restore_init(const struct lu_env *env);
 void qti_lqes_restore_fini(const struct lu_env *env);
@@ -523,7 +518,7 @@ int qmt_set_with_lqe(const struct lu_env *env, struct qmt_device *qmt,
                     struct lquota_entry *lqe, __u64 hard, __u64 soft,
                     __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 *);
+              __u32, __u64, __u64, struct quota_body *, int);
 int qmt_uuid2idx(struct obd_uuid *, int *);
 
 /* qmt_lock.c */