[Ocfs2-tools-commits] taoma commits r1336 - branches/sparse-files/libocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Apr 3 02:00:21 PDT 2007


Author: taoma
Date: 2007-04-03 02:00:18 -0700 (Tue, 03 Apr 2007)
New Revision: 1336

Modified:
   branches/sparse-files/libocfs2/extend_file.c
   branches/sparse-files/libocfs2/extent_map.c
Log:
 Modify 3 bugs found during the test of sparse-files. They are:

1. The wrong buffer is used for reading extent block in ocfs2_figure_hole_clusters.
   This is a slip, but I should be blamed for not checking clearly.
2. The h_next_leaf_blk isn't updated in the extent block when ocfs2_add_branch is called.
3. le32_to_cpu isn't neccesary in ocfs2-tools, so remove it.

Modified: branches/sparse-files/libocfs2/extend_file.c
===================================================================
--- branches/sparse-files/libocfs2/extend_file.c	2007-03-28 06:10:14 UTC (rev 1335)
+++ branches/sparse-files/libocfs2/extend_file.c	2007-04-03 09:00:18 UTC (rev 1336)
@@ -470,9 +470,6 @@
 	 */
 	fe->i_last_eb_blk = new_last_eb_blk;
 
-	eb = (struct ocfs2_extent_block *) last_eb_buf;
-	eb->h_next_leaf_blk = new_last_eb_blk;
-
 	/* here all the extent block and the new inode information should be
 	 * written back to the disk.
 	 */
@@ -483,6 +480,15 @@
 			goto bail;
 	}
 
+	/* update last_eb_buf's next_leaf pointer for
+	 * the new last extent block.
+	 */
+	eb = (struct ocfs2_extent_block *) last_eb_buf;
+	eb->h_next_leaf_blk = new_last_eb_blk;
+	ret = ocfs2_write_extent_block(fs, eb->h_blkno, last_eb_buf);
+	if (ret)
+		goto bail;
+
 	if (eb_buf) {
 		eb = (struct ocfs2_extent_block *)eb_buf;
 		ret = ocfs2_write_extent_block(fs, eb->h_blkno, eb_buf);
@@ -650,7 +656,7 @@
 	for(i = 0; i < next_free; i++) {
 		rec = &el->l_recs[i];
 
-		if (insert_cpos < le32_to_cpu(rec->e_cpos))
+		if (insert_cpos < rec->e_cpos)
 			break;
 	}
 	insert_index = i;

Modified: branches/sparse-files/libocfs2/extent_map.c
===================================================================
--- branches/sparse-files/libocfs2/extent_map.c	2007-03-28 06:10:14 UTC (rev 1335)
+++ branches/sparse-files/libocfs2/extent_map.c	2007-04-03 09:00:18 UTC (rev 1336)
@@ -536,7 +536,7 @@
 			goto out;
 
 		ret = ocfs2_read_extent_block(cinode->ci_fs,
-					      eb->h_next_leaf_blk, eb_buf);
+					      eb->h_next_leaf_blk, next_eb_buf);
 		if (ret)
 			goto out;
 




More information about the Ocfs2-tools-commits mailing list