All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [RFC ONLY 1/6] btrfs-progs: add raid-stripe-tree definitions
Date: Wed, 18 May 2022 02:17:11 -0700	[thread overview]
Message-ID: <20220518091716.786452-2-johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <20220518091716.786452-1-johannes.thumshirn@wdc.com>

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 kernel-shared/ctree.h | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 68943ff294cc..56b3185001af 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -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);
-- 
2.35.3


  reply	other threads:[~2022-05-18  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:17 [RFC ONLY 0/6] btrfs-progs: raid-stripe-tree support for progs Johannes Thumshirn
2022-05-18  9:17 ` Johannes Thumshirn [this message]
2022-05-18  9:17 ` [RFC ONLY 2/6] btrfs-progs: read fs with stripe tree from disk Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 3/6] btrfs-progs: add dump tree support for the raid stripe tree Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 4/6] btrfs-progs: allow zoned RAID1 Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 5/6] btrfs-progs: add raid-stripe-tree to mkfs runtime features Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 6/6] btrfs-progs: load zone info for all zoned devices Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518091716.786452-2-johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.