]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: redirect I/O for remapped block groups
authorMark Harmstone <mark@harmstone.com>
Wed, 7 Jan 2026 14:09:09 +0000 (14:09 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:54:35 +0000 (07:54 +0100)
commit18ba649928711539dd124b4bf7682696b3f2e4a8
tree6c4f0645c7a59f05d746d3de0de2d9c1e3fc379d
parent8620da16fb6be1fd9906374fa1c763a10c6918df
btrfs: redirect I/O for remapped block groups

Change btrfs_map_block() so that if the block group has the REMAPPED
flag set, we call btrfs_translate_remap() to obtain a new address.

btrfs_translate_remap() searches the remap tree for a range
corresponding to the logical address passed to btrfs_map_block(). If it
is within an identity remap, this part of the block group hasn't yet
been relocated, and so we use the existing address.

If it is within an actual remap, we subtract the start of the remap
range and add the address of its destination, contained in the item's
payload.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c
fs/btrfs/relocation.h
fs/btrfs/volumes.c