X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Flquota_lib.c;h=7c0fb54729bb80fabbee8947e5d84ad35cdd9ddb;hb=11db1a551172f596d1d284e8496530f9ce24ac81;hp=d7e2703c428f104d8ad4b8ddf9460875044289cc;hpb=9ddf386035767a96b54e21559f3ea0be126dc8cd;p=fs%2Flustre-release.git diff --git a/lustre/quota/lquota_lib.c b/lustre/quota/lquota_lib.c index d7e2703..7c0fb54 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, 2013, 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,9 +36,18 @@ #include "lquota_internal.h" -static int hash_lqs_cur_bits = HASH_LQS_CUR_BITS; -CFS_MODULE_PARM(hash_lqs_cur_bits, "i", int, 0444, - "the current bits of lqs hash"); +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); @@ -248,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; @@ -329,7 +334,9 @@ const struct dt_index_features *glb_idx_feature(struct lu_fid *fid) static int __init init_lquota(void) { - /* new quota initialization */ + int rc; + ENTRY; + lquota_key_init_generic(&lquota_thread_key, NULL); lu_context_key_register(&lquota_thread_key); @@ -340,15 +347,38 @@ static int __init init_lquota(void) #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) { + qsd_glb_fini(); + qmt_glb_fini(); + lu_kmem_fini(lquota_caches); lu_context_key_degister(&lquota_thread_key); } -MODULE_AUTHOR("Intel, Inc. "); +MODULE_AUTHOR("Intel Corporation "); MODULE_DESCRIPTION("Lustre Quota"); MODULE_LICENSE("GPL");