btrfs-progs: convert: move simple_range into common.h

This is currently defined in source-fs.h, but main.c uses it far more
than source-fs.c does. Put it in common.h instead, since it's a useful
standalone type.

Author: Thomas Hebb <tommyhebb@gmail.com>
Pull-request: #494
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Thomas Hebb 2022-06-26 16:52:42 -07:00 committed by David Sterba
parent 163aa3cc62
commit 2f43f2dc7b
2 changed files with 21 additions and 21 deletions

View file

@ -63,4 +63,25 @@ struct btrfs_convert_context {
int make_convert_btrfs(int fd, struct btrfs_mkfs_config *cfg,
struct btrfs_convert_context *cctx);
/*
* Represents a simple contiguous range.
*
* For multiple or non-contiguous ranges, use extent_cache_tree from
* extent-cache.c
*/
struct simple_range {
u64 start;
u64 len;
};
/*
* Simple range functions
*/
/* Get range end (exclusive) */
static inline u64 range_end(const struct simple_range *range)
{
return (range->start + range->len);
}
#endif

View file

@ -29,17 +29,6 @@ struct task_info;
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
/*
* Represents a simple contiguous range.
*
* For multiple or non-contiguous ranges, use extent_cache_tree from
* extent-cache.c
*/
struct simple_range {
u64 start;
u64 len;
};
extern const struct simple_range btrfs_reserved_ranges[3];
struct task_ctx {
@ -160,14 +149,4 @@ int read_disk_extent(struct btrfs_root *root, u64 bytenr,
int record_file_blocks(struct blk_iterate_data *data,
u64 file_block, u64 disk_block, u64 num_blocks);
/*
* Simple range functions
*
* Get range end (exclusive)
*/
static inline u64 range_end(const struct simple_range *range)
{
return (range->start + range->len);
}
#endif