btrfs-progs: Refactor btrfs_chunk_readonly 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:
Qu Wenruo 2017-06-13 17:19:32 +08:00 committed by David Sterba
parent 37ddab31fd
commit 7a36a1216b
3 changed files with 5 additions and 5 deletions

View File

@ -3286,7 +3286,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
bit = BLOCK_GROUP_METADATA;
}
set_avail_alloc_bits(info, cache->flags);
if (btrfs_chunk_readonly(root, cache->key.objectid))
if (btrfs_chunk_readonly(info, cache->key.objectid))
cache->ro = 1;
account_super_bytes(info, cache);

View File

@ -1636,11 +1636,11 @@ btrfs_find_device_by_devid(struct btrfs_fs_devices *fs_devices,
return NULL;
}
int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset)
{
struct cache_extent *ce;
struct map_lookup *map;
struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
int readonly = 0;
int i;
@ -1649,7 +1649,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
* corresponding chunk, we will rebuild it later
*/
ce = search_cache_extent(&map_tree->cache_tree, chunk_offset);
if (!root->fs_info->is_chunk_recover)
if (!fs_info->is_chunk_recover)
BUG_ON(!ce);
else
return 0;

View File

@ -232,7 +232,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
struct list_head *btrfs_scanned_uuids(void);
int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
struct btrfs_chunk *chunk, int item_size);
int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset);
struct btrfs_device *
btrfs_find_device_by_devid(struct btrfs_fs_devices *fs_devices,
u64 devid, int instance);