[Ocfs2-commits] mfasheh commits r2192 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Apr 27 17:54:41 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-04-27 17:54:37 -0500 (Wed, 27 Apr 2005)
New Revision: 2192

Modified:
   trunk/fs/ocfs2/journal.c
   trunk/fs/ocfs2/journal.h
Log:
* Fix commit_trans to handle the case warned about in ocfs_extend_trans.
  This allows us to remove that warning.

* As a result, handle->osb is no longer used, so just remove that from the
  handle struct.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c	2005-04-27 22:15:22 UTC (rev 2191)
+++ trunk/fs/ocfs2/journal.c	2005-04-27 22:54:37 UTC (rev 2192)
@@ -224,7 +224,6 @@
 	INIT_LIST_HEAD(&(retval->locks));
 	INIT_LIST_HEAD(&(retval->inode_list));
 	retval->journal = osb->journal;
-	retval->osb = osb;
 
 	return retval;
 }
@@ -332,8 +331,6 @@
  * paths. Beware, it can be called from start_trans too! */
 static void ocfs_commit_unstarted_handle(ocfs_journal_handle *handle)
 {
-	ocfs_super *osb;
-
 	mlog_entry_void();
 
 	OCFS_ASSERT(!(handle->flags & OCFS_HANDLE_STARTED));
@@ -341,8 +338,7 @@
 	ocfs_handle_unlock_inodes(handle);
 	/* You are allowed to add journal locks before the transaction
 	 * has started. */
-	osb = handle->osb;
-	ocfs_handle_cleanup_locks(osb->journal, handle, 0);
+	ocfs_handle_cleanup_locks(handle->journal, handle, 0);
 
 	kfree(handle);
 	mlog_exit_void();
@@ -353,11 +349,9 @@
  */
 void ocfs_commit_trans(ocfs_journal_handle * handle) 
 {
-	ocfs_super *osb;
-	handle_t *kern_handle;
-	transaction_t *kern_trans;
-	int retval, sync;
-	ocfs_journal *journal;
+	handle_t *jbd_handle;
+	int retval;
+	ocfs_journal *journal = handle->journal;
 
 	mlog_entry_void();
 
@@ -369,35 +363,37 @@
 		return;
 	}
 
-	osb = handle->osb;
-	kern_handle = handle->k_handle;
-	kern_trans = kern_handle->h_transaction;
-	journal = osb->journal;
-	sync = handle->flags & OCFS_HANDLE_SYNC;
-
-	if (sync)
-		kern_handle->h_sync = 1;
-	else
-		kern_handle->h_sync = 0;
-
 	/* release inode semaphores we took during this transaction */
 	ocfs_handle_unlock_inodes(handle);
 
-	/* actually stop the transaction. if we've set h_sync,
-	 * it'll have been committed when we return */
-	retval = journal_stop(kern_handle);
-	if (retval < 0) {
-		mlog_errno(retval);
-		mlog(ML_ERROR, "Could not commit transaction\n");
-		BUG();
+	/* ocfs_extend_trans may have had to call journal_restart
+	 * which will always commit the transaction, but may return
+	 * error for any number of reasons. If this is the case, we
+	 * clear k_handle as it's not valid any more. */
+	if (handle->k_handle) {
+		jbd_handle = handle->k_handle;
+
+		if (handle->flags & OCFS_HANDLE_SYNC)
+			jbd_handle->h_sync = 1;
+		else
+			jbd_handle->h_sync = 0;
+
+		/* actually stop the transaction. if we've set h_sync,
+		 * it'll have been committed when we return */
+		retval = journal_stop(jbd_handle);
+		if (retval < 0) {
+			mlog_errno(retval);
+			mlog(ML_ERROR, "Could not commit transaction\n");
+			BUG();
+		}
+
+		handle->k_handle = NULL; /* it's been free'd in journal_stop */
 	}
 
-	ocfs_handle_cleanup_locks(osb->journal, handle, 1);
+	ocfs_handle_cleanup_locks(journal, handle, 1);
 
 	up_read(&journal->j_trans_barrier);
 
-	handle->k_handle = NULL; /* it's been free'd in journal_stop */
-
 	kfree(handle);
 	mlog_exit_void();
 } /* ocfs_commit_trans */
@@ -437,7 +433,6 @@
 		mlog(0, "journal_extend failed, trying journal_restart\n");
 		status = journal_restart(handle->k_handle, nblocks);
 		if (status < 0) {
-#warning we need to handle this better
 			handle->k_handle = NULL;
 			mlog_errno(status);
 			goto bail;

Modified: trunk/fs/ocfs2/journal.h
===================================================================
--- trunk/fs/ocfs2/journal.h	2005-04-27 22:15:22 UTC (rev 2191)
+++ trunk/fs/ocfs2/journal.h	2005-04-27 22:54:37 UTC (rev 2192)
@@ -148,7 +148,6 @@
 struct _ocfs_journal_handle {
 	handle_t            *k_handle; /* kernel handle.                */
 	ocfs_journal        *journal;
-	struct _ocfs_super  *osb;      /* what super block we belong to */
 	u32                 flags;     /* see flags below.              */
 	int                 max_buffs; /* Buffs reserved by this handle */
 



More information about the Ocfs2-commits mailing list