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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Apr 8 16:20:58 CDT 2005


Author: mfasheh
Signed-off-by: jlbec
Date: 2005-04-08 16:20:57 -0500 (Fri, 08 Apr 2005)
New Revision: 2127

Modified:
   trunk/fs/ocfs2/buffer_head_io.c
   trunk/fs/ocfs2/namei.c
   trunk/fs/ocfs2/suballoc.c
Log:
* Rework slightly how we're setting our bh sequence numbers. I'm afraid some 
  of the sets might've been racing with other paths which set / clear bh
  bits.

Signed-off-by: jlbec



Modified: trunk/fs/ocfs2/buffer_head_io.c
===================================================================
--- trunk/fs/ocfs2/buffer_head_io.c	2005-04-08 08:40:26 UTC (rev 2126)
+++ trunk/fs/ocfs2/buffer_head_io.c	2005-04-08 21:20:57 UTC (rev 2127)
@@ -110,27 +110,15 @@
 			goto bail;
 		}
 
-		if (buffer_jbd(bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
-			LOG_TRACE_ARGS("trying to write a jbd managed bh "
-				       "(blocknr = %llu), nr=%d\n", 
-				       (unsigned long long)bh->b_blocknr, nr);
-#endif
-			continue;
+		if (unlikely(buffer_jbd(bh))) {
+			/* What are you thinking?! */
+			printk("ocfs2: trying to write a jbd managed bh "
+			       "(blocknr = %llu), nr=%d\n", 
+			       (unsigned long long)bh->b_blocknr, nr);
+			BUG();
 		}
 
 		lock_buffer(bh);
-		if (buffer_jbd(bh)) {
-#ifdef CATCH_BH_JBD_RACES
-			printk("Ugh, block %llu had the JBD bit set "
-			       "while I was in lock_buffer!", 
-			       (unsigned long long)bh->b_blocknr);
-			BUG();
-#else
-			unlock_buffer(bh);
-			continue;
-#endif
-		}
 
 		set_buffer_uptodate(bh);
 		/* remove from dirty list before I/O. */
@@ -297,6 +285,12 @@
 	for (i = (nr-1); i >= 0; i--) {
 		bh = bhs[i];
 
+		/* We know this can't have changed as we hold the
+		 * inode sem. Avoid doing any work on the bh as the
+		 * journal has it now. */
+		if (buffer_jbd(bh))
+			continue;
+
 		wait_on_buffer(bh);
 
 		if (inode)

Modified: trunk/fs/ocfs2/namei.c
===================================================================
--- trunk/fs/ocfs2/namei.c	2005-04-08 08:40:26 UTC (rev 2126)
+++ trunk/fs/ocfs2/namei.c	2005-04-08 21:20:57 UTC (rev 2127)
@@ -601,7 +601,6 @@
 	/* Inode is not yet fully populated, but we need some fields
 	 * for add_entry. */
 	inode->i_mode = mode;
-	SET_BH_SEQNUM(inode, *new_fe_bh);
 leave:
 	if (status < 0 && *new_fe_bh) {
 		brelse(*new_fe_bh);

Modified: trunk/fs/ocfs2/suballoc.c
===================================================================
--- trunk/fs/ocfs2/suballoc.c	2005-04-08 08:40:26 UTC (rev 2126)
+++ trunk/fs/ocfs2/suballoc.c	2005-04-08 21:20:57 UTC (rev 2127)
@@ -153,8 +153,6 @@
 
 	OCFS_ASSERT(((unsigned long long) bg_bh->b_blocknr) == group_blkno);
 
-	set_buffer_uptodate(bg_bh);
-	SET_BH_SEQNUM(alloc_inode, bg_bh);
 	status = ocfs_journal_access(handle, 
 				     alloc_inode,
 				     bg_bh, 
@@ -345,6 +343,8 @@
 		LOG_ERROR_STATUS(status);
 		goto bail;
 	}
+	set_buffer_uptodate(bg_bh);
+	SET_BH_SEQNUM(alloc_inode, bg_bh);
 
 	status = ocfs2_block_group_fill(handle, 
 					alloc_inode, 



More information about the Ocfs2-commits mailing list