X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Flquota_entry.c;h=3194bfcf88690b1d4ac73b3532457c04e33f17e8;hb=70e9d4ecc9130aeed1260d78cd8b33a5cde6edd7;hp=2e335d9902a37e2cf3ed9b1949bb06fa187daf85;hpb=f6995cf04407dff15d6ca79ca44cfa97dc6eb014;p=fs%2Flustre-release.git diff --git a/lustre/quota/lquota_entry.c b/lustre/quota/lquota_entry.c index 2e335d9..3194bfc 100644 --- a/lustre/quota/lquota_entry.c +++ b/lustre/quota/lquota_entry.c @@ -20,7 +20,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -35,10 +35,11 @@ #include "lquota_internal.h" static int hash_lqs_cur_bits = HASH_LQE_CUR_BITS; -CFS_MODULE_PARM(hash_lqs_cur_bits, "i", int, 0444, - "the current bits of lqe hash"); +module_param(hash_lqs_cur_bits, int, 0444); +MODULE_PARM_DESC(hash_lqs_cur_bits, "the current bits of lqe hash"); -static unsigned lqe64_hash_hash(cfs_hash_t *hs, const void *key, unsigned mask) +static unsigned +lqe64_hash_hash(struct cfs_hash *hs, const void *key, unsigned mask) { return cfs_hash_u64_hash(*((__u64 *)key), mask); } @@ -62,28 +63,28 @@ static void *lqe_hash_object(struct hlist_node *hnode) return hlist_entry(hnode, struct lquota_entry, lqe_hash); } -static void lqe_hash_get(cfs_hash_t *hs, struct hlist_node *hnode) +static void lqe_hash_get(struct cfs_hash *hs, struct hlist_node *hnode) { struct lquota_entry *lqe; lqe = hlist_entry(hnode, struct lquota_entry, lqe_hash); lqe_getref(lqe); } -static void lqe_hash_put_locked(cfs_hash_t *hs, struct hlist_node *hnode) +static void lqe_hash_put_locked(struct cfs_hash *hs, struct hlist_node *hnode) { struct lquota_entry *lqe; lqe = hlist_entry(hnode, struct lquota_entry, lqe_hash); lqe_putref(lqe); } -static void lqe_hash_exit(cfs_hash_t *hs, struct hlist_node *hnode) +static void lqe_hash_exit(struct cfs_hash *hs, struct hlist_node *hnode) { CERROR("Should not have any item left!\n"); } /* lqe hash methods for 64-bit uid/gid, new hash functions would have to be * defined for per-directory quota relying on a 128-bit FID */ -static cfs_hash_ops_t lqe64_hash_ops = { +static struct cfs_hash_ops lqe64_hash_ops = { .hs_hash = lqe64_hash_hash, .hs_key = lqe64_hash_key, .hs_keycmp = lqe64_hash_keycmp, @@ -114,7 +115,7 @@ struct lqe_iter_data { bool lid_free_all; }; -static int lqe_iter_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd, +static int lqe_iter_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *data) { struct lqe_iter_data *d = (struct lqe_iter_data *)data; @@ -151,7 +152,7 @@ static int lqe_iter_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd, * \param free_all - free all entries or only free the entries * without quota enforce ? */ -static void lqe_cleanup(cfs_hash_t *hash, bool free_all) +static void lqe_cleanup(struct cfs_hash *hash, bool free_all) { struct lqe_iter_data d; int repeat = 0; @@ -202,7 +203,8 @@ struct lquota_site *lquota_site_alloc(const struct lu_env *env, void *parent, char hashname[15]; ENTRY; - LASSERT(qtype < MAXQUOTAS); + if (qtype >= LL_MAXQUOTAS) + RETURN(ERR_PTR(-ENOTSUPP)); OBD_ALLOC_PTR(site); if (site == NULL) @@ -216,7 +218,7 @@ struct lquota_site *lquota_site_alloc(const struct lu_env *env, void *parent, /* allocate hash table */ memset(hashname, 0, sizeof(hashname)); - sprintf(hashname, "LQUOTA_HASH%u", qtype); + snprintf(hashname, sizeof(hashname), "LQUOTA_HASH%hu", qtype); site->lqs_hash= cfs_hash_create(hashname, hash_lqs_cur_bits, HASH_LQE_MAX_BITS, min(hash_lqs_cur_bits, @@ -324,7 +326,7 @@ struct lquota_entry *lqe_locate(const struct lu_env *env, OBD_SLAB_ALLOC_PTR_GFP(new, lqe_kmem, GFP_NOFS); if (new == NULL) { - CERROR("Fail to allocate lqe for id:"LPU64", " + CERROR("Fail to allocate lqe for id:%llu, " "hash:%s\n", qid->qid_uid, site->lqs_hash->hs_name); RETURN(ERR_PTR(-ENOMEM)); }