Introduce a new strucutre, simple_range, to present one continuous range. Also, use such structure to define btrfs_reserved_ranges(), which convert and rollback will use.
Suggested-by: David Sterba <dste...@suse.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- convert/common.h | 27 +++++++++++++++++++++++++++ convert/main.c | 1 + 2 files changed, 28 insertions(+) diff --git a/convert/common.h b/convert/common.h index 0d3adeaa..28ca1461 100644 --- a/convert/common.h +++ b/convert/common.h @@ -26,6 +26,33 @@ #include "common-defs.h" #include "extent-cache.h" +/* + * Presents one simple continuous range. + * + * For multiple or non-continuous ranges, use extent_cache_tree from + * extent-cache.c + */ +struct simple_range { + u64 start; + u64 len; +}; + +const static struct simple_range btrfs_reserved_ranges[] = { + {0, SZ_1M}, + {BTRFS_SB_MIRROR_OFFSET(1), SZ_64K}, + {BTRFS_SB_MIRROR_OFFSET(2), SZ_64K} +}; + +/* + * Simple range functions + * + * Get range end (exclusive) + */ +static inline u64 range_end(const struct simple_range *range) +{ + return (range->start + range->len); +} + struct btrfs_mkfs_config; struct btrfs_convert_context { diff --git a/convert/main.c b/convert/main.c index 079c1ebd..41309645 100644 --- a/convert/main.c +++ b/convert/main.c @@ -81,6 +81,7 @@ #include <fcntl.h> #include <unistd.h> #include <getopt.h> +#include <stdbool.h> #include "ctree.h" #include "disk-io.h" -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html