@@ -86,6 +86,7 @@
#include <uuid/uuid.h>
#include <linux/limits.h>
#include <getopt.h>
+#include <stdbool.h>
#include "ctree.h"
#include "disk-io.h"
@@ -118,6 +119,33 @@
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
+/*
+ * 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;
+};
+
+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(struct simple_range *range)
+{
+ return (range->start + range->len);
+}
+
struct task_ctx {
uint32_t max_copy_inodes;
uint32_t cur_copy_inodes;
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/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)