Skip to contentSkip to conversation

ocfs2: return error while ocfs2_figure_merge_contig_type failing

PATCH Superseded Xue jiufei 4 participants 6 messages Apr 22, 2015 – Apr 25, 2015 OCFS2

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xue jiufei

author
#0 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

Now function ocfs2_figure_merge_contig_type() still return CONTIG_NONE when some error occurs which will cause unpredictable error. So return error while ocfs2_figure_merge_contig_type failing.

---
 fs/ocfs2/alloc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
fs/ocfs2/alloc.c +15 -7
index 044158b..2d07b38 100644
@@ -4313,11 +4313,11 @@ out:
 	return ret;
 }
 
-static enum ocfs2_contig_type
-ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
+static int ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
 			       struct ocfs2_path *path,
 			       struct ocfs2_extent_list *el, int index,
-			       struct ocfs2_extent_rec *split_rec)
+			       struct ocfs2_extent_rec *split_rec,
+			       struct ocfs2_merge_ctxt *ctxt)
 {
 	int status;
 	enum ocfs2_contig_type ret = CONTIG_NONE;
@@ -4431,12 +4431,15 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
 	}
 
 out:
+	if (status == 0)
+		ctxt->c_contig_type = ret;
+
 	if (left_path)
 		ocfs2_free_path(left_path);
 	if (right_path)
 		ocfs2_free_path(right_path);
 
-	return ret;
+	return status;
 }
 
 static void ocfs2_figure_contig_type(struct ocfs2_extent_tree *et,
@@ -5042,9 +5045,14 @@ int ocfs2_split_extent(handle_t *handle,
 		goto out;
 	}
 
-	ctxt.c_contig_type = ocfs2_figure_merge_contig_type(et, path, el,
-							    split_index,
-							    split_rec);
+	ret =  ocfs2_figure_merge_contig_type(et, path, el,
+					      split_index,
+					      split_rec,
+					      &ctxt);
+	if (ret) {
+		mlog_errno(ret);
+		goto out;
+	}
 
 	/*
 	 * The core merge / split code wants to know how much room is
Signature · 1 line
1.8.4.3
#1 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

Quoted 5 lines · Xue jiufei

Now function ocfs2_figure_merge_contig_type() still return CONTIG_NONE when some error occurs which will cause unpredictable error. So return error while ocfs2_figure_merge_contig_type failing.

Looks fine.

Quoted 59 lines
---
 fs/ocfs2/alloc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
fs/ocfs2/alloc.c +15 -7
index 044158b..2d07b38 100644
@@ -4313,11 +4313,11 @@ out:
 	return ret;
 }
 
-static enum ocfs2_contig_type
-ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
+static int ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
 			       struct ocfs2_path *path,
 			       struct ocfs2_extent_list *el, int index,
-			       struct ocfs2_extent_rec *split_rec)
+			       struct ocfs2_extent_rec *split_rec,
+			       struct ocfs2_merge_ctxt *ctxt)
 {
 	int status;
 	enum ocfs2_contig_type ret = CONTIG_NONE;
@@ -4431,12 +4431,15 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
 	}
 
 out:
+	if (status == 0)
+		ctxt->c_contig_type = ret;
+
 	if (left_path)
 		ocfs2_free_path(left_path);
 	if (right_path)
 		ocfs2_free_path(right_path);
 
-	return ret;
+	return status;
 }
 
 static void ocfs2_figure_contig_type(struct ocfs2_extent_tree *et,
@@ -5042,9 +5045,14 @@ int ocfs2_split_extent(handle_t *handle,
 		goto out;
 	}
 
-	ctxt.c_contig_type = ocfs2_figure_merge_contig_type(et, path, el,
-							    split_index,
-							    split_rec);
+	ret =  ocfs2_figure_merge_contig_type(et, path, el,
+					      split_index,
+					      split_rec,
+					      &ctxt);
+	if (ret) {
+		mlog_errno(ret);
+		goto out;
+	}
 
 	/*
 	 * The core merge / split code wants to know how much room is
#2 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

Quoted 9 lines · Junxiao Bi
Quoted 5 lines · Xue jiufei
Quoted 5 lines

Now function ocfs2_figure_merge_contig_type() still return CONTIG_NONE when some error occurs which will cause unpredictable error. So return error while ocfs2_figure_merge_contig_type failing.

Looks fine.

#3 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

In reply to Xue jiufei
Quoted 3 lines · On Wed, 22 Apr 2015 08:36:10 +0800 Xue jiufei <[email protected]> wrote:

Now function ocfs2_figure_merge_contig_type() still return CONTIG_NONE when some error occurs which will cause unpredictable error. So return error while ocfs2_figure_merge_contig_type failing.

Can you please redo this patch against current mainline? The conflicts are significant.

Thanks.

author
#4 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

Hi andrew,
I did this against mainline linux-4.0. Do you mean that I should do patch against linux-next tree?

Thanks.

Quoted 12 lines · Andrew Morton
Quoted 3 lines · On Wed, 22 Apr 2015 08:36:10 +0800 Xue jiufei <[email protected]> wrote:

Now function ocfs2_figure_merge_contig_type() still return CONTIG_NONE when some error occurs which will cause unpredictable error. So return error while ocfs2_figure_merge_contig_type failing.

Can you please redo this patch against current mainline? The conflicts are significant.

Thanks.

#5 lore raw

PATCH v2 1/1 ocfs2: return error while ocfs2_figure_merge_contig_type failing

Quoted 2 lines · On Sat, 25 Apr 2015 10:15:31 +0800 Xue jiufei <[email protected]> wrote:

Hi andrew,
I did this against mainline linux-4.0.

That's extremely out of date ;)

Quoted 2 lines

Do you mean that I should
do patch against linux-next tree?

"current mainline" is current Linus git. Or wait for 4.1-rc1.