Whamcloud - gitweb
LU-14927 quota: move qsd_transfer to lquota module
[fs/lustre-release.git] / lustre / include / lustre_quota.h
index 59406ee..9844dbf 100644 (file)
@@ -196,6 +196,13 @@ void qsd_op_end(const struct lu_env *, struct qsd_instance *,
                struct lquota_trans *);
 void qsd_op_adjust(const struct lu_env *, struct qsd_instance *,
                   union lquota_id *, int);
+int qsd_transfer(const struct lu_env *env, struct qsd_instance *qsd,
+                struct lquota_trans *trans, unsigned int qtype,
+                u64 orig_id, u64 new_id, u64 bspace,
+                struct lquota_id_info *qi);
+int qsd_reserve_or_free_quota(const struct lu_env *env,
+                             struct qsd_instance *qsd,
+                             struct lquota_id_info *qi);
 
 /*
  * Quota information attached to a transaction
@@ -244,5 +251,29 @@ struct lquota_trans {
  * on slave */
 int lquotactl_slv(const struct lu_env *, struct dt_device *,
                  struct obd_quotactl *);
+
+static inline int quota_reserve_or_free(const struct lu_env *env,
+                                       struct qsd_instance *qsd,
+                                       struct lquota_id_info *qi,
+                                       enum quota_type type, __u64 uid,
+                                       __u64 gid, __s64 count, bool is_md)
+{
+       qi->lqi_type = type;
+       if (count > 0)
+               qi->lqi_space = toqb(count);
+       else
+               qi->lqi_space = -toqb(-count);
+
+       if (is_md)
+               qi->lqi_is_blk = false;
+       else
+               qi->lqi_is_blk = true;
+
+       qi->lqi_id.qid_uid = uid;
+       qi->lqi_id.qid_gid = gid;
+
+       return qsd_reserve_or_free_quota(env, qsd, qi);
+}
+
 /** @} quota */
 #endif /* _LUSTRE_QUOTA_H */