All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <1i5t5.duncan@cox.net>, Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Subject: [PATCH v2 1/3] btrfs-progs: fix missing parity stripe for raid6 in chunk-recover
Date: Thu, 12 Jun 2014 16:26:56 +0800	[thread overview]
Message-ID: <1402561616-28949-1-git-send-email-guihc.fnst@cn.fujitsu.com> (raw)

When deal with the p & q stripes for data profile raid6, chunk-recover
forgets to insert them into the chunk record. Just insert them back
freely.
Also wrap the insert procedure into a new function, fill_chunk_up.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
changelog:
	v1->v2: cleanup changelog, 'inert' changed to 'insert'
---
 chunk-recover.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/chunk-recover.c b/chunk-recover.c
index dfa7ff6..9b46b0b 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -1785,6 +1785,23 @@ static inline int count_devext_records(struct list_head *record_list)
 	return num_of_records;
 }
 
+static int fill_chunk_up(struct chunk_record *chunk, struct list_head *devexts,
+			 struct recover_control *rc)
+{
+	int ret = 0;
+	int i;
+
+	for (i = 0; i < chunk->num_stripes; i++) {
+		if (!chunk->stripes[i].devid) {
+			ret = insert_stripe(devexts, rc, chunk, i);
+			if (ret)
+				break;
+		}
+	}
+
+	return ret;
+}
+
 #define EQUAL_STRIPE (1 << 0)
 
 static int rebuild_raid_data_chunk_stripes(struct recover_control *rc,
@@ -1919,9 +1936,9 @@ next_csum:
 		num_unordered = count_devext_records(&unordered);
 		if (chunk->type_flags & BTRFS_BLOCK_GROUP_RAID6
 					&& num_unordered == 2) {
-			list_splice_init(&unordered, &chunk->dextents);
 			btrfs_release_path(&path);
-			return 0;
+			ret = fill_chunk_up(chunk, &unordered, rc);
+			return ret;
 		}
 
 		goto next_stripe;
@@ -1966,14 +1983,7 @@ out:
 			& BTRFS_BLOCK_GROUP_RAID5)
 		 || (num_unordered == 3 && chunk->type_flags
 			& BTRFS_BLOCK_GROUP_RAID6)) {
-			for (i = 0; i < chunk->num_stripes; i++) {
-				if (!chunk->stripes[i].devid) {
-					ret = insert_stripe(&unordered, rc,
-							chunk, i);
-					if (ret)
-						break;
-				}
-			}
+			ret = fill_chunk_up(chunk, &unordered, rc);
 		}
 	}
 fail_out:
-- 
1.8.1.4


                 reply	other threads:[~2014-06-12  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402561616-28949-1-git-send-email-guihc.fnst@cn.fujitsu.com \
    --to=guihc.fnst@cn.fujitsu.com \
    --cc=1i5t5.duncan@cox.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.