Whamcloud - gitweb
Branch HEAD
authortappro <tappro>
Fri, 26 Jun 2009 17:48:12 +0000 (17:48 +0000)
committertappro <tappro>
Fri, 26 Jun 2009 17:48:12 +0000 (17:48 +0000)
b=19550
i=rread
i=zam

Add lock counter to export and output it in dump_exports

lustre/include/lustre_export.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/mdt/mdt_handler.c
lustre/obdclass/genops.c

index d78a26d..710f13c 100644 (file)
@@ -145,6 +145,7 @@ struct obd_export {
         atomic_t                  exp_refcount;
         atomic_t                  exp_rpc_count;
         atomic_t                  exp_cb_count;
         atomic_t                  exp_refcount;
         atomic_t                  exp_rpc_count;
         atomic_t                  exp_cb_count;
+        atomic_t                  exp_locks_count;
         struct obd_uuid           exp_client_uuid;
         struct list_head          exp_obd_chain;
         struct hlist_node         exp_uuid_hash; /* uuid-export hash*/
         struct obd_uuid           exp_client_uuid;
         struct list_head          exp_obd_chain;
         struct hlist_node         exp_uuid_hash; /* uuid-export hash*/
index 3792a4f..3e4f1ac 100644 (file)
@@ -164,6 +164,8 @@ void ldlm_lock_put(struct ldlm_lock *lock)
                 ldlm_resource_putref(res);
                 lock->l_resource = NULL;
                 if (lock->l_export) {
                 ldlm_resource_putref(res);
                 lock->l_resource = NULL;
                 if (lock->l_export) {
+                        LASSERT(atomic_read(&lock->l_export->exp_locks_count) > 0);
+                        atomic_dec(&lock->l_export->exp_locks_count);
                         class_export_put(lock->l_export);
                         lock->l_export = NULL;
                 }
                         class_export_put(lock->l_export);
                         lock->l_export = NULL;
                 }
index 82c37cf..8271bee 100644 (file)
@@ -1110,7 +1110,7 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
                 GOTO(out, rc = -ENOTCONN);
         }
         lock->l_export = class_export_get(req->rq_export);
                 GOTO(out, rc = -ENOTCONN);
         }
         lock->l_export = class_export_get(req->rq_export);
-
+        atomic_inc(&lock->l_export->exp_locks_count);
         if (lock->l_export->exp_lock_hash)
                 lustre_hash_add(lock->l_export->exp_lock_hash,
                                 &lock->l_remote_handle,
         if (lock->l_export->exp_lock_hash)
                 lustre_hash_add(lock->l_export->exp_lock_hash,
                                 &lock->l_remote_handle,
index 7178463..627261d 100644 (file)
@@ -3188,6 +3188,8 @@ int mdt_intent_lock_replace(struct mdt_thread_info *info,
         }
 
         new_lock->l_export = class_export_get(req->rq_export);
         }
 
         new_lock->l_export = class_export_get(req->rq_export);
+        atomic_inc(&lock->l_export->exp_locks_count);
+
         new_lock->l_blocking_ast = lock->l_blocking_ast;
         new_lock->l_completion_ast = lock->l_completion_ast;
         new_lock->l_remote_handle = lock->l_remote_handle;
         new_lock->l_blocking_ast = lock->l_blocking_ast;
         new_lock->l_completion_ast = lock->l_completion_ast;
         new_lock->l_remote_handle = lock->l_remote_handle;
index 4af4a61..f4099e0 100644 (file)
@@ -782,6 +782,7 @@ struct obd_export *class_new_export(struct obd_device *obd,
         atomic_set(&export->exp_refcount, 2);
         atomic_set(&export->exp_rpc_count, 0);
         atomic_set(&export->exp_cb_count, 0);
         atomic_set(&export->exp_refcount, 2);
         atomic_set(&export->exp_rpc_count, 0);
         atomic_set(&export->exp_cb_count, 0);
+        atomic_set(&export->exp_locks_count, 0);
         export->exp_obd = obd;
         CFS_INIT_LIST_HEAD(&export->exp_outstanding_replies);
         spin_lock_init(&export->exp_uncommitted_replies_lock);
         export->exp_obd = obd;
         CFS_INIT_LIST_HEAD(&export->exp_outstanding_replies);
         spin_lock_init(&export->exp_uncommitted_replies_lock);
@@ -1315,14 +1316,14 @@ static void print_export_data(struct obd_export *exp, const char *status)
         }
         spin_unlock(&exp->exp_lock);
 
         }
         spin_unlock(&exp->exp_lock);
 
-        CDEBUG(D_HA, "%s: %s %p %s %s %d %d %d: %p %s %d %d %d %d "LPU64"\n",
+        CDEBUG(D_HA, "%s: %s %p %s %s %d (%d %d %d) %d %d %d %d: %p %s "LPU64"\n",
                exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
                obd_export_nid2str(exp), atomic_read(&exp->exp_refcount),
                exp->exp_obd->obd_name, status, exp, exp->exp_client_uuid.uuid,
                obd_export_nid2str(exp), atomic_read(&exp->exp_refcount),
-               exp->exp_failed, nreplies, first_reply,
-               nreplies > 3 ? "..." : "",
                atomic_read(&exp->exp_rpc_count),
                atomic_read(&exp->exp_cb_count),
                atomic_read(&exp->exp_rpc_count),
                atomic_read(&exp->exp_cb_count),
-               exp->exp_disconnected, exp->exp_delayed,
+               atomic_read(&exp->exp_locks_count),
+               exp->exp_disconnected, exp->exp_delayed, exp->exp_failed,
+               nreplies, first_reply, nreplies > 3 ? "..." : "",
                exp->exp_last_committed);
 }
 
                exp->exp_last_committed);
 }