btrfs-progs: Cleanup old btrfs-convert

Cleanup all the old btrfs-convert facilities, including:
1) btrfs_convert_operations->alloc/free/test_extents*
   No need to do non-standard extent allocation.
   After init_btrfs() everything can be done by normal routine.

   Now only 4 functions are needed in btrfs_convert_operations.
   1) open_fs
   2) read_used_space
   3) copy_inodes
   4) close_fs

2) fs_info->extent_ops
   Same as above.

3) Old init_btrfs(), create_image(), create_file_image_range()
   Replaced with newer and cleaner one.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2016-01-29 13:03:32 +08:00 committed by David Sterba
parent 561f773433
commit cfdcb4fa61
3 changed files with 9 additions and 1355 deletions

File diff suppressed because it is too large Load Diff

View File

@ -960,13 +960,6 @@ struct btrfs_block_group_cache {
int ro;
};
struct btrfs_extent_ops {
int (*alloc_extent)(struct btrfs_root *root, u64 num_bytes,
u64 hint_byte, struct btrfs_key *ins, int metadata);
int (*free_extent)(struct btrfs_root *root, u64 bytenr,
u64 num_bytes);
};
struct btrfs_device;
struct btrfs_fs_devices;
struct btrfs_fs_info {
@ -1017,7 +1010,6 @@ struct btrfs_fs_info {
u64 super_bytenr;
u64 total_pinned;
struct btrfs_extent_ops *extent_ops;
struct list_head dirty_cowonly_roots;
struct list_head recow_ebs;

View File

@ -2181,7 +2181,6 @@ static int __free_extent(struct btrfs_trans_handle *trans,
struct btrfs_key key;
struct btrfs_path *path;
struct btrfs_extent_ops *ops = root->fs_info->extent_ops;
struct btrfs_root *extent_root = root->fs_info->extent_root;
struct extent_buffer *leaf;
struct btrfs_extent_item *ei;
@ -2382,14 +2381,6 @@ static int __free_extent(struct btrfs_trans_handle *trans,
}
}
if (ops && ops->free_extent) {
ret = ops->free_extent(root, bytenr, num_bytes);
if (ret > 0) {
pin = 0;
mark_free = 0;
}
}
if (pin) {
ret = pin_down_bytes(trans, root, bytenr, num_bytes,
is_data);
@ -2662,13 +2653,6 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
u64 alloc_profile;
struct btrfs_fs_info *info = root->fs_info;
if (info->extent_ops) {
struct btrfs_extent_ops *ops = info->extent_ops;
ret = ops->alloc_extent(root, num_bytes, hint_byte, ins, !data);
BUG_ON(ret);
goto found;
}
if (data) {
alloc_profile = info->avail_data_alloc_bits &
info->data_alloc_profile;
@ -2702,7 +2686,6 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
trans->alloc_exclude_start,
trans->alloc_exclude_nr, data);
BUG_ON(ret);
found:
clear_extent_dirty(&root->fs_info->free_space_cache,
ins->objectid, ins->objectid + ins->offset - 1,
GFP_NOFS);