From: Vitaly Fertman Date: Mon, 18 Oct 2010 22:50:27 +0000 (+0400) Subject: b=19813 cfs_hash_cond_del doesn't have dance of addref/decref anymore X-Git-Tag: 2.0.54.0~16 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6498fa0391051802ddce9234f8b23ad883a65797;p=fs%2Flustre-release.git b=19813 cfs_hash_cond_del doesn't have dance of addref/decref anymore o=liang i=vitaly i=tappro --- diff --git a/libcfs/libcfs/hash.c b/libcfs/libcfs/hash.c index d676005..738e4f9 100644 --- a/libcfs/libcfs/hash.c +++ b/libcfs/libcfs/hash.c @@ -1546,7 +1546,9 @@ CFS_EXPORT_SYMBOL(cfs_hash_is_empty); __u64 cfs_hash_size_get(cfs_hash_t *hs) { - return cfs_hash_for_each_tight(hs, NULL, NULL, 0); + return cfs_hash_with_counter(hs) ? + cfs_atomic_read(&hs->hs_count) : + cfs_hash_for_each_tight(hs, NULL, NULL, 0); } CFS_EXPORT_SYMBOL(cfs_hash_size_get); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 2b9e631..1d411c2 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1761,10 +1761,10 @@ int lprocfs_nid_stats_clear_write_cb(void *obj, void *data) struct nid_stat *stat = obj; int i; ENTRY; - /* object has only hash + iterate_all references. - * add/delete blocked by hash bucket lock */ + CDEBUG(D_INFO,"refcnt %d\n", cfs_atomic_read(&stat->nid_exp_ref_count)); - if (cfs_atomic_read(&stat->nid_exp_ref_count) == 2) { + if (cfs_atomic_read(&stat->nid_exp_ref_count) == 1) { + /* object has only hash references. */ cfs_spin_lock(&stat->nid_obd->obd_nid_lock); cfs_list_move(&stat->nid_list, data); cfs_spin_unlock(&stat->nid_obd->obd_nid_lock);