[Ocfs2-commits] mfasheh commits r2067 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Mar 28 20:47:58 CST 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-03-28 20:47:56 -0600 (Mon, 28 Mar 2005)
New Revision: 2067
Modified:
trunk/fs/ocfs2/journal.c
trunk/fs/ocfs2/ocfs_journal.h
trunk/fs/ocfs2/super.c
Log:
* initialze the ocfs_journal struct earlier in mount.
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c 2005-03-29 01:52:45 UTC (rev 2066)
+++ trunk/fs/ocfs2/journal.c 2005-03-29 02:47:56 UTC (rev 2067)
@@ -59,7 +59,6 @@
static int ocfs_recover_node(ocfs_super *osb,
int node_num,
ocfs2_dinode **la_copy);
-static void ocfs2_complete_recovery(void *data);
static int __ocfs_recovery_thread(void *arg);
static int ocfs_commit_cache (ocfs_super * osb);
static int ocfs_wait_on_mount(ocfs_super *osb);
@@ -605,7 +604,7 @@
/*
* Setup the journal using the journal system file
*/
-int ocfs_journal_init(ocfs_super *osb,
+int ocfs_journal_init(ocfs_journal *journal,
int *dirty)
{
int status = -1;
@@ -613,24 +612,14 @@
journal_t * j_journal = NULL;
ocfs2_dinode *fe = NULL;
struct buffer_head *bh = NULL;
- ocfs_journal *journal;
+ ocfs_super *osb;
LOG_ENTRY();
- OCFS_ASSERT(osb);
+ OCFS_ASSERT(journal);
- journal = osb->journal;
- journal->j_osb = osb;
+ osb = journal->j_osb;
- atomic_set(&journal->j_num_trans, 0);
- init_rwsem(&journal->j_trans_barrier);
- init_waitqueue_head(&journal->j_checkpointed);
- spin_lock_init(&journal->j_lock);
- journal->j_trans_id = (unsigned long) 1;
- journal->j_cleanup_orphans = 0;
- INIT_LIST_HEAD(&journal->j_la_cleanups);
- INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, osb);
-
/* already have the inode for our journal */
inode = ocfs_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE,
osb->slot_num);
@@ -975,7 +964,7 @@
* NOTE: This function can and will sleep on recovery of other nodes
* during cluster locking, just like any other ocfs2 process.
*/
-static void ocfs2_complete_recovery(void *data)
+void ocfs2_complete_recovery(void *data)
{
int ret, cleanup_orphans;
ocfs_super *osb = data;
Modified: trunk/fs/ocfs2/ocfs_journal.h
===================================================================
--- trunk/fs/ocfs2/ocfs_journal.h 2005-03-29 01:52:45 UTC (rev 2066)
+++ trunk/fs/ocfs2/ocfs_journal.h 2005-03-29 02:47:56 UTC (rev 2067)
@@ -175,6 +175,9 @@
handle->flags &= ~OCFS_HANDLE_SYNC;
}
+/* Exported only for the journal struct init code in super.c. Do not call. */
+void ocfs2_complete_recovery(void *data);
+
/*
* Journal Control:
* Initialize, Load, Shutdown, Wipe a journal.
@@ -191,7 +194,7 @@
* event on.
* ocfs_start_checkpoint - Kick the commit thread to do a checkpoint.
*/
-int ocfs_journal_init(struct _ocfs_super *osb, int *dirty);
+int ocfs_journal_init(ocfs_journal *journal, int *dirty);
void ocfs_journal_shutdown(struct _ocfs_super *osb);
int ocfs_journal_wipe(ocfs_journal *journal, int full);
int ocfs_journal_load(ocfs_journal *journal);
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-03-29 01:52:45 UTC (rev 2066)
+++ trunk/fs/ocfs2/super.c 2005-03-29 02:47:56 UTC (rev 2067)
@@ -1051,6 +1051,7 @@
ocfs2_dinode *di = NULL;
struct inode *inode = NULL;
struct buffer_head *bitmap_bh = NULL;
+ ocfs_journal *journal;
LOG_ENTRY ();
@@ -1127,14 +1128,26 @@
*/
/* initialize our journal structure */
- osb->journal = kmalloc(sizeof(ocfs_journal), GFP_KERNEL);
- if (!osb->journal) {
+ journal = kmalloc(sizeof(ocfs_journal), GFP_KERNEL);
+ if (!journal) {
LOG_ERROR_STR("unable to alloc journal");
status = -ENOMEM;
goto bail;
}
- memset(osb->journal, 0, sizeof(ocfs_journal));
+ memset(journal, 0, sizeof(ocfs_journal));
+ osb->journal = journal;
+ journal->j_osb = osb;
+ atomic_set(&journal->j_num_trans, 0);
+ init_rwsem(&journal->j_trans_barrier);
+ init_waitqueue_head(&journal->j_checkpointed);
+ spin_lock_init(&journal->j_lock);
+ journal->j_trans_id = (unsigned long) 1;
+ journal->j_cleanup_orphans = 0;
+ INIT_LIST_HEAD(&journal->j_la_cleanups);
+ INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, osb);
+ journal->j_state = OCFS_JOURNAL_FREE;
+
ocfs2_init_node_maps(osb);
INIT_LIST_HEAD (&(osb->osb_next));
@@ -1377,7 +1390,7 @@
LOG_ENTRY ();
/* Init our journal object. */
- status = ocfs_journal_init(osb, &dirty);
+ status = ocfs_journal_init(osb->journal, &dirty);
if (status < 0) {
LOG_ERROR_STR("Could not initialize journal!");
goto finally;
More information about the Ocfs2-commits
mailing list