[Ocfs2-tools-commits] taoma commits r1352 - in
branches/sparse-files: fswreck libocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed May 9 00:21:59 PDT 2007
Author: taoma
Date: 2007-05-09 00:21:56 -0700 (Wed, 09 May 2007)
New Revision: 1352
Modified:
branches/sparse-files/fswreck/extent.c
branches/sparse-files/libocfs2/extend_file.c
Log:
Modify 2 bugs in sparse files.
1. ocfs2_append_rec_to_path fails to synchronize left_path with right_path.
In this function we modify the extent block in right_path, but don't
synchronize the buffer in the left path. So in the future, when we use the
left path, we will get the wrong extent block information.
2. in fswreck/extents.c, we use the wrong offset for ocfs2_insert_extent,
so change it to the right value.
Modified: branches/sparse-files/fswreck/extent.c
===================================================================
--- branches/sparse-files/fswreck/extent.c 2007-05-08 02:50:25 UTC (rev 1351)
+++ branches/sparse-files/fswreck/extent.c 2007-05-09 07:21:56 UTC (rev 1352)
@@ -84,7 +84,7 @@
{
errcode_t ret;
uint32_t n_clusters;
- uint32_t i;
+ uint32_t i, offset = 0;
uint64_t blkno;
uint64_t tmpblk;
@@ -103,7 +103,7 @@
* we insert each cluster in reverse. */
for(i = n_clusters; i; --i) {
tmpblk = blkno + ocfs2_clusters_to_blocks(fs, i - 1);
- ret = ocfs2_insert_extent(fs, ino, n_clusters - i,
+ ret = ocfs2_insert_extent(fs, ino, offset++,
tmpblk, 1);
if (ret)
FSWRK_COM_FATAL(progname, ret);
Modified: branches/sparse-files/libocfs2/extend_file.c
===================================================================
--- branches/sparse-files/libocfs2/extend_file.c 2007-05-08 02:50:25 UTC (rev 1351)
+++ branches/sparse-files/libocfs2/extend_file.c 2007-05-09 07:21:56 UTC (rev 1352)
@@ -1740,6 +1740,16 @@
rec->e_int_clusters += insert_rec->e_leaf_clusters;
rec->e_int_clusters -= rec->e_cpos;
+ /*
+ * Since we have changed the extent block in the right path,
+ * we have to keep them the same in the left path we found
+ * above.
+ */
+ if (left_path && left_path->p_node[i].blkno ==
+ right_path->p_node[i].blkno)
+ memcpy(left_path->p_node[i].buf,
+ right_path->p_node[i].buf,
+ fs->fs_blocksize);
/* Don't touch the leaf node */
if (++i >= right_path->p_tree_depth)
break;
More information about the Ocfs2-tools-commits
mailing list