X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Flquota_lib.c;h=52caaf01b319965ae84a839e6cac6a9d71c37af6;hb=66ca2bc59135b00cd20a4e5095a23cf54cdfa2eb;hp=5278818aa811c1bec6a487f5c4700acb95983166;hpb=1673c7bdf58234db8963cd292b0a8e02d016ac9e;p=fs%2Flustre-release.git diff --git a/lustre/quota/lquota_lib.c b/lustre/quota/lquota_lib.c index 5278818..52caaf0 100644 --- a/lustre/quota/lquota_lib.c +++ b/lustre/quota/lquota_lib.c @@ -21,17 +21,13 @@ * GPL HEADER END */ /* - * Copyright (c) 2011, 2012, Intel, Inc. + * Copyright (c) 2012, 2014, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi * Author: Niu Yawei */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - #define DEBUG_SUBSYSTEM S_LQUOTA #include @@ -40,6 +36,19 @@ #include "lquota_internal.h" +struct kmem_cache *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); @@ -181,7 +190,7 @@ int lquotactl_slv(const struct lu_env *env, struct dt_device *dev, /* lookup record storing space accounting information for this ID */ rc = dt_lookup(env, obj, (struct dt_rec *)&qti->qti_acct_rec, - (struct dt_key *)&key, BYPASS_CAPA); + (struct dt_key *)&key); if (rc < 0) GOTO(out, rc); @@ -203,7 +212,7 @@ int lquotactl_slv(const struct lu_env *env, struct dt_device *dev, memset(&qti->qti_slv_rec, 0, sizeof(qti->qti_slv_rec)); /* lookup record storing enforcement information for this ID */ rc = dt_lookup(env, obj, (struct dt_rec *)&qti->qti_slv_rec, - (struct dt_key *)&key, BYPASS_CAPA); + (struct dt_key *)&key); if (rc < 0 && rc != -ENOENT) GOTO(out, rc = 0); @@ -244,7 +253,7 @@ void lquota_generate_fid(struct lu_fid *fid, int pool_id, int pool_type, * 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; @@ -283,29 +292,46 @@ int lquota_extract_fid(struct lu_fid *fid, int *pool_id, int *pool_type, 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); - 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); } -MODULE_AUTHOR("Intel, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Quota"); +MODULE_VERSION(LUSTRE_VERSION_STRING); MODULE_LICENSE("GPL"); -cfs_module(lquota, "2.4.0", init_lquota, exit_lquota); +module_init(init_lquota); +module_exit(exit_lquota);