Whamcloud - gitweb
LU-3963 libcfs: convert ptlrpc,quota plus others to linux atomics
[fs/lustre-release.git] / lustre / quota / qsd_internal.h
index 4f8e9fc..05fa589 100644 (file)
@@ -124,7 +124,7 @@ struct qsd_instance {
  */
 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. */
@@ -215,13 +215,13 @@ static inline struct qsd_qtype_info *lqe2qqi(struct lquota_entry *lqe)
 /* 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)
@@ -317,6 +317,14 @@ static inline void qsd_set_qunit(struct lquota_entry *lqe, __u64 qunit)
        lqe->lqe_nopreacq = false;
 }
 
+/* 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();
+}
+
 #define QSD_WB_INTERVAL        60 /* 60 seconds */
 
 /* helper function calculating how long a service thread should be waiting for
@@ -362,7 +370,7 @@ int qsd_intent_lock(const struct lu_env *, struct obd_export *,
                    struct quota_body *, bool, int, qsd_req_completion_t,
                    struct qsd_qtype_info *, struct lquota_lvb *, void *);
 int qsd_fetch_index(const struct lu_env *, struct obd_export *,
-                   struct idx_info *, unsigned int, cfs_page_t **, bool *);
+                   struct idx_info *, unsigned int, struct page **, bool *);
 
 /* qsd_writeback.c */
 void qsd_bump_version(struct qsd_qtype_info *, __u64, bool);