[Ocfs2-commits] zab commits r2607 - branches/locking-changes/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Sep 22 15:26:24 CDT 2005


Author: zab
Date: 2005-09-22 15:26:22 -0500 (Thu, 22 Sep 2005)
New Revision: 2607

Modified:
   branches/locking-changes/fs/ocfs2/file.c
Log:
o we were accidentally derefing *reason when we meant to test if it
  was null.  instead, fill an on-stack reason and only set the
  caller's as we exit.


Modified: branches/locking-changes/fs/ocfs2/file.c
===================================================================
--- branches/locking-changes/fs/ocfs2/file.c	2005-09-22 18:15:06 UTC (rev 2606)
+++ branches/locking-changes/fs/ocfs2/file.c	2005-09-22 20:26:22 UTC (rev 2607)
@@ -336,20 +336,17 @@
 			       ocfs2_journal_handle *handle,
 			       ocfs2_alloc_context *data_ac,
 			       ocfs2_alloc_context *meta_ac,
-			       enum ocfs2_alloc_restarted *reason)
+			       enum ocfs2_alloc_restarted *reason_ret)
 {
 	int status = 0;
 	int free_extents;
 	ocfs2_dinode *fe = (ocfs2_dinode *) fe_bh->b_data;
+	enum ocfs2_alloc_restarted reason = RESTART_NONE;
 	u32 bit_off, num_bits;
 	u64 block;
 
 	BUG_ON(!clusters_to_add);
 
-	/* We always want to set this, even if we error later. */
-	if (*reason)
-		*reason = RESTART_NONE;
-
 	free_extents = ocfs2_num_free_extents(osb, inode, fe);
 	if (free_extents < 0) {
 		status = free_extents;
@@ -365,16 +362,14 @@
 	if (!free_extents && !meta_ac) {
 		mlog(0, "we haven't reserved any metadata!\n");
 		status = -EAGAIN;
-		if (reason)
-			*reason = RESTART_META;
+		reason = RESTART_META;
 		goto leave;
 	} else if ((!free_extents)
 		   && (ocfs2_alloc_context_bits_left(meta_ac)
 		       < ocfs2_extend_meta_needed(fe))) {
 		mlog(0, "filesystem is really fragmented...\n");
 		status = -EAGAIN;
-		if (reason)
-			*reason = RESTART_META;
+		reason = RESTART_META;
 		goto leave;
 	}
 
@@ -423,12 +418,13 @@
 		mlog(0, "need to alloc once more, clusters = %u, wanted = "
 		     "%u\n", fe->i_clusters, clusters_to_add);
 		status = -EAGAIN;
-		if (reason)
-			*reason = RESTART_TRANS;
+		reason = RESTART_TRANS;
 	}
 
 leave:
 	mlog_exit(status);
+	if (reason_ret)
+		*reason_ret = reason;
 	return status;
 }
 



More information about the Ocfs2-commits mailing list