@@ -300,6 +300,24 @@ struct btrfs_chunk {
/* additional stripes go here */
} __attribute__ ((__packed__));
+struct btrfs_stripe_extent {
+ /* btrfs device-id this raid extent lives on */
+ __le64 devid;
+ /* offset from the devextent start */
+ __le64 offset;
+} __attribute__ ((__packed__));
+
+struct btrfs_dp_stripe {
+ /* logical address for this stripe */
+ __le64 logical;
+ /* size of this stripe in bytes */
+ __le32 size;
+ /* reserved for future use/padding */
+ __le32 reserved;
+ /* array of stripe extents this stripe is comprised of */
+ struct btrfs_stripe_extent extents;
+} __attribute__ ((__packed__));
+
#define BTRFS_FREE_SPACE_EXTENT 1
#define BTRFS_FREE_SPACE_BITMAP 2
@@ -1206,6 +1224,7 @@ struct btrfs_fs_info {
struct btrfs_root *quota_root;
struct btrfs_root *uuid_root;
struct btrfs_root *block_group_root;
+ struct btrfs_root *stripe_root;
struct rb_root global_roots_tree;
struct rb_root fs_root_tree;
@@ -1749,6 +1768,36 @@ 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_dp_stripe */
+BTRFS_SETGET_FUNCS(dp_stripe_logical, struct btrfs_dp_stripe, logical, 64);
+BTRFS_SETGET_FUNCS(dp_stripe_size, struct btrfs_dp_stripe, size, 32);
+BTRFS_SETGET_FUNCS(stripe_extent_devid, struct btrfs_stripe_extent, devid, 64);
+BTRFS_SETGET_FUNCS(stripe_extent_offset, struct btrfs_stripe_extent, offset, 64);
+
+static inline struct btrfs_stripe_extent *btrfs_stripe_extent_nr(
+ struct btrfs_dp_stripe *dps,
+ int nr)
+{
+ unsigned long offset = (unsigned long)dps;
+ offset += offsetof(struct btrfs_dp_stripe, extents);
+ offset += nr * sizeof(struct btrfs_stripe_extent);
+ return (struct btrfs_stripe_extent *)offset;
+}
+
+static inline u64 btrfs_stripe_extent_devid_nr(struct extent_buffer *eb,
+ struct btrfs_dp_stripe *dps,
+ int nr)
+{
+ return btrfs_stripe_extent_devid(eb, btrfs_stripe_extent_nr(dps, nr));
+}
+
+static inline u64 btrfs_stripe_extent_offset_nr(struct extent_buffer *eb,
+ struct btrfs_dp_stripe *dps,
+ int nr)
+{
+ return btrfs_stripe_extent_offset(eb, btrfs_stripe_extent_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);
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- kernel-shared/ctree.h | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)