@@ -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 {
@@ -81,6 +81,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <getopt.h>
+#include <stdbool.h>
#include "ctree.h"
#include "disk-io.h"
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 <dsterba@suse.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- convert/common.h | 27 +++++++++++++++++++++++++++ convert/main.c | 1 + 2 files changed, 28 insertions(+)