All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Fix a bug in chunk item extra check and allow degraded chunk.
@ 2015-05-15  5:11 Qu Wenruo
  2015-05-20 12:27 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2015-05-15  5:11 UTC (permalink / raw
  To: linux-btrfs; +Cc: dsterba

For DUP profile, the num_stripes should be 2 not 1.
This causes btrfs offline tool fails on valid image.

Also, num_stripes check is too restrict for btrfsck self test,
as there is some image in degraded mode, so modify it to allow degraded
chunk.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 volumes.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/volumes.c b/volumes.c
index 77cc305..14ce33e 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1649,12 +1649,11 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
 	/*
 	 * Device number check against profile
 	 */
-	if ((map->type & BTRFS_BLOCK_GROUP_RAID10 && num_stripes < 4 &&
-	     map->sub_stripes < 2) ||
-	    (map->type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 2) ||
-	    (map->type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 3) ||
-	    (map->type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 4) ||
-	    (map->type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 1) ||
+	if ((map->type & BTRFS_BLOCK_GROUP_RAID10 && map->sub_stripes == 0) ||
+	    (map->type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 1) ||
+	    (map->type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 2) ||
+	    (map->type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) ||
+	    (map->type & BTRFS_BLOCK_GROUP_DUP && num_stripes > 2) ||
 	    ((map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 &&
 	     num_stripes != 1)) {
 		fprintf(stderr,
-- 
2.4.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: Fix a bug in chunk item extra check and allow degraded chunk.
  2015-05-15  5:11 [PATCH] btrfs-progs: Fix a bug in chunk item extra check and allow degraded chunk Qu Wenruo
@ 2015-05-20 12:27 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2015-05-20 12:27 UTC (permalink / raw
  To: Qu Wenruo; +Cc: linux-btrfs, dsterba

On Fri, May 15, 2015 at 01:11:14PM +0800, Qu Wenruo wrote:
> For DUP profile, the num_stripes should be 2 not 1.
> This causes btrfs offline tool fails on valid image.
> 
> Also, num_stripes check is too restrict for btrfsck self test,
> as there is some image in degraded mode, so modify it to allow degraded
> chunk.
> 
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Applied, thanks. There relase of 4.0.1 is on the way.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-20 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15  5:11 [PATCH] btrfs-progs: Fix a bug in chunk item extra check and allow degraded chunk Qu Wenruo
2015-05-20 12:27 ` David Sterba

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.