X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fcl_object.c;h=1d6572d86098005ca10a6013156d5cc0eeb84ff5;hp=9616efabb6d989448c94647dec96738b402fb035;hb=56293e79aec17670718dcaf50a733ec5119210d2;hpb=e0352157916b834003561ae99042ecc7f1f6d923 diff --git a/lustre/obdclass/cl_object.c b/lustre/obdclass/cl_object.c index 9616efa..1d6572d 100644 --- a/lustre/obdclass/cl_object.c +++ b/lustre/obdclass/cl_object.c @@ -536,7 +536,10 @@ struct cl_env { cfs_hlist_node_t ce_node; /** * Owner for the current cl_env, the key for cfs_hash. - * Now current thread pointer is stored. + * Now current thread pid is stored. Note using thread pointer would + * lead to unbalanced hash because of its specific allocation locality + * and could be varied for different platforms and OSes, even different + * OS versions. */ void *ce_owner; /* @@ -607,7 +610,7 @@ static cfs_hash_ops_t cl_env_hops = { static inline struct cl_env *cl_env_fetch(void) { struct cl_env *cle; - cle = cfs_hash_lookup(cl_env_hash, cfs_current()); + cle = cfs_hash_lookup(cl_env_hash, (void *) (long) cfs_current()->pid); LASSERT(ergo(cle, cle->ce_magic == &cl_env_init0)); return cle; } @@ -617,9 +620,9 @@ static inline void cl_env_attach(struct cl_env *cle) if (cle) { int rc; LASSERT(cle->ce_owner == NULL); - cle->ce_owner = cfs_current(); + cle->ce_owner = (void *) (long) cfs_current()->pid; rc = cfs_hash_add_unique(cl_env_hash, cle->ce_owner, - &cle->ce_node); + &cle->ce_node); LASSERT(rc == 0); } } @@ -630,9 +633,9 @@ static inline struct cl_env *cl_env_detach(struct cl_env *cle) cle = cl_env_fetch(); if (cle && cle->ce_owner) { void *cookie; - LASSERT(cle->ce_owner == cfs_current()); + LASSERT(cle->ce_owner == (void *) (long) cfs_current()->pid); cookie = cfs_hash_del(cl_env_hash, cle->ce_owner, - &cle->ce_node); + &cle->ce_node); cle->ce_owner = NULL; LASSERT(cookie == cle); }