Whamcloud - gitweb
LU-15880 quota: fix issues in reserving quota
[fs/lustre-release.git] / lustre / include / dt_object.h
index fb28777..cb386cd 100644 (file)
@@ -49,7 +49,7 @@
  * super-class definitions.
  */
 #include <lu_object.h>
-
+#include <lustre_quota.h>
 #include <libcfs/libcfs.h>
 
 struct seq_file;
@@ -316,29 +316,22 @@ struct dt_device_operations {
                                 struct dt_device *dev);
 
        /**
-        * The unit of \a count is byte for block or inodes for metadata.
-        *
-        * If \a count > 0, reserve quota in advance of an operation that
-        * changes the quota assignment, such as chgrp() or rename() into
+        * If \a qi->lqi_space > 0, reserve quota in advance of an operation
+        * that changes the quota assignment, such as chgrp() or rename() into
         * a directory with a different group ID.
         *
-        * If \a count < 0, free the reserved quota previously.
+        * If \a qi->lqi_space < 0, free the reserved quota previously.
         *
         * \param[in] env       execution environment for this thread
         * \param[in] dev       the bottom OSD device to reserve quota
-        * \param[in] type      quota type (LQUOTA_RES_DT or LQUOTA_RES_MD)
-        * \param[in] uid       quota uid
-        * \param[in] gid       quota gid
-        * \param[in] count     space (bytes or inodes) to reserve or free
-        * \param[in] md        true for inode, false for block
+        * \param[in] qi        quota id & space required to reserve
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
         */
        int   (*dt_reserve_or_free_quota)(const struct lu_env *env,
                                          struct dt_device *dev,
-                                         enum quota_type type, __u64 uid,
-                                         __u64 gid, __s64 count, bool md);
+                                         struct lquota_id_info *qi);
 };
 
 struct dt_index_features {
@@ -1985,12 +1978,6 @@ static inline struct dt_object *dt_object_child(struct dt_object *o)
                            struct dt_object, do_lu);
 }
 
-struct dt_quota_reserve_rec {
-       enum quota_type  qrr_type;
-       union lquota_id  qrr_id;
-       __u64            qrr_count;
-};
-
 /**
  * This is the general purpose transaction handle.
  * 1. Transaction Life Cycle
@@ -2018,7 +2005,7 @@ struct thandle {
        struct thandle  *th_top;
 
        /* reserved quota for this handle */
-       struct dt_quota_reserve_rec th_reserved_quota;
+       struct lquota_id_info   th_reserved_quota;
 
        /** the last operation result in this transaction.
         * this value is used in recovery */
@@ -2937,14 +2924,12 @@ static inline int dt_commit_async(const struct lu_env *env,
 
 static inline int dt_reserve_or_free_quota(const struct lu_env *env,
                                           struct dt_device *dev,
-                                          enum quota_type type, __u64 uid,
-                                          __u64 gid, int count, bool is_md)
+                                          struct lquota_id_info *qi)
 {
        LASSERT(dev);
        LASSERT(dev->dd_ops);
        LASSERT(dev->dd_ops->dt_reserve_or_free_quota);
-       return dev->dd_ops->dt_reserve_or_free_quota(env, dev, type, uid, gid,
-                                                    count, is_md);
+       return dev->dd_ops->dt_reserve_or_free_quota(env, dev, qi);
 }
 
 static inline int dt_lookup(const struct lu_env *env,