@@ -292,6 +292,18 @@ struct btrfs_chunk {
/* additional stripes go here */
} __attribute__ ((__packed__));
+struct btrfs_raid_stride {
+ /* btrfs device-id this raid extent lives on */
+ __le64 devid;
+ /* offset from the devextent start */
+ __le64 offset;
+} __attribute__ ((__packed__));
+
+struct btrfs_stripe_extent {
+ /* array of raid strides this stripe is comprised of */
+ struct btrfs_raid_stride strides;
+} __attribute__ ((__packed__));
+
#define BTRFS_FREE_SPACE_EXTENT 1
#define BTRFS_FREE_SPACE_BITMAP 2
@@ -515,6 +527,7 @@ BUILD_ASSERT(sizeof(struct btrfs_super_block) == BTRFS_SUPER_INFO_SIZE);
#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
#define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)
+#define BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE (1ULL << 14)
#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
@@ -1761,6 +1774,34 @@ BTRFS_SETGET_FUNCS(free_space_extent_count, struct btrfs_free_space_info,
extent_count, 32);
BTRFS_SETGET_FUNCS(free_space_flags, struct btrfs_free_space_info, flags, 32);
+/* struct btrfs_stripe_extent */
+BTRFS_SETGET_FUNCS(raid_stride_devid, struct btrfs_raid_stride, devid, 64);
+BTRFS_SETGET_FUNCS(raid_stride_offset, struct btrfs_raid_stride, offset, 64);
+
+static inline struct btrfs_raid_stride *btrfs_raid_stride_nr(
+ struct btrfs_stripe_extent *dps,
+ int nr)
+{
+ unsigned long offset = (unsigned long)dps;
+ offset += offsetof(struct btrfs_stripe_extent, strides);
+ offset += nr * sizeof(struct btrfs_raid_stride);
+ return (struct btrfs_raid_stride *)offset;
+}
+
+static inline u64 btrfs_raid_stride_devid_nr(struct extent_buffer *eb,
+ struct btrfs_stripe_extent *dps,
+ int nr)
+{
+ return btrfs_raid_stride_devid(eb, btrfs_raid_stride_nr(dps, nr));
+}
+
+static inline u64 btrfs_raid_stride_offset_nr(struct extent_buffer *eb,
+ struct btrfs_stripe_extent *dps,
+ int nr)
+{
+ return btrfs_raid_stride_offset(eb, btrfs_raid_stride_nr(dps, nr));
+}
+
/* struct btrfs_inode_ref */
BTRFS_SETGET_FUNCS(inode_ref_name_len, struct btrfs_inode_ref, name_len, 16);
BTRFS_SETGET_STACK_FUNCS(stack_inode_ref_name_len, struct btrfs_inode_ref, name_len, 16);
@@ -1691,6 +1691,7 @@ static struct readable_flag_entry incompat_flags_array[] = {
DEF_INCOMPAT_FLAG_ENTRY(RAID1C34),
DEF_INCOMPAT_FLAG_ENTRY(ZONED),
DEF_INCOMPAT_FLAG_ENTRY(EXTENT_TREE_V2),
+ DEF_INCOMPAT_FLAG_ENTRY(RAID_STRIPE_TREE),
};
static const int incompat_flags_num = sizeof(incompat_flags_array) /
sizeof(struct readable_flag_entry);
Add the definitions for the on-disk format of the RAID stripe tree. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- kernel-shared/ctree.h | 41 ++++++++++++++++++++++++++++++++++++++ kernel-shared/print-tree.c | 1 + 2 files changed, 42 insertions(+)