From 6498fa0391051802ddce9234f8b23ad883a65797 Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Tue, 19 Oct 2010 02:50:27 +0400 Subject: [PATCH] b=19813 cfs_hash_cond_del doesn't have dance of addref/decref anymore o=liang i=vitaly i=tappro --- libcfs/libcfs/hash.c | 4 +++- lustre/obdclass/lprocfs_status.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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); -- 1.8.3.1