Whamcloud - gitweb
LU-7816 quota: add default quota setting support
[fs/lustre-release.git] / lustre / quota / qmt_internal.h
index c3f7fd6..1ac3367 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  * Use is subject to license terms.
  */
 
@@ -116,18 +116,18 @@ struct qmt_pool_info {
 
        /* pointer to dt object associated with global indexes for both user
         * and group quota */
-       struct dt_object        *qpi_glb_obj[MAXQUOTAS];
+       struct dt_object        *qpi_glb_obj[LL_MAXQUOTAS];
 
        /* A pool supports two different quota types: user and group quota.
         * Each quota type has its own global index and lquota_entry hash table.
         */
-       struct lquota_site      *qpi_site[MAXQUOTAS];
+       struct lquota_site      *qpi_site[LL_MAXQUOTAS];
 
        /* number of slaves registered for each quota types */
-       int                      qpi_slv_nr[MAXQUOTAS];
+       int                      qpi_slv_nr[LL_MAXQUOTAS];
 
        /* reference on lqe (ID 0) storing grace time. */
-       struct lquota_entry     *qpi_grace_lqe[MAXQUOTAS];
+       struct lquota_entry     *qpi_grace_lqe[LL_MAXQUOTAS];
 
        /* procfs root directory for this pool */
        struct proc_dir_entry   *qpi_proc;
@@ -290,6 +290,14 @@ static inline bool qmt_space_exhausted(struct lquota_entry *lqe, __u64 now)
        return (qmt_hard_exhausted(lqe) || qmt_soft_exhausted(lqe, now));
 }
 
+/* helper routine clearing the default quota setting  */
+static inline void qmt_lqe_clear_default(struct lquota_entry *lqe)
+{
+       lqe->lqe_is_default = false;
+       lqe->lqe_gracetime &= ~((__u64)LQUOTA_FLAG_DEFAULT <<
+                                                       LQUOTA_GRACE_BITS);
+}
+
 /* number of seconds to wait for slaves to release quota space after
  * rebalancing */
 #define QMT_REBA_TIMEOUT 2
@@ -307,6 +315,8 @@ struct lquota_entry *qmt_pool_lqe_lookup(const struct lu_env *,
                                         union lquota_id *);
 /* qmt_entry.c */
 extern 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 *,
                                         struct lquota_entry *,
                                         struct dt_object *,
@@ -327,6 +337,9 @@ void qmt_revalidate(const struct lu_env *, struct lquota_entry *);
 __u64 qmt_alloc_expand(struct lquota_entry *, __u64, __u64);
 
 /* qmt_handler.c */
+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 lquota_entry *,
               struct qmt_device *, struct obd_uuid *, __u32, __u64, __u64,
               struct quota_body *);