From: Mark Harmstone <mark@harmstone.com>
To: linux-btrfs@vger.kernel.org
Cc: Mark Harmstone <mark@harmstone.com>
Subject: [PATCH v3 00/17] Remap tree
Date: Thu, 9 Oct 2025 12:27:55 +0100 [thread overview]
Message-ID: <20251009112814.13942-1-mark@harmstone.com> (raw)
This is version 3 of the patch series for the new logical remapping tree
feature - see the previous cover letters for more information including
the rationale:
* RFC: https://lore.kernel.org/all/20250515163641.3449017-1-maharmstone@fb.com/
* Version 1: https://lore.kernel.org/all/20250605162345.2561026-1-maharmstone@fb.com/
* Version 2: https://lore.kernel.org/all/20250813143509.31073-1-mark@harmstone.com/
Changes since version 2:
* Addressed the points that Boris mentioned in his reviews
* Moved fully_remapped_bgs list from the transaction to fs_info
* Chunk sub_stripes now set to 0 when num_stripes is
* Fixed crash with RAID0
* Made it so changing a block group's flags feeds through to the
block_group_item on commit
* Added discarding of fully-remapped block groups
For async discard, we set a new flag on the block group item,
BTRFS_BLOCK_GROUP_STRIPE_REMOVAL_PENDING, in the transaction in which
the last identity remap is removed. We then queue up async discard of
the whole of the range in the usual way. Once the block group has been
fully discarded, we remove the device extents, remove the chunk stripes,
and clear the STRIPE_REMOVAL_PENDING flag.
If we encounter a block group with this flag set when we walk the block
group tree on mount, we queue it up for discard again - that way it's
not possible for the discard of a block group to be missed.
For sync discard we don't set this flag, discard happens at the same
time as the transaction commit. But if we encounter it on mount we still
queue the BG up for discard, it just happens on the commit of the first
transaction after mount.
If you are trying the btrfs-progs patches I linked to in the other cover
letters, bear in mind that btrfs-check doesn't like the fact that
BTRFS_BLOCK_GROUP_STRIPE_REMOVAL_PENDING gets set on the block group
item but not the chunk item. There didn't seem much point in setting it
on both, but I can change this if anybody has strong feelings on the
matter.
Mark Harmstone (17):
btrfs: add definitions and constants for remap-tree
btrfs: add REMAP chunk type
btrfs: allow remapped chunks to have zero stripes
btrfs: remove remapped block groups from the free-space tree
btrfs: don't add metadata items for the remap tree to the extent tree
btrfs: add extended version of struct block_group_item
btrfs: allow mounting filesystems with remap-tree incompat flag
btrfs: redirect I/O for remapped block groups
btrfs: release BG lock before calling btrfs_link_bg_list()
btrfs: handle deletions from remapped block group
btrfs: handle setting up relocation of block group with remap-tree
btrfs: move existing remaps before relocating block group
btrfs: replace identity maps with actual remaps when doing relocations
btrfs: add do_remap param to btrfs_discard_extent()
btrfs: allow balancing remap tree
btrfs: handle discarding fully-remapped block groups
btrfs: add stripe removal pending flag
fs/btrfs/Kconfig | 2 +
fs/btrfs/accessors.h | 29 +
fs/btrfs/block-group.c | 272 ++++-
fs/btrfs/block-group.h | 22 +-
fs/btrfs/block-rsv.c | 8 +
fs/btrfs/block-rsv.h | 1 +
fs/btrfs/discard.c | 70 +-
fs/btrfs/disk-io.c | 107 +-
fs/btrfs/extent-tree.c | 131 ++-
fs/btrfs/extent-tree.h | 3 +-
fs/btrfs/free-space-cache.c | 84 +-
fs/btrfs/free-space-cache.h | 1 +
fs/btrfs/free-space-tree.c | 4 +-
fs/btrfs/free-space-tree.h | 5 +-
fs/btrfs/fs.h | 10 +-
fs/btrfs/inode.c | 2 +-
fs/btrfs/locking.c | 1 +
fs/btrfs/relocation.c | 1867 ++++++++++++++++++++++++++++++-
fs/btrfs/relocation.h | 10 +-
fs/btrfs/space-info.c | 22 +-
fs/btrfs/sysfs.c | 4 +
fs/btrfs/transaction.c | 13 +
fs/btrfs/tree-checker.c | 94 +-
fs/btrfs/tree-checker.h | 5 +
fs/btrfs/volumes.c | 302 ++++-
fs/btrfs/volumes.h | 19 +-
include/uapi/linux/btrfs.h | 1 +
include/uapi/linux/btrfs_tree.h | 30 +-
28 files changed, 2901 insertions(+), 218 deletions(-)
--
2.49.1
next reply other threads:[~2025-10-09 11:34 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 11:27 Mark Harmstone [this message]
2025-10-09 11:27 ` [PATCH v3 01/17] btrfs: add definitions and constants for remap-tree Mark Harmstone
2025-10-09 11:27 ` [PATCH v3 02/17] btrfs: add REMAP chunk type Mark Harmstone
2025-10-15 3:37 ` Boris Burkov
2025-10-20 9:58 ` Mark Harmstone
2025-10-20 17:35 ` Boris Burkov
2025-10-09 11:27 ` [PATCH v3 03/17] btrfs: allow remapped chunks to have zero stripes Mark Harmstone
2025-10-15 3:47 ` Boris Burkov
2025-10-20 12:15 ` Mark Harmstone
2025-10-09 11:27 ` [PATCH v3 04/17] btrfs: remove remapped block groups from the free-space tree Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 05/17] btrfs: don't add metadata items for the remap tree to the extent tree Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 06/17] btrfs: add extended version of struct block_group_item Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 07/17] btrfs: allow mounting filesystems with remap-tree incompat flag Mark Harmstone
2025-10-15 3:55 ` Boris Burkov
2025-10-20 11:32 ` Mark Harmstone
2025-10-20 17:44 ` Boris Burkov
2025-10-09 11:28 ` [PATCH v3 08/17] btrfs: redirect I/O for remapped block groups Mark Harmstone
2025-10-15 4:21 ` Boris Burkov
2025-10-20 14:31 ` Mark Harmstone
2025-10-20 17:44 ` Boris Burkov
2025-10-09 11:28 ` [PATCH v3 09/17] btrfs: release BG lock before calling btrfs_link_bg_list() Mark Harmstone
2025-10-09 11:56 ` Filipe Manana
2025-10-09 14:58 ` Mark Harmstone
2025-10-09 15:16 ` Filipe Manana
2025-10-09 16:30 ` Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 10/17] btrfs: handle deletions from remapped block group Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 11/17] btrfs: handle setting up relocation of block group with remap-tree Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 12/17] btrfs: move existing remaps before relocating block group Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 13/17] btrfs: replace identity maps with actual remaps when doing relocations Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 14/17] btrfs: add do_remap param to btrfs_discard_extent() Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 15/17] btrfs: allow balancing remap tree Mark Harmstone
2025-10-15 4:24 ` Boris Burkov
2025-10-09 11:28 ` [PATCH v3 16/17] btrfs: handle discarding fully-remapped block groups Mark Harmstone
2025-10-15 4:54 ` Boris Burkov
2025-10-23 17:35 ` Mark Harmstone
2025-10-09 11:28 ` [PATCH v3 17/17] btrfs: add stripe removal pending flag Mark Harmstone
2025-10-15 5:05 ` Boris Burkov
2025-10-20 14:52 ` 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=20251009112814.13942-1-mark@harmstone.com \
--to=mark@harmstone.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).