Whamcloud - gitweb
LU-12542 handle: discard OBD_FREE_RCU
[fs/lustre-release.git] / lustre / obdclass / lustre_handles.c
index 4da1823..40d6918 100644 (file)
@@ -60,7 +60,7 @@ static struct handle_bucket {
  * global (per-node) hash-table.
  */
 void class_handle_hash(struct portals_handle *h,
-                      struct portals_handle_ops *ops)
+                      const struct portals_handle_ops *ops)
 {
        struct handle_bucket *bucket;
 
@@ -135,7 +135,7 @@ void class_handle_unhash(struct portals_handle *h)
 }
 EXPORT_SYMBOL(class_handle_unhash);
 
-void *class_handle2object(__u64 cookie, const void *owner)
+void *class_handle2object(u64 cookie, const struct portals_handle_ops *ops)
 {
        struct handle_bucket *bucket;
        struct portals_handle *h;
@@ -153,12 +153,15 @@ void *class_handle2object(__u64 cookie, const void *owner)
 
        rcu_read_lock();
        list_for_each_entry_rcu(h, &bucket->head, h_link) {
-               if (h->h_cookie != cookie || h->h_owner != owner)
+               if (h->h_cookie != cookie || h->h_ops != ops)
                        continue;
 
                spin_lock(&h->h_lock);
                if (likely(h->h_in != 0)) {
-                       h->h_ops->hop_addref(h);
+                       refcount_inc(&h->h_ref);
+                       CDEBUG(D_INFO, "GET %s %p refcount=%d\n",
+                              h->h_ops->hop_type, h,
+                              refcount_read(&h->h_ref));
                        retval = h;
                }
                spin_unlock(&h->h_lock);
@@ -170,21 +173,6 @@ void *class_handle2object(__u64 cookie, const void *owner)
 }
 EXPORT_SYMBOL(class_handle2object);
 
-void class_handle_free_cb(struct rcu_head *rcu)
-{
-       struct portals_handle *h;
-       void *ptr;
-
-       h = container_of(rcu, struct portals_handle, h_rcu);
-       ptr = (void *)(unsigned long)h->h_cookie;
-
-       if (h->h_ops->hop_free != NULL)
-               h->h_ops->hop_free(ptr, h->h_size);
-       else
-               OBD_FREE(ptr, h->h_size);
-}
-EXPORT_SYMBOL(class_handle_free_cb);
-
 int class_handle_init(void)
 {
        struct handle_bucket *bucket;