From: Boris Burkov <boris@bur.io>
To: Mark Harmstone <mark@harmstone.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 01/16] btrfs: add definitions and constants for remap-tree
Date: Mon, 18 Aug 2025 10:33:43 -0700 [thread overview]
Message-ID: <20250818173343.GA243660@zen.localdomain> (raw)
In-Reply-To: <fa39bbb2-eb85-4f46-a57d-99ae55b8abe6@harmstone.com>
On Mon, Aug 18, 2025 at 06:21:24PM +0100, Mark Harmstone wrote:
> Thanks Boris.
>
> The funny indentation is artefact of diff: the plus sign at the beginning
> throws off the tabstop in your e-mail client. If you do `git am` it looks
> fine.
>
Oh yeah, that makes sense, thanks.
> On 16/08/2025 12.51 am, Boris Burkov wrote:
> > On Wed, Aug 13, 2025 at 03:34:43PM +0100, Mark Harmstone wrote:
> > > Add an incompat flag for the new remap-tree feature, and the constants
> > > and definitions needed to support it.
> > >
> > > Signed-off-by: Mark Harmstone <mark@harmstone.com>
> >
> > Some formatting nits, but you can add
> >
> > Reviewed-by: Boris Burkov <boris@bur.io>
> >
> > > ---
> > > fs/btrfs/accessors.h | 3 +++
> > > fs/btrfs/locking.c | 1 +
> > > fs/btrfs/sysfs.c | 2 ++
> > > fs/btrfs/tree-checker.c | 6 ++----
> > > fs/btrfs/tree-checker.h | 5 +++++
> > > fs/btrfs/volumes.c | 1 +
> > > include/uapi/linux/btrfs.h | 1 +
> > > include/uapi/linux/btrfs_tree.h | 12 ++++++++++++
> > > 8 files changed, 27 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/fs/btrfs/accessors.h b/fs/btrfs/accessors.h
> > > index 99b3ced12805..95a1ca8c099b 100644
> > > --- a/fs/btrfs/accessors.h
> > > +++ b/fs/btrfs/accessors.h
> > > @@ -1009,6 +1009,9 @@ BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
> > > BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
> > > struct btrfs_verity_descriptor_item, size, 64);
> > > +BTRFS_SETGET_FUNCS(remap_address, struct btrfs_remap, address, 64);
> > > +BTRFS_SETGET_STACK_FUNCS(stack_remap_address, struct btrfs_remap, address, 64);
> > > +
> > > /* Cast into the data area of the leaf. */
> > > #define btrfs_item_ptr(leaf, slot, type) \
> > > ((type *)(btrfs_item_nr_offset(leaf, 0) + btrfs_item_offset(leaf, slot)))
> > > diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
> > > index a3e6d9616e60..26f810258486 100644
> > > --- a/fs/btrfs/locking.c
> > > +++ b/fs/btrfs/locking.c
> > > @@ -73,6 +73,7 @@ static struct btrfs_lockdep_keyset {
> > > { .id = BTRFS_FREE_SPACE_TREE_OBJECTID, DEFINE_NAME("free-space") },
> > > { .id = BTRFS_BLOCK_GROUP_TREE_OBJECTID, DEFINE_NAME("block-group") },
> > > { .id = BTRFS_RAID_STRIPE_TREE_OBJECTID, DEFINE_NAME("raid-stripe") },
> > > + { .id = BTRFS_REMAP_TREE_OBJECTID, DEFINE_NAME("remap-tree") },
> > > { .id = 0, DEFINE_NAME("tree") },
> > > };
> > > diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> > > index 81f52c1f55ce..857d2772db1c 100644
> > > --- a/fs/btrfs/sysfs.c
> > > +++ b/fs/btrfs/sysfs.c
> > > @@ -291,6 +291,7 @@ BTRFS_FEAT_ATTR_COMPAT_RO(free_space_tree, FREE_SPACE_TREE);
> > > BTRFS_FEAT_ATTR_COMPAT_RO(block_group_tree, BLOCK_GROUP_TREE);
> > > BTRFS_FEAT_ATTR_INCOMPAT(raid1c34, RAID1C34);
> > > BTRFS_FEAT_ATTR_INCOMPAT(simple_quota, SIMPLE_QUOTA);
> > > +BTRFS_FEAT_ATTR_INCOMPAT(remap_tree, REMAP_TREE);
> > > #ifdef CONFIG_BLK_DEV_ZONED
> > > BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED);
> > > #endif
> > > @@ -325,6 +326,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
> > > BTRFS_FEAT_ATTR_PTR(raid1c34),
> > > BTRFS_FEAT_ATTR_PTR(block_group_tree),
> > > BTRFS_FEAT_ATTR_PTR(simple_quota),
> > > + BTRFS_FEAT_ATTR_PTR(remap_tree),
> > > #ifdef CONFIG_BLK_DEV_ZONED
> > > BTRFS_FEAT_ATTR_PTR(zoned),
> > > #endif
> > > diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> > > index 0f556f4de3f9..76ec3698f197 100644
> > > --- a/fs/btrfs/tree-checker.c
> > > +++ b/fs/btrfs/tree-checker.c
> > > @@ -912,12 +912,10 @@ int btrfs_check_chunk_valid(const struct btrfs_fs_info *fs_info,
> > > length, btrfs_stripe_nr_to_offset(U32_MAX));
> > > return -EUCLEAN;
> > > }
> > > - if (unlikely(type & ~(BTRFS_BLOCK_GROUP_TYPE_MASK |
> > > - BTRFS_BLOCK_GROUP_PROFILE_MASK))) {
> > > + if (unlikely(type & ~BTRFS_BLOCK_GROUP_VALID)) {
> > > chunk_err(fs_info, leaf, chunk, logical,
> > > "unrecognized chunk type: 0x%llx",
> > > - ~(BTRFS_BLOCK_GROUP_TYPE_MASK |
> > > - BTRFS_BLOCK_GROUP_PROFILE_MASK) & type);
> > > + type & ~BTRFS_BLOCK_GROUP_VALID);
> > > return -EUCLEAN;
> > > }
> > > diff --git a/fs/btrfs/tree-checker.h b/fs/btrfs/tree-checker.h
> > > index eb201f4ec3c7..833e2fd989eb 100644
> > > --- a/fs/btrfs/tree-checker.h
> > > +++ b/fs/btrfs/tree-checker.h
> > > @@ -57,6 +57,11 @@ enum btrfs_tree_block_status {
> > > BTRFS_TREE_BLOCK_WRITTEN_NOT_SET,
> > > };
> > > +
> > > +#define BTRFS_BLOCK_GROUP_VALID (BTRFS_BLOCK_GROUP_TYPE_MASK | \
> > > + BTRFS_BLOCK_GROUP_PROFILE_MASK | \
> > > + BTRFS_BLOCK_GROUP_REMAPPED)
> > > +
> >
> > I think the two next lines should be lined up after the '('
> >
> > See the masks in include/uapi/linux/btrfs_tree.h
> >
> > > /*
> > > * Exported simply for btrfs-progs which wants to have the
> > > * btrfs_tree_block_status return codes.
> > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > > index fa7a929a0461..e067e9cd68a5 100644
> > > --- a/fs/btrfs/volumes.c
> > > +++ b/fs/btrfs/volumes.c
> > > @@ -231,6 +231,7 @@ void btrfs_describe_block_groups(u64 bg_flags, char *buf, u32 size_buf)
> > > DESCRIBE_FLAG(BTRFS_BLOCK_GROUP_DATA, "data");
> > > DESCRIBE_FLAG(BTRFS_BLOCK_GROUP_SYSTEM, "system");
> > > DESCRIBE_FLAG(BTRFS_BLOCK_GROUP_METADATA, "metadata");
> > > + DESCRIBE_FLAG(BTRFS_BLOCK_GROUP_REMAPPED, "remapped");
> > > DESCRIBE_FLAG(BTRFS_AVAIL_ALLOC_BIT_SINGLE, "single");
> > > for (i = 0; i < BTRFS_NR_RAID_TYPES; i++)
> > > diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
> > > index 8e710bbb688e..fba303ed49e6 100644
> > > --- a/include/uapi/linux/btrfs.h
> > > +++ b/include/uapi/linux/btrfs.h
> > > @@ -336,6 +336,7 @@ struct btrfs_ioctl_fs_info_args {
> > > #define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)
> > > #define BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE (1ULL << 14)
> > > #define BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA (1ULL << 16)
> > > +#define BTRFS_FEATURE_INCOMPAT_REMAP_TREE (1ULL << 17)
> > > struct btrfs_ioctl_feature_flags {
> > > __u64 compat_flags;
> > > diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
> > > index fc29d273845d..4439d77a7252 100644
> > > --- a/include/uapi/linux/btrfs_tree.h
> > > +++ b/include/uapi/linux/btrfs_tree.h
> > > @@ -76,6 +76,9 @@
> > > /* Tracks RAID stripes in block groups. */
> > > #define BTRFS_RAID_STRIPE_TREE_OBJECTID 12ULL
> > > +/* Holds details of remapped addresses after relocation. */
> > > +#define BTRFS_REMAP_TREE_OBJECTID 13ULL
> > > +
> > > /* device stats in the device tree */
> > > #define BTRFS_DEV_STATS_OBJECTID 0ULL
> > > @@ -282,6 +285,10 @@
> > > #define BTRFS_RAID_STRIPE_KEY 230
> > > +#define BTRFS_IDENTITY_REMAP_KEY 234
> > > +#define BTRFS_REMAP_KEY 235
> > > +#define BTRFS_REMAP_BACKREF_KEY 236
> >
> > more funny indenting
> >
> > > +
> > > /*
> > > * Records the overall state of the qgroups.
> > > * There's only one instance of this key present,
> > > @@ -1161,6 +1168,7 @@ struct btrfs_dev_replace_item {
> > > #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
> > > #define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
> > > #define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
> > > +#define BTRFS_BLOCK_GROUP_REMAPPED (1ULL << 11)
> > > #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \
> > > BTRFS_SPACE_INFO_GLOBAL_RSV)
> > > @@ -1323,4 +1331,8 @@ struct btrfs_verity_descriptor_item {
> > > __u8 encryption;
> > > } __attribute__ ((__packed__));
> > > +struct btrfs_remap {
> > > + __le64 address;
> > > +} __attribute__ ((__packed__));
> > > +
> > > #endif /* _BTRFS_CTREE_H_ */
> > > --
> > > 2.49.1
> > >
>
next prev parent reply other threads:[~2025-08-18 17:33 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 14:34 [PATCH v2 00/16] btrfs: remap tree Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 01/16] btrfs: add definitions and constants for remap-tree Mark Harmstone
2025-08-15 23:51 ` Boris Burkov
2025-08-18 17:21 ` Mark Harmstone
2025-08-18 17:33 ` Boris Burkov [this message]
2025-08-16 0:01 ` Qu Wenruo
2025-08-16 0:17 ` Qu Wenruo
2025-08-18 17:23 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 02/16] btrfs: add REMAP chunk type Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 03/16] btrfs: allow remapped chunks to have zero stripes Mark Harmstone
2025-08-16 0:03 ` Boris Burkov
2025-08-22 17:01 ` Mark Harmstone
2025-08-19 1:05 ` kernel test robot
2025-08-22 17:07 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 04/16] btrfs: remove remapped block groups from the free-space tree Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 05/16] btrfs: don't add metadata items for the remap tree to the extent tree Mark Harmstone
2025-08-16 0:06 ` Boris Burkov
2025-08-13 14:34 ` [PATCH v2 06/16] btrfs: add extended version of struct block_group_item Mark Harmstone
2025-08-16 0:08 ` Boris Burkov
2025-08-13 14:34 ` [PATCH v2 07/16] btrfs: allow mounting filesystems with remap-tree incompat flag Mark Harmstone
2025-08-22 19:14 ` Boris Burkov
2025-08-13 14:34 ` [PATCH v2 08/16] btrfs: redirect I/O for remapped block groups Mark Harmstone
2025-08-22 19:42 ` Boris Burkov
2025-08-27 14:08 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 09/16] btrfs: release BG lock before calling btrfs_link_bg_list() Mark Harmstone
2025-08-16 0:32 ` Boris Burkov
2025-08-27 15:35 ` Mark Harmstone
2025-08-27 15:48 ` Filipe Manana
2025-08-27 15:52 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 10/16] btrfs: handle deletions from remapped block group Mark Harmstone
2025-08-16 0:28 ` Boris Burkov
2025-08-27 17:11 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 11/16] btrfs: handle setting up relocation of block group with remap-tree Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 12/16] btrfs: move existing remaps before relocating block group Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 13/16] btrfs: replace identity maps with actual remaps when doing relocations Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 14/16] btrfs: add do_remap param to btrfs_discard_extent() Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 15/16] btrfs: add fully_remapped_bgs list Mark Harmstone
2025-08-16 0:56 ` Boris Burkov
2025-08-27 18:51 ` Mark Harmstone
2025-08-13 14:34 ` [PATCH v2 16/16] btrfs: allow balancing remap tree Mark Harmstone
2025-08-16 1:02 ` Boris Burkov
2025-09-02 14:58 ` Mark Harmstone
2025-09-02 15:21 ` Mark Harmstone
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=20250818173343.GA243660@zen.localdomain \
--to=boris@bur.io \
--cc=linux-btrfs@vger.kernel.org \
--cc=mark@harmstone.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox