[Ocfs2-tools-devel] [PATCH 09/10] libocfs2: Write leaf extent block in case of record replacement.

Tao Ma tao.ma at oracle.com
Wed Sep 30 07:27:46 PDT 2009


In ocfs2_split_extent, when we meet with the situation
of c_split_covers_rec, the old solution just replace the extent
record and forget to write the leaf block. This patch fixes it
and since the root of an extent tree can be anything, so we
leave it to the caller.

Mainline commit is 47be12e4eec84c1846f29af64fe25a396b57a026.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 libocfs2/extent_tree.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libocfs2/extent_tree.c b/libocfs2/extent_tree.c
index c129dc3..e9ceef3 100644
--- a/libocfs2/extent_tree.c
+++ b/libocfs2/extent_tree.c
@@ -3651,9 +3651,17 @@ static int ocfs2_split_extent(struct insert_ctxt *insert_ctxt,
 	merge_ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]);
 
 	if (merge_ctxt.c_contig_type == CONTIG_NONE) {
-		if (merge_ctxt.c_split_covers_rec)
+		if (merge_ctxt.c_split_covers_rec) {
 			el->l_recs[split_index] = split_rec;
-		else
+			/*
+			 * We only write the leaf block, and leave
+			 * the write of the root to the caller.
+			 */
+			if (path->p_tree_depth)
+				ret = ocfs2_write_extent_block(fs,
+							path_leaf_blkno(path),
+							path_leaf_buf(path));
+		} else
 			ret = ocfs2_split_and_insert(insert_ctxt, path,
 						     &last_eb_buf, split_index,
 						     &split_rec);
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list