-struct obd_trans_info;
-typedef int (*quota_acquire)(struct obd_device *obd, const unsigned int id[],
- struct obd_trans_info *oti, int isblk);
-
-typedef struct {
- int (*quota_init) (void);
- int (*quota_exit) (void);
- int (*quota_setup) (struct obd_device *);
- int (*quota_cleanup) (struct obd_device *);
- /**
- * For quota master, close admin quota files
- */
- int (*quota_fs_cleanup) (struct obd_device *);
- int (*quota_ctl) (struct obd_device *, struct obd_export *,
- struct obd_quotactl *);
- int (*quota_check) (struct obd_device *, struct obd_export *,
- struct obd_quotactl *);
- int (*quota_recovery) (struct obd_device *);
-
- /**
- * For quota master/slave, adjust quota limit after fs operation
- */
- int (*quota_adjust) (struct obd_device *, const unsigned int[],
- const unsigned int[], int, int);
-
- /**
- * For quota slave, set import, trigger quota recovery,
- * For quota master, set lqc_setup
- */
- int (*quota_setinfo) (struct obd_device *, void *);
-
- /**
- * For quota slave, clear import when relative import is invalid
- */
- int (*quota_clearinfo) (struct obd_export *, struct obd_device *);
-
- /**
- * For quota slave, set proper thread resoure capability
- */
- int (*quota_enforce) (struct obd_device *, unsigned int);
-
- /**
- * For quota slave, check whether specified uid/gid is over quota
- */
- int (*quota_getflag) (struct obd_device *, struct obdo *);
-
-#ifdef __KERNEL__
- /**
- * For quota slave, acquire/release quota from master if needed
- */
- int (*quota_acquire) (struct obd_device *, const unsigned int [],
- struct obd_trans_info *, int);
-
- /**
- * For quota slave, check whether specified uid/gid's remaining quota
- * can finish a block_write or inode_create rpc. It updates the pending
- * record of block and inode, acquires quota if necessary
- */
- int (*quota_chkquota) (struct obd_device *, struct obd_export *,
- const unsigned int [], int [],
- int, quota_acquire, struct obd_trans_info *,
- int, struct inode *, int);
-
- /**
- * For quota client, the actions after the pending write is committed
- */
- int (*quota_pending_commit) (struct obd_device *, const unsigned int [],
- int [], int);
-#endif
-
- /**
- * For quota client, poll if the quota check done
- */
- int (*quota_poll_check) (struct obd_export *, struct if_quotacheck *);
-
- /**
- * For quota client, check whether specified uid/gid is over quota
- */
- int (*quota_chkdq) (struct client_obd *, const unsigned int []);
-
- /**
- * For quota client, set over quota flag for specifed uid/gid
- */
- int (*quota_setdq) (struct client_obd *, const unsigned int [],
- obd_flag, obd_flag);
-
- /**
- * For adjusting qunit size b=10600
- */
- int (*quota_adjust_qunit) (struct obd_export *exp,
- struct quota_adjust_qunit *oqaq,
- struct lustre_quota_ctxt *qctxt,
- struct ptlrpc_request_set *rqset);
-
-} quota_interface_t;
-
-#define Q_COPY(out, in, member) (out)->member = (in)->member
-
-#define QUOTA_OP(interface, op) interface->quota_ ## op
-
-#define QUOTA_CHECK_OP(interface, op) \
-do { \
- if (!interface) \
- RETURN(0); \
- if (!QUOTA_OP(interface, op)) { \
- CERROR("no quota operation: " #op "\n"); \
- RETURN(-EOPNOTSUPP); \
- } \
-} while(0)
-
-static inline int lquota_init(quota_interface_t *interface)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, init);
- rc = QUOTA_OP(interface, init)();
- RETURN(rc);
-}
-
-static inline int lquota_exit(quota_interface_t *interface)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, exit);
- rc = QUOTA_OP(interface, exit)();
- RETURN(rc);
-}
-
-static inline int lquota_setup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setup);
- rc = QUOTA_OP(interface, setup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_cleanup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, cleanup);
- rc = QUOTA_OP(interface, cleanup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_fs_cleanup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, fs_cleanup);
- rc = QUOTA_OP(interface, fs_cleanup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_recovery(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, recovery);
- rc = QUOTA_OP(interface, recovery)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_check(quota_interface_t *interface,
- struct obd_device *obd,
- struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- int rc;
- ENTRY;
+struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *,
+ struct proc_dir_entry *, bool is_md, bool excl);
+int qsd_prepare(const struct lu_env *, struct qsd_instance *);
+int qsd_start(const struct lu_env *, struct qsd_instance *);
+void qsd_fini(const struct lu_env *, struct qsd_instance *);
+int qsd_op_begin(const struct lu_env *, struct qsd_instance *,
+ struct lquota_trans *, struct lquota_id_info *,
+ enum osd_quota_local_flags *);
+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);