[Ocfs2-tools-devel] [PATCH 2/2] fsck.ocfs2: update i_clusters in swap_clone.

Tao Ma tao.ma at oracle.com
Sat Oct 10 02:03:36 PDT 2009


In new_clone, we allocate all the clusters disregard whether
there are holes. So we also need to update the i_clusters in
swap_clone to make the inode consistent.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 fsck.ocfs2/pass1b.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fsck.ocfs2/pass1b.c b/fsck.ocfs2/pass1b.c
index b6ece57..dbf28ba 100644
--- a/fsck.ocfs2/pass1b.c
+++ b/fsck.ocfs2/pass1b.c
@@ -1124,6 +1124,7 @@ static errcode_t copy_clone(ocfs2_filesys *fs, ocfs2_cached_inode *orig_ci,
 static errcode_t swap_clone(ocfs2_filesys *fs, ocfs2_cached_inode *orig_ci,
 			    ocfs2_cached_inode *clone_ci)
 {
+	uint32_t clusters;
 	errcode_t ret;
 	struct ocfs2_extent_list *tmp_el = NULL;
 	struct ocfs2_extent_list *orig_el = &orig_ci->ci_inode->id2.i_list;
@@ -1144,6 +1145,14 @@ static errcode_t swap_clone(ocfs2_filesys *fs, ocfs2_cached_inode *orig_ci,
 	memcpy(clone_el, tmp_el, el_size);
 
 	/*
+	 * In new_clone, we allocate all the clusters disregard whether
+	 * there are holes. So here we need to update the i_clusters also.
+	 */
+	clusters = orig_ci->ci_inode->i_clusters;
+	orig_ci->ci_inode->i_clusters = clone_ci->ci_inode->i_clusters;
+	clone_ci->ci_inode->i_clusters = clusters;
+
+	/*
 	 * We write the cloned inode with the original extent list first.
 	 * If we crash between writing the cloned inode and the original
 	 * one, the cloned inode will appear to share the same extents
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list