Whamcloud - gitweb
LU-1303 fld: verify support for range lookups
[fs/lustre-release.git] / lustre / include / lquota.h
index 9f2e3e5..e6bf161 100644 (file)
@@ -41,6 +41,14 @@ union lquota_rec {
        struct lquota_acct_rec  lqr_acct_rec;
 };
 
+/* Index features supported by the global index objects
+ * Only used for migration purpose and should be removed once on-disk migration
+ * is no longer needed */
+extern struct dt_index_features dt_quota_iusr_features;
+extern struct dt_index_features dt_quota_busr_features;
+extern struct dt_index_features dt_quota_igrp_features;
+extern struct dt_index_features dt_quota_bgrp_features;
+
 /* Name used in the configuration logs to identify the default metadata pool
  * (composed of all the MDTs, with pool ID 0) and the default data pool (all
  * the OSTs, with pool ID 0 too). */
@@ -48,6 +56,50 @@ union lquota_rec {
 #define QUOTA_DATAPOOL_NAME   "ost="
 
 /*
+ * Quota information attached to a transaction
+ */
+
+struct lquota_entry;
+
+struct lquota_id_info {
+       /* quota identifier */
+       union lquota_id          lqi_id;
+
+       /* USRQUOTA or GRPQUOTA for now, could be expanded for
+        * directory quota or other types later.  */
+       int                      lqi_type;
+
+       /* inodes or kbytes to be consumed or released, it could
+        * be negative when releasing space.  */
+       long long                lqi_space;
+
+       /* quota slave entry structure associated with this ID */
+       struct lquota_entry     *lqi_qentry;
+
+       /* whether we are reporting blocks or inodes */
+       bool                     lqi_is_blk;
+};
+
+/* Since we enforce only inode quota in meta pool (MDTs), and block quota in
+ * data pool (OSTs), there are at most 4 quota ids being enforced in a single
+ * transaction, which is chown transaction:
+ * original uid and gid, new uid and gid.
+ *
+ * This value might need to be revised when directory quota is added.  */
+#define QUOTA_MAX_TRANSIDS    4
+
+/* all qids involved in a single transaction */
+struct lquota_trans {
+        unsigned short         lqt_id_cnt;
+        struct lquota_id_info  lqt_ids[QUOTA_MAX_TRANSIDS];
+};
+
+/* flags for quota local enforcement */
+#define QUOTA_FL_OVER_USRQUOTA  0x01
+#define QUOTA_FL_OVER_GRPQUOTA  0x02
+#define QUOTA_FL_SYNC           0x04
+
+/*
  * Quota enforcement support on slaves
  */
 
@@ -79,11 +131,20 @@ void qsd_fini(const struct lu_env *, struct qsd_instance *);
 int lquotactl_slv(const struct lu_env *, struct dt_device *,
                  struct obd_quotactl *);
 
-#ifdef LPROCFS
-/* dumb procfs handler which always report success, for backward compatibility
- * purpose */
-int lprocfs_quota_rd_type_dumb(char *, char **, off_t, int, int *, void *);
-int lprocfs_quota_wr_type_dumb(struct file *, const char *, unsigned long,
-                              void *);
-#endif /* LPROCFS */
+/* XXX: dummy qsd_op_begin() & qsd_op_end(), will be replaced with the real
+ *      one once all the enforcement code landed. */
+static inline int qsd_op_begin(const struct lu_env *env,
+                              struct qsd_instance *qsd,
+                              struct lquota_trans *trans,
+                              struct lquota_id_info *qi,
+                              int *flags)
+{
+       return 0;
+}
+
+static inline void qsd_op_end(const struct lu_env *env,
+                             struct qsd_instance *qsd,
+                             struct lquota_trans *trans)
+{
+}
 #endif /* _LUSTRE_LQUOTA_H */