Skip to content

Commit

Permalink
btrfs: use raid_attr in btrfs_chunk_max_errors
Browse files Browse the repository at this point in the history
The number of tolerated failures is stored in the raid_attr table, use
it.

Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Jul 1, 2019
1 parent 9fa02ac commit fc9a2ac
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5325,19 +5325,9 @@ static noinline int init_first_rw_device(struct btrfs_trans_handle *trans)

static inline int btrfs_chunk_max_errors(struct map_lookup *map)
{
int max_errors;

if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |
BTRFS_BLOCK_GROUP_RAID10 |
BTRFS_BLOCK_GROUP_RAID5)) {
max_errors = 1;
} else if (map->type & BTRFS_BLOCK_GROUP_RAID6) {
max_errors = 2;
} else {
max_errors = 0;
}
const int index = btrfs_bg_flags_to_raid_index(map->type);

return max_errors;
return btrfs_raid_array[index].tolerated_failures;
}

int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset)
Expand Down

0 comments on commit fc9a2ac

Please sign in to comment.