[Ocfs2-commits] mfasheh commits r2048 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Mar 24 17:46:08 CST 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-03-24 17:46:07 -0600 (Thu, 24 Mar 2005)
New Revision: 2048
Modified:
trunk/fs/ocfs2/file.c
trunk/fs/ocfs2/journal.c
trunk/fs/ocfs2/ocfs_journal.h
trunk/fs/ocfs2/proc.c
trunk/fs/ocfs2/super.c
Log:
* quick ocfs_journal structure cleanup
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/file.c
===================================================================
--- trunk/fs/ocfs2/file.c 2005-03-24 23:38:26 UTC (rev 2047)
+++ trunk/fs/ocfs2/file.c 2005-03-24 23:46:07 UTC (rev 2048)
@@ -163,7 +163,7 @@
if (err)
goto bail;
- journal = osb->journal->k_journal;
+ journal = osb->journal->j_journal;
err = journal_force_commit(journal);
bail:
Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c 2005-03-24 23:38:26 UTC (rev 2047)
+++ trunk/fs/ocfs2/journal.c 2005-03-24 23:46:07 UTC (rev 2048)
@@ -84,32 +84,32 @@
journal = osb->journal;
/* Flush all pending commits and checkpoint the journal. */
- down_write(&journal->trans_barrier);
+ down_write(&journal->j_trans_barrier);
- if (atomic_read(&journal->num_trans) == 0) {
- up_write(&journal->trans_barrier);
+ if (atomic_read(&journal->j_num_trans) == 0) {
+ up_write(&journal->j_trans_barrier);
LOG_TRACE_STR("No transactions for me to flush!");
goto finally;
}
- journal_lock_updates(journal->k_journal);
- status = journal_flush(journal->k_journal);
- journal_unlock_updates(journal->k_journal);
+ journal_lock_updates(journal->j_journal);
+ status = journal_flush(journal->j_journal);
+ journal_unlock_updates(journal->j_journal);
if (status < 0) {
- up_write(&journal->trans_barrier);
+ up_write(&journal->j_trans_barrier);
LOG_ERROR_STATUS(status);
goto finally;
}
old_id = ocfs_inc_trans_id(journal);
- flushed = atomic_read(&journal->num_trans);
- atomic_set(&journal->num_trans, 0);
- up_write(&journal->trans_barrier);
+ flushed = atomic_read(&journal->j_num_trans);
+ atomic_set(&journal->j_num_trans, 0);
+ up_write(&journal->j_trans_barrier);
#ifdef VERBOSE_COMMIT_THREAD
printk("(%u) commit_thread: flushed transaction %lu (%u handles)\n",
- current->pid, journal->trans_id, flushed);
+ current->pid, journal->j_trans_id, flushed);
#endif
ocfs2_kick_vote_thread(osb);
@@ -235,14 +235,14 @@
ocfs_journal_handle *handle,
int max_buffs)
{
- journal_t * journal = osb->journal->k_journal;
+ journal_t * journal = osb->journal->j_journal;
LOG_ENTRY_ARGS ("(max_buffs = %d)\n", max_buffs);
- if (!osb || !osb->journal->k_journal)
+ if (!osb || !osb->journal->j_journal)
BUG();
- OCFS_ASSERT(osb->journal->state != OCFS_JOURNAL_FREE);
+ OCFS_ASSERT(osb->journal->j_state != OCFS_JOURNAL_FREE);
OCFS_ASSERT(max_buffs > 0);
/* JBD might support this, but our journalling code doesn't yet. */
@@ -260,12 +260,12 @@
handle->max_buffs = max_buffs;
- down_read(&osb->journal->trans_barrier);
+ down_read(&osb->journal->j_trans_barrier);
/* actually start the transaction now */
handle->k_handle = journal_start(journal, max_buffs);
if (IS_ERR(handle->k_handle)) {
- up_read(&osb->journal->trans_barrier);
+ up_read(&osb->journal->j_trans_barrier);
LOG_ERROR_STR("journal_start() failed!");
LOG_ERROR_STATUS((int)PTR_ERR(handle->k_handle));
@@ -273,7 +273,7 @@
goto done_free;
}
- atomic_inc(&(osb->journal->num_trans));
+ atomic_inc(&(osb->journal->j_num_trans));
handle->flags |= OCFS_HANDLE_STARTED;
LOG_EXIT_PTR(handle);
@@ -407,7 +407,7 @@
ocfs_handle_cleanup_locks(osb->journal, handle, 1);
- up_read(&journal->trans_barrier);
+ up_read(&journal->j_trans_barrier);
handle->k_handle = NULL; /* it's been free'd in journal_stop */
@@ -424,7 +424,7 @@
* during the transaction, so make sure they were taken *before*
* start_trans or we'll have ordering deadlocks.
*
- * WARNING2: Note that we do *not* drop trans_barrier here. This is
+ * WARNING2: Note that we do *not* drop j_trans_barrier here. This is
* good because transaction ids haven't yet been recorded on the
* cluster locks associated with this handle.
*/
@@ -607,7 +607,7 @@
{
int status = -1;
struct inode *inode = NULL; /* the journal inode */
- journal_t * k_journal = NULL;
+ journal_t * j_journal = NULL;
ocfs2_dinode *fe = NULL;
struct buffer_head *bh = NULL;
@@ -666,28 +666,28 @@
OCFS_I(inode)->ip_open_cnt++;
/* call the kernels journal init function now */
- k_journal = journal_init_inode(inode);
- if (k_journal == NULL) {
+ j_journal = journal_init_inode(inode);
+ if (j_journal == NULL) {
LOG_ERROR_STR("Linux journal layer error");
status = -1;
goto done;
}
LOG_TRACE_STR("Returned from journal_init_inode");
- LOG_TRACE_ARGS("k_journal->j_maxlen = %u\n", k_journal->j_maxlen);
- k_journal->j_commit_interval = OCFS_DEFAULT_COMMIT_INTERVAL;
+ LOG_TRACE_ARGS("j_journal->j_maxlen = %u\n", j_journal->j_maxlen);
+ j_journal->j_commit_interval = OCFS_DEFAULT_COMMIT_INTERVAL;
/* yay, pass the proper info back to our journal structure. */
- osb->journal->osb = osb;
- osb->journal->k_journal = k_journal;
- osb->journal->k_inode = inode;
- osb->journal->version = OCFS_JOURNAL_CURRENT_VERSION;
- osb->journal->lockbh = bh;
- atomic_set(&(osb->journal->num_trans), 0);
- init_rwsem(&(osb->journal->trans_barrier));
+ osb->journal->j_osb = osb;
+ osb->journal->j_journal = j_journal;
+ osb->journal->j_inode = inode;
+ osb->journal->j_bh = bh;
+ atomic_set(&(osb->journal->j_num_trans), 0);
+ init_rwsem(&(osb->journal->j_trans_barrier));
init_waitqueue_head(&osb->journal->j_checkpointed);
- osb->journal->state = OCFS_JOURNAL_LOADED;
- osb->journal->trans_id = (unsigned long) 1;
+ spin_lock_init(&osb->journal->j_lock);
+ osb->journal->j_state = OCFS_JOURNAL_LOADED;
+ osb->journal->j_trans_id = (unsigned long) 1;
*dirty = (le32_to_cpu(fe->id1.journal1.ij_flags) &
OCFS2_JOURNAL_DIRTY_FL);
@@ -713,7 +713,7 @@
int status;
unsigned int flags;
ocfs_journal * journal = osb->journal;
- struct buffer_head *bh = journal->lockbh;
+ struct buffer_head *bh = journal->j_bh;
ocfs2_dinode *fe;
LOG_ENTRY();
@@ -728,7 +728,7 @@
flags &= ~OCFS2_JOURNAL_DIRTY_FL;
fe->id1.journal1.ij_flags = cpu_to_le32(flags);
- status = ocfs_write_block(osb, bh, journal->k_inode);
+ status = ocfs_write_block(osb, bh, journal->j_inode);
if (status < 0)
LOG_ERROR_STATUS(status);
@@ -752,9 +752,9 @@
BUG();
journal = osb->journal;
- inode = journal->k_inode;
+ inode = journal->j_inode;
- if (journal->state != OCFS_JOURNAL_LOADED) {
+ if (journal->j_state != OCFS_JOURNAL_LOADED) {
LOG_ERROR_STATUS(status = -EINVAL);
goto done;
}
@@ -763,7 +763,7 @@
if (!igrab(inode))
BUG();
- num_running_trans = atomic_read(&(osb->journal->num_trans));
+ num_running_trans = atomic_read(&(osb->journal->j_num_trans));
if (num_running_trans > 0)
LOG_TRACE_ARGS("Shutting down journal: must wait on %d"
" running transactions!\n", num_running_trans);
@@ -772,7 +772,7 @@
* release any locks that are still held.
* set the SHUTDOWN flag and release the trans lock.
* the commit thread will take the trans lock for us below. */
- journal->state = OCFS_JOURNAL_IN_SHUTDOWN;
+ journal->j_state = OCFS_JOURNAL_IN_SHUTDOWN;
/* The OCFS_JOURNAL_IN_SHUTDOWN will signal to commit_cache to not
* drop the trans_lock (which we want to hold until we
@@ -784,26 +784,26 @@
osb->commit_task = NULL;
}
- OCFS_ASSERT(atomic_read(&(osb->journal->num_trans)) == 0);
+ OCFS_ASSERT(atomic_read(&(osb->journal->j_num_trans)) == 0);
status = ocfs_journal_toggle_dirty(osb, 0);
if (status < 0)
LOG_ERROR_STATUS(status);
/* Shutdown the kernel journal system */
- journal_destroy(journal->k_journal);
+ journal_destroy(journal->j_journal);
OCFS_I(inode)->ip_open_cnt--;
/* unlock our journal */
ocfs2_meta_unlock(inode, 1);
- brelse (journal->lockbh);
- journal->lockbh = NULL;
+ brelse (journal->j_bh);
+ journal->j_bh = NULL;
- journal->state = OCFS_JOURNAL_FREE;
+ journal->j_state = OCFS_JOURNAL_FREE;
-// up_write(&journal->trans_barrier);
+// up_write(&journal->j_trans_barrier);
done:
if (inode)
iput(inode);
@@ -821,19 +821,19 @@
if (!journal)
BUG();
- osb = journal->osb;
+ osb = journal->j_osb;
- status = journal_load(journal->k_journal);
+ status = journal_load(journal->j_journal);
if (status < 0) {
LOG_ERROR_STR("Failed to load journal!");
goto done;
}
- olderr = journal_errno(journal->k_journal);
+ olderr = journal_errno(journal->j_journal);
if (olderr) {
printk("ocfs2: last journal left error code %d\n", olderr);
- journal_ack_err(journal->k_journal);
- journal_clear_err(journal->k_journal);
+ journal_ack_err(journal->j_journal);
+ journal_clear_err(journal->j_journal);
}
status = ocfs_journal_toggle_dirty(osb, 1);
@@ -870,13 +870,13 @@
if (!journal)
BUG();
- status = journal_wipe(journal->k_journal, full);
+ status = journal_wipe(journal->j_journal, full);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- status = ocfs_journal_toggle_dirty(journal->osb, 0);
+ status = ocfs_journal_toggle_dirty(journal->j_osb, 0);
if (status < 0)
LOG_ERROR_STATUS(status);
@@ -1057,7 +1057,7 @@
ocfs2_dinode *fe;
ocfs2_dinode *local_alloc = NULL;
struct inode *inode = NULL;
- journal_t *k_journal = NULL;
+ journal_t *j_journal = NULL;
struct buffer_head *bh = NULL;
ocfs_journal * journal = NULL;
int got_lock = 0, clean_orphans = 0;
@@ -1139,27 +1139,27 @@
/* init the journal, load it and possibly replay it */
LOG_TRACE_STR("calling journal_init_inode");
- k_journal = journal_init_inode(inode);
- if (k_journal == NULL) {
+ j_journal = journal_init_inode(inode);
+ if (j_journal == NULL) {
LOG_ERROR_STR("Linux journal layer error");
status = -EIO;
goto done;
}
- status = journal_load(k_journal);
+ status = journal_load(j_journal);
if (status < 0) {
LOG_ERROR_STATUS(status);
if (!igrab(inode))
BUG();
- journal_destroy(k_journal);
+ journal_destroy(j_journal);
goto done;
}
/* wipe the journal */
LOG_TRACE_STR("flushing the journal.");
- journal_lock_updates(k_journal);
- status = journal_flush(k_journal);
- journal_unlock_updates(k_journal);
+ journal_lock_updates(j_journal);
+ status = journal_flush(j_journal);
+ journal_unlock_updates(j_journal);
if (status < 0)
LOG_ERROR_STATUS(status);
@@ -1175,9 +1175,8 @@
BUG();
/* shutdown the journal */
- journal_destroy(k_journal);
+ journal_destroy(j_journal);
-#warning "we can't complete local alloc recovery in this function!"
/* recover his local alloc file, AFTER recovering his journal... */
status = ocfs_begin_local_alloc_recovery(osb, slot_num, &local_alloc);
if (status < 0) {
@@ -1456,16 +1455,16 @@
ocfs_super *osb = arg;
ocfs_journal *journal = osb->journal;
- /* we can trust num_trans here because _should_stop() is only set in
+ /* we can trust j_num_trans here because _should_stop() is only set in
* shutdown and nobody other than ourselves should be able to start
* transactions. committing on shutdown might take a few iterations
* as final transactions put deleted inodes on the list */
while (!(kthread_should_stop() &&
- atomic_read(&journal->num_trans) == 0)) {
+ atomic_read(&journal->j_num_trans) == 0)) {
status = wait_event_timeout(osb->checkpoint_event,
- atomic_read(&journal->num_trans) ||
- kthread_should_stop(),
+ atomic_read(&journal->j_num_trans)
+ || kthread_should_stop(),
OCFS_CHECKPOINT_INTERVAL);
if (status == 0)
LOG_TRACE_STR("timed out");
@@ -1479,10 +1478,10 @@
LOG_ERROR_STATUS(status);
#ifdef VERBOSE_COMMIT_THREAD
- if (kthread_should_stop() && atomic_read(&journal->num_trans)){
+ if (kthread_should_stop() && atomic_read(&journal->j_num_trans)){
printk("(%u) commit_thread: %u transactions pending "
"on shutdown\n", current->pid,
- atomic_read(&journal->num_trans));
+ atomic_read(&journal->j_num_trans));
}
#endif
}
Modified: trunk/fs/ocfs2/ocfs_journal.h
===================================================================
--- trunk/fs/ocfs2/ocfs_journal.h 2005-03-24 23:38:26 UTC (rev 2047)
+++ trunk/fs/ocfs2/ocfs_journal.h 2005-03-24 23:46:07 UTC (rev 2048)
@@ -29,7 +29,6 @@
#include <linux/fs.h>
#include <linux/jbd.h>
-#define OCFS_JOURNAL_CURRENT_VERSION 1
#define OCFS_CHECKPOINT_INTERVAL (8 * HZ)
enum ocfs_journal_state {
@@ -44,13 +43,12 @@
typedef struct _ocfs_journal ocfs_journal;
struct _ocfs_journal {
- enum ocfs_journal_state state; /* Journals current state */
+ enum ocfs_journal_state j_state; /* Journals current state */
- journal_t *k_journal; /* The kernels journal type */
- struct inode *k_inode; /* Kernel inode pointing to
+ journal_t *j_journal; /* The kernels journal type */
+ struct inode *j_inode; /* Kernel inode pointing to
* this journal */
- u8 version; /* Journal version */
- struct _ocfs_super *osb; /* pointer to the super
+ struct _ocfs_super *j_osb; /* pointer to the super
* block for the node
* we're currently
* running on -- not
@@ -59,27 +57,26 @@
* which we usually run
* from (recovery,
* etc) */
- struct buffer_head *lockbh; /* Journal disk lock, used
- to access file entry */
- atomic_t num_trans; /* Number of transactions
- * currently in the system. */
- unsigned long trans_id;
- /* locking order: trans_lock -> cmt_lock */
- spinlock_t cmt_lock; /* protects the committed list */
- struct rw_semaphore trans_barrier;
+ struct buffer_head *j_bh; /* Journal disk inode block */
+ atomic_t j_num_trans; /* Number of transactions
+ * currently in the system. */
+ unsigned long j_trans_id;
+ struct rw_semaphore j_trans_barrier;
wait_queue_head_t j_checkpointed;
+
+ spinlock_t j_lock; /* */
};
extern spinlock_t trans_inc_lock;
-/* wrap trans_id so we never have it equal to zero. */
+/* wrap j_trans_id so we never have it equal to zero. */
static inline unsigned long ocfs_inc_trans_id(ocfs_journal *j)
{
unsigned long old_id;
spin_lock(&trans_inc_lock);
- old_id = j->trans_id++;
- if (!j->trans_id)
- j->trans_id = 1;
+ old_id = j->j_trans_id++;
+ if (!j->j_trans_id)
+ j->j_trans_id = 1;
spin_unlock(&trans_inc_lock);
return old_id;
}
@@ -88,7 +85,7 @@
struct inode *inode)
{
spin_lock(&trans_inc_lock);
- OCFS_I(inode)->ip_last_trans = journal->trans_id;
+ OCFS_I(inode)->ip_last_trans = journal->j_trans_id;
spin_unlock(&trans_inc_lock);
}
@@ -103,7 +100,7 @@
ocfs_journal *journal = OCFS2_SB(inode->i_sb)->journal;
spin_lock(&trans_inc_lock);
- ret = time_after(journal->trans_id, OCFS_I(inode)->ip_last_trans);
+ ret = time_after(journal->j_trans_id, OCFS_I(inode)->ip_last_trans);
spin_unlock(&trans_inc_lock);
return ret;
}
@@ -117,11 +114,11 @@
/* System files are never "new" as they're written out by
* mkfs. This helps us early during mount, before we have the
- * journal open and trans_id could be junk. */
+ * journal open and j_trans_id could be junk. */
if (OCFS_I(inode)->ip_flags & OCFS_INODE_SYSTEM_FILE)
return 0;
spin_lock(&trans_inc_lock);
- ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->trans_id,
+ ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id,
OCFS_I(inode)->ip_created_trans));
if (!ret)
OCFS_I(inode)->ip_created_trans = 0;
@@ -133,7 +130,7 @@
struct inode *inode)
{
spin_lock(&trans_inc_lock);
- OCFS_I(inode)->ip_created_trans = osb->journal->trans_id;
+ OCFS_I(inode)->ip_created_trans = osb->journal->j_trans_id;
spin_unlock(&trans_inc_lock);
}
Modified: trunk/fs/ocfs2/proc.c
===================================================================
--- trunk/fs/ocfs2/proc.c 2005-03-24 23:38:26 UTC (rev 2047)
+++ trunk/fs/ocfs2/proc.c 2005-03-24 23:46:07 UTC (rev 2048)
@@ -388,7 +388,7 @@
len = sprintf (page, PROC_STATS, osb->num_nodes, osb->s_clustersize,
ocfs2_clusters_to_bytes(osb->sb, osb->num_clusters),
- atomic_read(&osb->journal->num_trans));
+ atomic_read(&osb->journal->j_num_trans));
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-03-24 23:38:26 UTC (rev 2047)
+++ trunk/fs/ocfs2/super.c 2005-03-24 23:46:07 UTC (rev 2048)
@@ -185,8 +185,8 @@
tid_t target;
sb->s_dirt = 0;
- target = log_start_commit(OCFS2_SB(sb)->journal->k_journal, NULL);
- log_wait_commit(OCFS2_SB(sb)->journal->k_journal, target);
+ target = log_start_commit(OCFS2_SB(sb)->journal->j_journal, NULL);
+ log_wait_commit(OCFS2_SB(sb)->journal->j_journal, target);
return 0;
}
#else
@@ -195,9 +195,9 @@
tid_t target;
sb->s_dirt = 0;
- if (journal_start_commit(OCFS2_SB(sb)->journal->k_journal, &target)) {
+ if (journal_start_commit(OCFS2_SB(sb)->journal->j_journal, &target)) {
if (wait)
- log_wait_commit(OCFS2_SB(sb)->journal->k_journal,
+ log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
target);
}
return 0;
More information about the Ocfs2-commits
mailing list