[Ocfs2-commits] jlbec commits r2415 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 21 15:47:36 CDT 2005


Author: jlbec
Signed-off-by: mfasheh
Date: 2005-06-21 15:47:34 -0500 (Tue, 21 Jun 2005)
New Revision: 2415

Modified:
   trunk/fs/ocfs2/alloc.c
   trunk/fs/ocfs2/dlmglue.c
   trunk/fs/ocfs2/inode.c
Log:

o Fix an off-by-one in the truncate log code that causes coalescing
  with dead records.

Signed-off-by: mfasheh



Modified: trunk/fs/ocfs2/alloc.c
===================================================================
--- trunk/fs/ocfs2/alloc.c	2005-06-20 22:21:17 UTC (rev 2414)
+++ trunk/fs/ocfs2/alloc.c	2005-06-21 20:47:34 UTC (rev 2415)
@@ -869,15 +869,16 @@
 static int ocfs2_truncate_log_can_coalesce(ocfs2_truncate_log *tl,
 					   unsigned int new_start)
 {
-	unsigned int index = le16_to_cpu(tl->tl_used);
+	unsigned int tail_index;
 	unsigned int current_tail;
 
 	/* No records, nothing to coalesce */
-	if (!index)
+	if (!le16_to_cpu(tl->tl_used))
 		return 0;
 
-	current_tail = le32_to_cpu(tl->tl_recs[index].t_start);
-	current_tail += le32_to_cpu(tl->tl_recs[index].t_clusters);
+	tail_index = le16_to_cpu(tl->tl_used) - 1;
+	current_tail = le32_to_cpu(tl->tl_recs[tail_index].t_start);
+	current_tail += le32_to_cpu(tl->tl_recs[tail_index].t_clusters);
 
 	return current_tail == new_start;
 }
@@ -932,7 +933,12 @@
 	     OCFS2_I(tl_inode)->ip_blkno, index);
 
 	if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) {
-		/* Coalesce with the most recent record if possible */
+		/*
+		 * Move index back to the record we are coalescing with.
+		 * ocfs2_truncate_log_can_coalesce() guarantees nonzero
+		 */
+		index--;
+
 		num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters);
 		mlog(0, "Coalesce with index %u (start = %u, clusters = %u)\n",
 		     index, le32_to_cpu(tl->tl_recs[index].t_start),

Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c	2005-06-20 22:21:17 UTC (rev 2414)
+++ trunk/fs/ocfs2/dlmglue.c	2005-06-21 20:47:34 UTC (rev 2415)
@@ -55,6 +55,7 @@
 
 #include "buffer_head_io.h"
 
+
 static void ocfs2_inode_ast_func(void *opaque);
 static void ocfs2_inode_bast_func(void *opaque,
 				  int level);

Modified: trunk/fs/ocfs2/inode.c
===================================================================
--- trunk/fs/ocfs2/inode.c	2005-06-20 22:21:17 UTC (rev 2414)
+++ trunk/fs/ocfs2/inode.c	2005-06-21 20:47:34 UTC (rev 2415)
@@ -560,7 +560,6 @@
 		     "Inode %"MLFu64" (on-disk %"MLFu64") not orphaned!\n",
 		     OCFS2_I(inode)->ip_blkno,
 		     fe->i_blkno);
-		mlog_errno(status);
 		goto bail_unblock;
 	}
 



More information about the Ocfs2-commits mailing list