btrfs-progs: convert: Introduce simple range structure for convert reserved ranges
Introduce a new strucutre, simple_range, to present one contingous range. Also, use such structure to define btrfs_reserved_ranges(), which convert and rollback will use. Suggested-by: David Sterba <dsterba@suse.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ split hunks to new file structure ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0117fdf1fc
commit
714cda6136
|
@ -22,6 +22,12 @@
|
|||
#include "convert/common.h"
|
||||
#include "convert/source-fs.h"
|
||||
|
||||
struct simple_range btrfs_reserved_ranges[3] = {
|
||||
{ 0, SZ_1M },
|
||||
{ BTRFS_SB_MIRROR_OFFSET(1), SZ_64K },
|
||||
{ BTRFS_SB_MIRROR_OFFSET(2), SZ_64K }
|
||||
};
|
||||
|
||||
static int intersect_with_sb(u64 bytenr, u64 num_bytes)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -21,6 +21,19 @@
|
|||
|
||||
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
|
||||
|
||||
/*
|
||||
* Reresents 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 struct simple_range btrfs_reserved_ranges[3];
|
||||
|
||||
struct task_info;
|
||||
|
||||
struct task_ctx {
|
||||
|
@ -89,4 +102,14 @@ 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(struct simple_range *range)
|
||||
{
|
||||
return (range->start + range->len);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue