Commit 6ea510c1 authored by Lisa Nguyen's avatar Lisa Nguyen Committed by Greg Kroah-Hartman

staging: lustre: Remove typedef and update cfs_hash_bd struct

Remove typedef keyword and rename the cfs_hash_bd_t struct to
cfs_hash_bd in libcfs_hash.h. These changes resolve the
"Do not add new typedefs" warning generated by checkpatch.pl
and meet kernel coding style.

Struct variables in other header and source files that depend
on libcfs_hash.h are updated as well.
Signed-off-by: default avatarLisa Nguyen <lisa@xenapiadmin.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a3ea59e0
......@@ -109,10 +109,10 @@ struct cfs_hash_bucket {
/**
* cfs_hash bucket descriptor, it's normally in stack of caller
*/
typedef struct cfs_hash_bd {
struct cfs_hash_bd {
struct cfs_hash_bucket *bd_bucket; /**< address of bucket */
unsigned int bd_offset; /**< offset in bucket */
} cfs_hash_bd_t;
};
#define CFS_HASH_NAME_LEN 16 /**< default name length */
#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */
......@@ -287,15 +287,15 @@ typedef struct cfs_hash_lock_ops {
typedef struct cfs_hash_hlist_ops {
/** return hlist_head of hash-head of @bd */
struct hlist_head *(*hop_hhead)(cfs_hash_t *hs, cfs_hash_bd_t *bd);
struct hlist_head *(*hop_hhead)(cfs_hash_t *hs, struct cfs_hash_bd *bd);
/** return hash-head size */
int (*hop_hhead_size)(cfs_hash_t *hs);
/** add @hnode to hash-head of @bd */
int (*hop_hnode_add)(cfs_hash_t *hs,
cfs_hash_bd_t *bd, struct hlist_node *hnode);
struct cfs_hash_bd *bd, struct hlist_node *hnode);
/** remove @hnode from hash-head of @bd */
int (*hop_hnode_del)(cfs_hash_t *hs,
cfs_hash_bd_t *bd, struct hlist_node *hnode);
struct cfs_hash_bd *bd, struct hlist_node *hnode);
} cfs_hash_hlist_ops_t;
typedef struct cfs_hash_ops {
......@@ -539,13 +539,13 @@ static inline int cfs_hash_dec_and_lock(cfs_hash_t *hs,
}
static inline void cfs_hash_bd_lock(cfs_hash_t *hs,
cfs_hash_bd_t *bd, int excl)
struct cfs_hash_bd *bd, int excl)
{
hs->hs_lops->hs_bkt_lock(&bd->bd_bucket->hsb_lock, excl);
}
static inline void cfs_hash_bd_unlock(cfs_hash_t *hs,
cfs_hash_bd_t *bd, int excl)
struct cfs_hash_bd *bd, int excl)
{
hs->hs_lops->hs_bkt_unlock(&bd->bd_bucket->hsb_lock, excl);
}
......@@ -554,56 +554,56 @@ static inline void cfs_hash_bd_unlock(cfs_hash_t *hs,
* operations on cfs_hash bucket (bd: bucket descriptor),
* they are normally for hash-table without rehash
*/
void cfs_hash_bd_get(cfs_hash_t *hs, const void *key, cfs_hash_bd_t *bd);
void cfs_hash_bd_get(cfs_hash_t *hs, const void *key, struct cfs_hash_bd *bd);
static inline void cfs_hash_bd_get_and_lock(cfs_hash_t *hs, const void *key,
cfs_hash_bd_t *bd, int excl)
struct cfs_hash_bd *bd, int excl)
{
cfs_hash_bd_get(hs, key, bd);
cfs_hash_bd_lock(hs, bd, excl);
}
static inline unsigned cfs_hash_bd_index_get(cfs_hash_t *hs, cfs_hash_bd_t *bd)
static inline unsigned cfs_hash_bd_index_get(cfs_hash_t *hs, struct cfs_hash_bd *bd)
{
return bd->bd_offset | (bd->bd_bucket->hsb_index << hs->hs_bkt_bits);
}
static inline void cfs_hash_bd_index_set(cfs_hash_t *hs,
unsigned index, cfs_hash_bd_t *bd)
unsigned index, struct cfs_hash_bd *bd)
{
bd->bd_bucket = hs->hs_buckets[index >> hs->hs_bkt_bits];
bd->bd_offset = index & (CFS_HASH_BKT_NHLIST(hs) - 1U);
}
static inline void *
cfs_hash_bd_extra_get(cfs_hash_t *hs, cfs_hash_bd_t *bd)
cfs_hash_bd_extra_get(cfs_hash_t *hs, struct cfs_hash_bd *bd)
{
return (void *)bd->bd_bucket +
cfs_hash_bkt_size(hs) - hs->hs_extra_bytes;
}
static inline __u32
cfs_hash_bd_version_get(cfs_hash_bd_t *bd)
cfs_hash_bd_version_get(struct cfs_hash_bd *bd)
{
/* need hold cfs_hash_bd_lock */
return bd->bd_bucket->hsb_version;
}
static inline __u32
cfs_hash_bd_count_get(cfs_hash_bd_t *bd)
cfs_hash_bd_count_get(struct cfs_hash_bd *bd)
{
/* need hold cfs_hash_bd_lock */
return bd->bd_bucket->hsb_count;
}
static inline int
cfs_hash_bd_depmax_get(cfs_hash_bd_t *bd)
cfs_hash_bd_depmax_get(struct cfs_hash_bd *bd)
{
return bd->bd_bucket->hsb_depmax;
}
static inline int
cfs_hash_bd_compare(cfs_hash_bd_t *bd1, cfs_hash_bd_t *bd2)
cfs_hash_bd_compare(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2)
{
if (bd1->bd_bucket->hsb_index != bd2->bd_bucket->hsb_index)
return bd1->bd_bucket->hsb_index - bd2->bd_bucket->hsb_index;
......@@ -614,14 +614,14 @@ cfs_hash_bd_compare(cfs_hash_bd_t *bd1, cfs_hash_bd_t *bd2)
return 0;
}
void cfs_hash_bd_add_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
void cfs_hash_bd_add_locked(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode);
void cfs_hash_bd_del_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
void cfs_hash_bd_del_locked(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode);
void cfs_hash_bd_move_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd_old,
cfs_hash_bd_t *bd_new, struct hlist_node *hnode);
void cfs_hash_bd_move_locked(cfs_hash_t *hs, struct cfs_hash_bd *bd_old,
struct cfs_hash_bd *bd_new, struct hlist_node *hnode);
static inline int cfs_hash_bd_dec_and_lock(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static inline int cfs_hash_bd_dec_and_lock(cfs_hash_t *hs, struct cfs_hash_bd *bd,
atomic_t *condition)
{
LASSERT(cfs_hash_with_spin_bktlock(hs));
......@@ -630,48 +630,48 @@ static inline int cfs_hash_bd_dec_and_lock(cfs_hash_t *hs, cfs_hash_bd_t *bd,
}
static inline struct hlist_head *cfs_hash_bd_hhead(cfs_hash_t *hs,
cfs_hash_bd_t *bd)
struct cfs_hash_bd *bd)
{
return hs->hs_hops->hop_hhead(hs, bd);
}
struct hlist_node *cfs_hash_bd_lookup_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bd, const void *key);
struct cfs_hash_bd *bd, const void *key);
struct hlist_node *cfs_hash_bd_peek_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bd, const void *key);
struct cfs_hash_bd *bd, const void *key);
struct hlist_node *cfs_hash_bd_findadd_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bd, const void *key,
struct cfs_hash_bd *bd, const void *key,
struct hlist_node *hnode,
int insist_add);
struct hlist_node *cfs_hash_bd_finddel_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bd, const void *key,
struct cfs_hash_bd *bd, const void *key,
struct hlist_node *hnode);
/**
* operations on cfs_hash bucket (bd: bucket descriptor),
* they are safe for hash-table with rehash
*/
void cfs_hash_dual_bd_get(cfs_hash_t *hs, const void *key, cfs_hash_bd_t *bds);
void cfs_hash_dual_bd_lock(cfs_hash_t *hs, cfs_hash_bd_t *bds, int excl);
void cfs_hash_dual_bd_unlock(cfs_hash_t *hs, cfs_hash_bd_t *bds, int excl);
void cfs_hash_dual_bd_get(cfs_hash_t *hs, const void *key, struct cfs_hash_bd *bds);
void cfs_hash_dual_bd_lock(cfs_hash_t *hs, struct cfs_hash_bd *bds, int excl);
void cfs_hash_dual_bd_unlock(cfs_hash_t *hs, struct cfs_hash_bd *bds, int excl);
static inline void cfs_hash_dual_bd_get_and_lock(cfs_hash_t *hs, const void *key,
cfs_hash_bd_t *bds, int excl)
struct cfs_hash_bd *bds, int excl)
{
cfs_hash_dual_bd_get(hs, key, bds);
cfs_hash_dual_bd_lock(hs, bds, excl);
}
struct hlist_node *cfs_hash_dual_bd_lookup_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bds,
struct cfs_hash_bd *bds,
const void *key);
struct hlist_node *cfs_hash_dual_bd_findadd_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bds,
struct cfs_hash_bd *bds,
const void *key,
struct hlist_node *hnode,
int insist_add);
struct hlist_node *cfs_hash_dual_bd_finddel_locked(cfs_hash_t *hs,
cfs_hash_bd_t *bds,
struct cfs_hash_bd *bds,
const void *key,
struct hlist_node *hnode);
......@@ -699,7 +699,7 @@ void *cfs_hash_del_key(cfs_hash_t *hs, const void *key);
/* Hash lookup/for_each functions */
#define CFS_HASH_LOOP_HOG 1024
typedef int (*cfs_hash_for_each_cb_t)(cfs_hash_t *hs, cfs_hash_bd_t *bd,
typedef int (*cfs_hash_for_each_cb_t)(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *node, void *data);
void *cfs_hash_lookup(cfs_hash_t *hs, const void *key);
void cfs_hash_for_each(cfs_hash_t *hs, cfs_hash_for_each_cb_t, void *data);
......@@ -739,10 +739,10 @@ cfs_hash_key_validate(cfs_hash_t *hs, const void *key,
/* Validate hnode is in the correct bucket */
static inline void
cfs_hash_bucket_validate(cfs_hash_t *hs, cfs_hash_bd_t *bd,
cfs_hash_bucket_validate(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode)
{
cfs_hash_bd_t bds[2];
struct cfs_hash_bd bds[2];
cfs_hash_dual_bd_get(hs, cfs_hash_key(hs, hnode), bds);
LASSERT(bds[0].bd_bucket == bd->bd_bucket ||
......@@ -756,7 +756,7 @@ cfs_hash_key_validate(cfs_hash_t *hs, const void *key,
struct hlist_node *hnode) {}
static inline void
cfs_hash_bucket_validate(cfs_hash_t *hs, cfs_hash_bd_t *bd,
cfs_hash_bucket_validate(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode) {}
#endif /* CFS_HASH_DEBUG_LEVEL */
......@@ -830,7 +830,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask)
return ((unsigned)(key * CFS_GOLDEN_RATIO_PRIME_64) & mask);
}
/** iterate over all buckets in @bds (array of cfs_hash_bd_t) */
/** iterate over all buckets in @bds (array of struct cfs_hash_bd) */
#define cfs_hash_for_each_bd(bds, n, i) \
for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++)
......
......@@ -659,7 +659,7 @@ struct lu_site {
static inline struct lu_site_bkt_data *
lu_site_bkt_from_fid(struct lu_site *site, struct lu_fid *fid)
{
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
cfs_hash_bd_get(site->ls_obj_hash, fid, &bd);
return cfs_hash_bd_extra_get(site->ls_obj_hash, &bd);
......
......@@ -1891,7 +1891,7 @@ static int reprocess_one_queue(struct ldlm_resource *res, void *closure)
return LDLM_ITER_CONTINUE;
}
static int ldlm_reprocess_res(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_reprocess_res(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
......@@ -2040,7 +2040,7 @@ struct export_cl_data {
* Iterator function for ldlm_cancel_locks_for_export.
* Cancels passed locks.
*/
int ldlm_cancel_locks_for_export_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
int ldlm_cancel_locks_for_export_cb(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
......
......@@ -1925,7 +1925,7 @@ struct ldlm_cli_cancel_arg {
void *lc_opaque;
};
static int ldlm_cli_hash_cancel_unused(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_cli_hash_cancel_unused(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
......@@ -2023,7 +2023,7 @@ static int ldlm_iter_helper(struct ldlm_lock *lock, void *closure)
return helper->iter(lock, helper->closure);
}
static int ldlm_res_iter_helper(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_res_iter_helper(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
......
......@@ -159,7 +159,7 @@ static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v)
{
struct ldlm_namespace *ns = m->private;
__u64 res = 0;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
int i;
/* result is not strictly consistant */
......@@ -564,7 +564,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
struct ldlm_namespace *ns = NULL;
struct ldlm_ns_bucket *nsb;
ldlm_ns_hash_def_t *nsd;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
int idx;
int rc;
......@@ -743,7 +743,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
} while (1);
}
static int ldlm_resource_clean(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_resource_clean(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
......@@ -756,7 +756,7 @@ static int ldlm_resource_clean(cfs_hash_t *hs, cfs_hash_bd_t *bd,
return 0;
}
static int ldlm_resource_complain(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_resource_complain(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
......@@ -1060,7 +1060,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
{
struct hlist_node *hnode;
struct ldlm_resource *res;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
__u64 version;
int ns_refcount = 0;
......@@ -1183,7 +1183,7 @@ struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res)
return res;
}
static void __ldlm_resource_putref_final(cfs_hash_bd_t *bd,
static void __ldlm_resource_putref_final(struct cfs_hash_bd *bd,
struct ldlm_resource *res)
{
struct ldlm_ns_bucket *nsb = res->lr_ns_bucket;
......@@ -1214,7 +1214,7 @@ static void __ldlm_resource_putref_final(cfs_hash_bd_t *bd,
int ldlm_resource_putref(struct ldlm_resource *res)
{
struct ldlm_namespace *ns = ldlm_res_to_ns(res);
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
LASSERT_ATOMIC_GT_LT(&res->lr_refcount, 0, LI_POISON);
CDEBUG(D_INFO, "putref res: %p count: %d\n",
......@@ -1243,7 +1243,7 @@ int ldlm_resource_putref_locked(struct ldlm_resource *res)
res, atomic_read(&res->lr_refcount) - 1);
if (atomic_dec_and_test(&res->lr_refcount)) {
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
cfs_hash_bd_get(ldlm_res_to_ns(res)->ns_rs_hash,
&res->lr_name, &bd);
......@@ -1352,7 +1352,7 @@ void ldlm_dump_all_namespaces(ldlm_side_t client, int level)
}
EXPORT_SYMBOL(ldlm_dump_all_namespaces);
static int ldlm_res_hash_dump(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int ldlm_res_hash_dump(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *arg)
{
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
......
This diff is collapsed.
......@@ -297,7 +297,7 @@ static loff_t vvp_pgcache_id_pack(struct vvp_pgcache_id *id)
((__u64)id->vpi_bucket << PGC_OBJ_SHIFT);
}
static int vvp_pgcache_obj_get(cfs_hash_t *hs, cfs_hash_bd_t *bd,
static int vvp_pgcache_obj_get(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
struct vvp_pgcache_id *id = data;
......
......@@ -1422,7 +1422,7 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
}
EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
int lprocfs_exp_print_uuid(cfs_hash_t *hs, cfs_hash_bd_t *bd,
int lprocfs_exp_print_uuid(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
......@@ -1453,7 +1453,7 @@ struct exp_hash_cb_data {
bool first;
};
int lprocfs_exp_print_hash(cfs_hash_t *hs, cfs_hash_bd_t *bd,
int lprocfs_exp_print_hash(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *cb_data)
{
......
......@@ -71,7 +71,7 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o)
struct lu_object_header *top;
struct lu_site *site;
struct lu_object *orig;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
const struct lu_fid *fid;
top = o->lo_header;
......@@ -176,7 +176,7 @@ void lu_object_unhash(const struct lu_env *env, struct lu_object *o)
set_bit(LU_OBJECT_HEARD_BANSHEE, &top->loh_flags);
if (!test_and_set_bit(LU_OBJECT_UNHASHED, &top->loh_flags)) {
cfs_hash_t *obj_hash = o->lo_dev->ld_site->ls_obj_hash;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
cfs_hash_bd_get_and_lock(obj_hash, &top->loh_fid, &bd, 1);
list_del_init(&top->loh_lru);
......@@ -306,8 +306,8 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr)
struct lu_object_header *h;
struct lu_object_header *temp;
struct lu_site_bkt_data *bkt;
cfs_hash_bd_t bd;
cfs_hash_bd_t bd2;
struct cfs_hash_bd bd;
struct cfs_hash_bd bd2;
struct list_head dispose;
int did_sth;
int start;
......@@ -526,7 +526,7 @@ int lu_object_invariant(const struct lu_object *o)
EXPORT_SYMBOL(lu_object_invariant);
static struct lu_object *htable_lookup(struct lu_site *s,
cfs_hash_bd_t *bd,
struct cfs_hash_bd *bd,
const struct lu_fid *f,
wait_queue_t *waiter,
__u64 *version)
......@@ -590,7 +590,7 @@ static struct lu_object *lu_object_new(const struct lu_env *env,
{
struct lu_object *o;
cfs_hash_t *hs;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
struct lu_site_bkt_data *bkt;
o = lu_object_alloc(env, dev, f, conf);
......@@ -619,7 +619,7 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env,
struct lu_object *shadow;
struct lu_site *s;
cfs_hash_t *hs;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
__u64 version = 0;
/*
......@@ -788,7 +788,7 @@ struct lu_site_print_arg {
};
static int
lu_site_obj_print(cfs_hash_t *hs, cfs_hash_bd_t *bd,
lu_site_obj_print(cfs_hash_t *hs, struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
struct lu_site_print_arg *arg = (struct lu_site_print_arg *)data;
......@@ -921,7 +921,7 @@ static void lu_obj_hop_get(cfs_hash_t *hs, struct hlist_node *hnode)
h = hlist_entry(hnode, struct lu_object_header, loh_hash);
if (atomic_add_return(1, &h->loh_ref) == 1) {
struct lu_site_bkt_data *bkt;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
cfs_hash_bd_get(hs, &h->loh_fid, &bd);
bkt = cfs_hash_bd_extra_get(hs, &bd);
......@@ -975,7 +975,7 @@ EXPORT_SYMBOL(lu_dev_del_linkage);
int lu_site_init(struct lu_site *s, struct lu_device *top)
{
struct lu_site_bkt_data *bkt;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
char name[16];
int bits;
int i;
......@@ -1791,7 +1791,7 @@ typedef struct lu_site_stats{
static void lu_site_stats_get(cfs_hash_t *hs,
lu_site_stats_t *stats, int populated)
{
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
int i;
cfs_hash_for_each_bucket(hs, &bd, i) {
......@@ -2073,7 +2073,7 @@ void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
struct lu_object *shadow;
wait_queue_t waiter;
cfs_hash_t *hs;
cfs_hash_bd_t bd;
struct cfs_hash_bd bd;
__u64 version = 0;
LASSERT(fid_is_zero(old));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment