Whamcloud - gitweb
b=17682 limit performance impact of rpctrace, dlmtrace & quota
[fs/lustre-release.git] / lustre / ldlm / ldlm_lockd.c
index a3fc916..7ff6bd8 100644 (file)
@@ -211,13 +211,14 @@ static int expired_lock_main(void *arg)
                         export = class_export_lock_get(lock->l_export, lock);
                         spin_unlock_bh(&waiting_locks_spinlock);
 
-                        /* release extra ref grabbed by ldlm_add_waiting_lock()
-                         * or ldlm_failed_ast() */
-                        LDLM_LOCK_RELEASE(lock);
-
                         do_dump++;
                         class_fail_export(export);
                         class_export_lock_put(export, lock);
+
+                        /* release extra ref grabbed by ldlm_add_waiting_lock()
+                         * or ldlm_failed_ast() */
+                        LDLM_LOCK_RELEASE(lock);
                         spin_lock_bh(&waiting_locks_spinlock);
                 }
                 spin_unlock_bh(&waiting_locks_spinlock);
@@ -484,7 +485,7 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock)
 
         if (lock->l_export == NULL) {
                 /* We don't have a "waiting locks list" on clients. */
-                LDLM_DEBUG(lock, "client lock: no-op");
+                CDEBUG(D_DLMTRACE, "Client lock %p : no-op\n", lock);
                 return 0;
         }
 
@@ -1079,8 +1080,8 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
 
         if (unlikely(flags & LDLM_FL_REPLAY)) {
                 /* Find an existing lock in the per-export lock hash */
-                lock = lustre_hash_lookup(req->rq_export->exp_lock_hash,
-                                          (void *)&dlm_req->lock_handle[0]);
+                lock = cfs_hash_lookup(req->rq_export->exp_lock_hash,
+                                       (void *)&dlm_req->lock_handle[0]);
                 if (lock != NULL) {
                         DEBUG_REQ(D_DLMTRACE, req, "found existing lock cookie "
                                   LPX64, lock->l_handle.h_cookie);
@@ -1111,9 +1112,9 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
 
         lock->l_export = class_export_lock_get(req->rq_export, lock);
         if (lock->l_export->exp_lock_hash)
-                lustre_hash_add(lock->l_export->exp_lock_hash,
-                                &lock->l_remote_handle,
-                                &lock->l_exp_hash);
+                cfs_hash_add(lock->l_export->exp_lock_hash,
+                             &lock->l_remote_handle,
+                             &lock->l_exp_hash);
 
 existing_lock:
 
@@ -1442,7 +1443,7 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
         int do_ast;
         ENTRY;
 
-        LDLM_DEBUG(lock, "client blocking AST callback handler START");
+        LDLM_DEBUG(lock, "client blocking AST callback handler");
 
         lock_res_and_lock(lock);
         lock->l_flags |= LDLM_FL_CBPENDING;
@@ -1454,14 +1455,14 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
         unlock_res_and_lock(lock);
 
         if (do_ast) {
-                LDLM_DEBUG(lock, "already unused, calling "
-                           "callback (%p)", lock->l_blocking_ast);
+                CDEBUG(D_DLMTRACE, "Lock %p already unused, calling callback (%p)\n",
+                       lock, lock->l_blocking_ast);
                 if (lock->l_blocking_ast != NULL)
                         lock->l_blocking_ast(lock, ld, lock->l_ast_data,
                                              LDLM_CB_BLOCKING);
         } else {
-                LDLM_DEBUG(lock, "Lock still has references, will be"
-                           " cancelled later");
+                CDEBUG(D_DLMTRACE, "Lock %p is referenced, will be cancelled later\n",
+                       lock);
         }
 
         LDLM_DEBUG(lock, "client blocking callback handler END");
@@ -2009,8 +2010,8 @@ void ldlm_revoke_lock_cb(void *obj, void *data)
         lock->l_flags |= LDLM_FL_AST_SENT;
         if (lock->l_export && lock->l_export->exp_lock_hash &&
             !hlist_unhashed(&lock->l_exp_hash))
-                lustre_hash_del(lock->l_export->exp_lock_hash,
-                                &lock->l_remote_handle, &lock->l_exp_hash);
+                cfs_hash_del(lock->l_export->exp_lock_hash,
+                             &lock->l_remote_handle, &lock->l_exp_hash);
         list_add_tail(&lock->l_rk_ast, rpc_list);
         LDLM_LOCK_GET(lock);
 
@@ -2023,8 +2024,8 @@ void ldlm_revoke_export_locks(struct obd_export *exp)
         ENTRY;
 
         CFS_INIT_LIST_HEAD(&rpc_list);
-        lustre_hash_for_each_empty(exp->exp_lock_hash,
-                                   ldlm_revoke_lock_cb, &rpc_list);
+        cfs_hash_for_each_empty(exp->exp_lock_hash,
+                                ldlm_revoke_lock_cb, &rpc_list);
         ldlm_run_ast_work(&rpc_list, LDLM_WORK_REVOKE_AST);
 
         EXIT;
@@ -2197,9 +2198,9 @@ void ldlm_put_ref(void)
  * Export handle<->lock hash operations.
  */
 static unsigned
-ldlm_export_lock_hash(lustre_hash_t *lh, void *key, unsigned mask)
+ldlm_export_lock_hash(cfs_hash_t *hs, void *key, unsigned mask)
 {
-        return lh_u64_hash(((struct lustre_handle *)key)->cookie, mask);
+        return cfs_hash_u64_hash(((struct lustre_handle *)key)->cookie, mask);
 }
 
 static void *
@@ -2243,12 +2244,12 @@ ldlm_export_lock_put(struct hlist_node *hnode)
         RETURN(lock);
 }
 
-static lustre_hash_ops_t ldlm_export_lock_ops = {
-        .lh_hash    = ldlm_export_lock_hash,
-        .lh_key     = ldlm_export_lock_key,
-        .lh_compare = ldlm_export_lock_compare,
-        .lh_get     = ldlm_export_lock_get,
-        .lh_put     = ldlm_export_lock_put
+static cfs_hash_ops_t ldlm_export_lock_ops = {
+        .hs_hash    = ldlm_export_lock_hash,
+        .hs_key     = ldlm_export_lock_key,
+        .hs_compare = ldlm_export_lock_compare,
+        .hs_get     = ldlm_export_lock_get,
+        .hs_put     = ldlm_export_lock_put
 };
 
 int ldlm_init_export(struct obd_export *exp)
@@ -2256,8 +2257,9 @@ int ldlm_init_export(struct obd_export *exp)
         ENTRY;
 
         exp->exp_lock_hash =
-                lustre_hash_init(obd_uuid2str(&exp->exp_client_uuid),
-                                 7, 16, &ldlm_export_lock_ops, LH_REHASH);
+                cfs_hash_create(obd_uuid2str(&exp->exp_client_uuid),
+                                HASH_EXP_LOCK_CUR_BITS, HASH_EXP_LOCK_MAX_BITS,
+                                &ldlm_export_lock_ops, CFS_HASH_REHASH);
 
         if (!exp->exp_lock_hash)
                 RETURN(-ENOMEM);
@@ -2269,7 +2271,7 @@ EXPORT_SYMBOL(ldlm_init_export);
 void ldlm_destroy_export(struct obd_export *exp)
 {
         ENTRY;
-        lustre_hash_exit(exp->exp_lock_hash);
+        cfs_hash_destroy(exp->exp_lock_hash);
         exp->exp_lock_hash = NULL;
         EXIT;
 }