btrfs-progs: Refactor btrfs_check_chunk_valid to use btrfs_fs_info
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a0d9de4e40
commit
505639ee62
|
@ -6626,7 +6626,7 @@ static int process_chunk_item(struct cache_tree *chunk_cache,
|
|||
* wrong onwer(3) out of chunk tree, to pass both chunk tree check
|
||||
* and owner<->key_type check.
|
||||
*/
|
||||
ret = btrfs_check_chunk_valid(global_info->tree_root, eb, chunk, slot,
|
||||
ret = btrfs_check_chunk_valid(global_info, eb, chunk, slot,
|
||||
key->offset);
|
||||
if (ret < 0) {
|
||||
error("chunk(%llu, %llu) is not valid, ignore it",
|
||||
|
@ -10927,7 +10927,7 @@ static int check_dev_extent_item(struct btrfs_fs_info *fs_info,
|
|||
|
||||
l = path.nodes[0];
|
||||
chunk = btrfs_item_ptr(l, path.slots[0], struct btrfs_chunk);
|
||||
ret = btrfs_check_chunk_valid(chunk_root, l, chunk, path.slots[0],
|
||||
ret = btrfs_check_chunk_valid(fs_info, l, chunk, path.slots[0],
|
||||
chunk_key.offset);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
@ -11185,7 +11185,7 @@ static int check_chunk_item(struct btrfs_fs_info *fs_info,
|
|||
chunk = btrfs_item_ptr(eb, slot, struct btrfs_chunk);
|
||||
length = btrfs_chunk_length(eb, chunk);
|
||||
chunk_end = chunk_key.offset + length;
|
||||
ret = btrfs_check_chunk_valid(extent_root, eb, chunk, slot,
|
||||
ret = btrfs_check_chunk_valid(fs_info, eb, chunk, slot,
|
||||
chunk_key.offset);
|
||||
if (ret < 0) {
|
||||
error("chunk[%llu %llu) is invalid", chunk_key.offset,
|
||||
|
|
|
@ -1680,7 +1680,7 @@ static struct btrfs_device *fill_missing_device(u64 devid)
|
|||
* slot == -1: SYSTEM chunk
|
||||
* return -EIO on error, otherwise return 0
|
||||
*/
|
||||
int btrfs_check_chunk_valid(struct btrfs_root *root,
|
||||
int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info,
|
||||
struct extent_buffer *leaf,
|
||||
struct btrfs_chunk *chunk,
|
||||
int slot, u64 logical)
|
||||
|
@ -1691,7 +1691,7 @@ int btrfs_check_chunk_valid(struct btrfs_root *root,
|
|||
u16 sub_stripes;
|
||||
u64 type;
|
||||
u32 chunk_ondisk_size;
|
||||
u32 sectorsize = root->fs_info->sectorsize;
|
||||
u32 sectorsize = fs_info->sectorsize;
|
||||
|
||||
length = btrfs_chunk_length(leaf, chunk);
|
||||
stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
|
||||
|
@ -1787,7 +1787,8 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
|
|||
struct extent_buffer *leaf,
|
||||
struct btrfs_chunk *chunk, int slot)
|
||||
{
|
||||
struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
|
||||
struct map_lookup *map;
|
||||
struct cache_extent *ce;
|
||||
u64 logical;
|
||||
|
@ -1802,7 +1803,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
|
|||
length = btrfs_chunk_length(leaf, chunk);
|
||||
num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
|
||||
/* Validation check */
|
||||
ret = btrfs_check_chunk_valid(root, leaf, chunk, slot, logical);
|
||||
ret = btrfs_check_chunk_valid(fs_info, leaf, chunk, slot, logical);
|
||||
if (ret) {
|
||||
error("%s checksums match, but it has an invalid chunk, %s",
|
||||
(slot == -1) ? "Superblock" : "Metadata",
|
||||
|
|
|
@ -242,7 +242,7 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
|
|||
struct extent_buffer *eb,
|
||||
struct btrfs_multi_bio *multi,
|
||||
u64 stripe_len, u64 *raid_map);
|
||||
int btrfs_check_chunk_valid(struct btrfs_root *root,
|
||||
int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info,
|
||||
struct extent_buffer *leaf,
|
||||
struct btrfs_chunk *chunk,
|
||||
int slot, u64 logical);
|
||||
|
|
Loading…
Reference in New Issue