mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-12 08:49:33 +00:00
btrfs-progs: Refactor btrfs_add_system_chunk 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
5b4c9ccce9
commit
37ddab31fd
@ -1287,13 +1287,14 @@ static int rebuild_chunk_tree(struct btrfs_trans_handle *trans,
|
||||
static int rebuild_sys_array(struct recover_control *rc,
|
||||
struct btrfs_root *root)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct btrfs_chunk *chunk;
|
||||
struct btrfs_key key;
|
||||
struct chunk_record *chunk_rec;
|
||||
int ret = 0;
|
||||
u16 num_stripes;
|
||||
|
||||
btrfs_set_super_sys_array_size(root->fs_info->super_copy, 0);
|
||||
btrfs_set_super_sys_array_size(fs_info->super_copy, 0);
|
||||
|
||||
list_for_each_entry(chunk_rec, &rc->good_chunks, list) {
|
||||
if (!(chunk_rec->type_flags & BTRFS_BLOCK_GROUP_SYSTEM))
|
||||
@ -1310,7 +1311,7 @@ static int rebuild_sys_array(struct recover_control *rc,
|
||||
key.type = BTRFS_CHUNK_ITEM_KEY;
|
||||
key.offset = chunk_rec->offset;
|
||||
|
||||
ret = btrfs_add_system_chunk(root, &key, chunk,
|
||||
ret = btrfs_add_system_chunk(fs_info, &key, chunk,
|
||||
btrfs_chunk_item_size(num_stripes));
|
||||
free(chunk);
|
||||
if (ret)
|
||||
|
@ -690,11 +690,10 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int btrfs_add_system_chunk(struct btrfs_root *root,
|
||||
struct btrfs_key *key,
|
||||
int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
|
||||
struct btrfs_chunk *chunk, int item_size)
|
||||
{
|
||||
struct btrfs_super_block *super_copy = root->fs_info->super_copy;
|
||||
struct btrfs_super_block *super_copy = fs_info->super_copy;
|
||||
struct btrfs_disk_key disk_key;
|
||||
u32 array_size;
|
||||
u8 *ptr;
|
||||
@ -1083,7 +1082,7 @@ again:
|
||||
BUG_ON(ret);
|
||||
|
||||
if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
|
||||
ret = btrfs_add_system_chunk(chunk_root, &key,
|
||||
ret = btrfs_add_system_chunk(info, &key,
|
||||
chunk, btrfs_chunk_item_size(num_stripes));
|
||||
BUG_ON(ret);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ int btrfs_scan_one_device(int fd, const char *path,
|
||||
u64 *total_devs, u64 super_offset, unsigned sbflags);
|
||||
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_root *root, struct btrfs_key *key,
|
||||
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);
|
||||
struct btrfs_device *
|
||||
|
Loading…
Reference in New Issue
Block a user