[01/15] btrfs: fix minimum number of chunk errors for DUP
diff mbox series

Message ID f238d8b46f4645dd8d402007774a8748499e59f8.1558085801.git.dsterba@suse.com
State New
Headers show
Series
  • RAID/volumes code cleanups
Related show

Commit Message

David Sterba May 17, 2019, 9:43 a.m. UTC
The list of profiles in btrfs_chunk_max_errors lists DUP as a profile
DUP able to tolerate 1 device missing. Though this profile is special
with 2 copies, it still needs the device, unlike the others.

Looking at the history of changes, thre's no clear reason why DUP is
there, functions were refactored and blocks of code merged to one
helper.

d20983b40e828 Btrfs: fix writing data into the seed filesystem
  - factor code to a helper

de11cc12df173 Btrfs: don't pre-allocate btrfs bio
  - unrelated change, DUP still in the list with max errors 1

a236aed14ccb0 Btrfs: Deal with failed writes in mirrored configurations
  - introduced the max errors, leaves DUP and RAID1 in the same group

CC: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com
---
 fs/btrfs/volumes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Qu Wenruo May 17, 2019, 2:05 p.m. UTC | #1
On 2019/5/17 下午5:43, David Sterba wrote:
> The list of profiles in btrfs_chunk_max_errors lists DUP as a profile
> DUP able to tolerate 1 device missing. Though this profile is special
> with 2 copies, it still needs the device, unlike the others.
> 
> Looking at the history of changes, thre's no clear reason why DUP is
> there, functions were refactored and blocks of code merged to one
> helper.
> 
> d20983b40e828 Btrfs: fix writing data into the seed filesystem
>   - factor code to a helper
> 
> de11cc12df173 Btrfs: don't pre-allocate btrfs bio
>   - unrelated change, DUP still in the list with max errors 1
> 
> a236aed14ccb0 Btrfs: Deal with failed writes in mirrored configurations
>   - introduced the max errors, leaves DUP and RAID1 in the same group
> 
> CC: Qu Wenruo <wqu@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com

Reviewed-by: Qu Wenruo <wqu@suse.com>

Just some extra hint for the tolerance of DUP profile.

In case of DUP, either all stripes are missing, or all stripes exist.

So no matter whether the tolerance is 0 or 1, it will always work.
But indeed, setting it to 0 is more accurate.

Thanks,
Qu
> ---
>  fs/btrfs/volumes.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 1c2a6e4b39da..8508f6028c8d 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5328,8 +5328,7 @@ static inline int btrfs_chunk_max_errors(struct map_lookup *map)
>  
>  	if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |
>  			 BTRFS_BLOCK_GROUP_RAID10 |
> -			 BTRFS_BLOCK_GROUP_RAID5 |
> -			 BTRFS_BLOCK_GROUP_DUP)) {
> +			 BTRFS_BLOCK_GROUP_RAID5)) {
>  		max_errors = 1;
>  	} else if (map->type & BTRFS_BLOCK_GROUP_RAID6) {
>  		max_errors = 2;
>

Patch
diff mbox series

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1c2a6e4b39da..8508f6028c8d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5328,8 +5328,7 @@  static inline int btrfs_chunk_max_errors(struct map_lookup *map)
 
 	if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |
 			 BTRFS_BLOCK_GROUP_RAID10 |
-			 BTRFS_BLOCK_GROUP_RAID5 |
-			 BTRFS_BLOCK_GROUP_DUP)) {
+			 BTRFS_BLOCK_GROUP_RAID5)) {
 		max_errors = 1;
 	} else if (map->type & BTRFS_BLOCK_GROUP_RAID6) {
 		max_errors = 2;