#include "lquota_internal.h"
+cfs_mem_cache_t *lqe_kmem;
+
+struct lu_kmem_descr lquota_caches[] = {
+ {
+ .ckd_cache = &lqe_kmem,
+ .ckd_name = "lqe_kmem",
+ .ckd_size = sizeof(struct lquota_entry)
+ },
+ {
+ .ckd_cache = NULL
+ }
+};
+
/* register lquota key */
LU_KEY_INIT_FINI(lquota, struct lquota_thread_info);
LU_CONTEXT_KEY_DEFINE(lquota, LCT_MD_THREAD | LCT_DT_THREAD | LCT_LOCAL);
* Helper routine used to extract pool ID, pool type and quota type from a
* given FID.
*/
-int lquota_extract_fid(struct lu_fid *fid, int *pool_id, int *pool_type,
+int lquota_extract_fid(const struct lu_fid *fid, int *pool_id, int *pool_type,
int *quota_type)
{
unsigned int tmp;
static int __init init_lquota(void)
{
int rc;
+ ENTRY;
- /* call old quota module init function */
- rc = init_lustre_quota();
- if (rc)
- return rc;
-
- /* new quota initialization */
lquota_key_init_generic(&lquota_thread_key, NULL);
lu_context_key_register(&lquota_thread_key);
#warning "remove old quota compatibility code"
#endif
- return 0;
+ rc = lu_kmem_init(lquota_caches);
+ if (rc)
+ GOTO(out_key, rc);
+
+ rc = qmt_glb_init();
+ if (rc)
+ GOTO(out_caches, rc);
+
+ rc = qsd_glb_init();
+ if (rc)
+ GOTO(out_qmt, rc);
+
+ RETURN(0);
+
+out_qmt:
+ qmt_glb_fini();
+out_caches:
+ lu_kmem_fini(lquota_caches);
+out_key:
+ lu_context_key_degister(&lquota_thread_key);
+ return rc;
}
static void exit_lquota(void)
{
- /* call old quota module exit function */
- exit_lustre_quota();
-
+ qsd_glb_fini();
+ qmt_glb_fini();
+ lu_kmem_fini(lquota_caches);
lu_context_key_degister(&lquota_thread_key);
}