[Ocfs2-commits] mfasheh commits r1292 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Jul 20 19:06:34 CDT 2004
Author: mfasheh
Date: 2004-07-20 18:06:32 -0500 (Tue, 20 Jul 2004)
New Revision: 1292
Modified:
trunk/src/Makefile
trunk/src/journal.c
trunk/src/ocfs_journal.h
trunk/src/proc.c
Log:
* add statistics on number of open handles / locks. this has been very
usefull for debugging
* make commit thread optionally verbose, again this has been usefull
for debugging
Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile 2004-07-20 21:12:54 UTC (rev 1291)
+++ trunk/src/Makefile 2004-07-20 23:06:32 UTC (rev 1292)
@@ -45,6 +45,7 @@
#GLOBAL_DEFINES += -DVERBOSE_LOCKING_TRACE
GLOBAL_DEFINES += -DVERBOSE_BH_SEQNUM_TRACE
GLOBAL_DEFINES += -DVERBOSE_PROCESS_VOTE
+GLOBAL_DEFINES += -DVERBOSE_COMMIT_THREAD
ifneq ($(OCFS_PROCESSOR),ia64)
#GLOBAL_DEFINES += -DOCFS_DBG_TIMING
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-07-20 21:12:54 UTC (rev 1291)
+++ trunk/src/journal.c 2004-07-20 23:06:32 UTC (rev 1292)
@@ -102,23 +102,26 @@
journal = osb->journal;
- if (atomic_read(&journal->num_trans) == 0) {
- LOG_TRACE_STR("No transactions for me to flush!");
- goto flush_data;
- }
-
/* flush all pending commits and checkpoint the journal. */
down_write(&journal->trans_barrier);
/* check again, this time locked :) */
if (atomic_read(&journal->num_trans) == 0) {
up_write(&journal->trans_barrier);
+ LOG_TRACE_STR("No transactions for me to flush!");
goto flush_data;
}
journal_lock_updates(journal->k_journal);
status = journal_flush(journal->k_journal);
+#ifdef VERBOSE_COMMIT_THREAD
+ printk("(%u) commit_thread: flushing %u transactions, %u locks\n",
+ current->pid,
+ atomic_read(&journal->num_trans),
+ atomic_read(&journal->j_locks));
+#endif
+ atomic_set(&journal->num_trans, 0);
up_write(&journal->trans_barrier);
if (status < 0) {
journal_unlock_updates(journal->k_journal);
@@ -127,9 +130,6 @@
goto finally;
}
- LOG_TRACE_ARGS("flushing %d transactions\n",
- atomic_read(&journal->num_trans));
-
/* now we can run an unlock against any pending handles and
* release them. */
spin_lock(&journal->cmt_lock);
@@ -146,10 +146,9 @@
list_splice(&journal->committed , &commit->c_list);
INIT_LIST_HEAD(&journal->committed);
}
+ osb->needs_flush = 0;
spin_unlock(&journal->cmt_lock);
- osb->needs_flush = 0;
-
list_for_each_safe(p, n, &commit->c_list) {
handle = list_entry(p, ocfs_journal_handle, h_list);
tmpstat = ocfs_handle_release_locks(handle, TRANS_CACHE);
@@ -157,8 +156,6 @@
LOG_ERROR_STATUS((status = tmpstat));
list_del(&(handle->h_list));
kfree(handle);
-
- atomic_dec(&journal->num_trans);
}
flush_data:
@@ -419,6 +416,7 @@
int status = 0;
int tmpstat;
struct list_head *p, *n;
+ ocfs_journal *journal = handle->journal;
LOG_ENTRY();
@@ -463,6 +461,7 @@
iput(lock->inode);
list_del(&(lock->lock_list));
handle->num_locks--;
+ atomic_dec(&journal->j_locks);
kmem_cache_free(OcfsGlobalCtxt.lock_cache, lock);
}
@@ -979,6 +978,7 @@
list_add_tail(&(lock->lock_list), &(handle->locks));
handle->num_locks++;
+ atomic_inc(&handle->journal->j_locks);
LOG_EXIT();
return;
@@ -1105,6 +1105,7 @@
osb->journal->lockbh = bh;
osb->journal->lock_id = lock_id;
atomic_set(&(osb->journal->num_trans), 0);
+ atomic_set(&(osb->journal->j_locks), 0);
init_rwsem(&(osb->journal->trans_barrier));
osb->journal->state = OCFS_JOURNAL_LOADED;
Modified: trunk/src/ocfs_journal.h
===================================================================
--- trunk/src/ocfs_journal.h 2004-07-20 21:12:54 UTC (rev 1291)
+++ trunk/src/ocfs_journal.h 2004-07-20 23:06:32 UTC (rev 1292)
@@ -74,6 +74,10 @@
struct list_head committed; /* doubly linked list of all
* committed handles awaiting
* checkpointing. */
+ atomic_t j_locks; /* number of delayed
+ * locks, used only for
+ * statistics -- don't
+ * trust this! */
struct rw_semaphore trans_barrier;
};
Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c 2004-07-20 21:12:54 UTC (rev 1291)
+++ trunk/src/proc.c 2004-07-20 23:06:32 UTC (rev 1292)
@@ -41,6 +41,8 @@
#include "proc.h"
#include "vote.h"
+#include "alloc.h"
+#include "ocfs_journal.h"
/* Tracing */
@@ -507,13 +509,17 @@
"Cluster size : %d\n" \
"Volume size : %llu\n" \
"Failed Large Allocs : %u\n" \
- "Retry Large Allocs : %u\n"
+ "Retry Large Allocs : %u\n" \
+ "Open Transactions: : %u\n" \
+ "Delayed Journal Locks : %u\n"
len = sprintf (page, PROC_STATS, osb->file_open_cnt, pubmap,
osb->num_nodes, osb->s_clustersize,
(u64)osb->cluster_bitmap.validbits << osb->s_clustersize_bits,
osb->cluster_bitmap.failed,
- osb->cluster_bitmap.ok_retries);
+ osb->cluster_bitmap.ok_retries,
+ atomic_read(&osb->journal->num_trans),
+ atomic_read(&osb->journal->j_locks));
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
More information about the Ocfs2-commits
mailing list