]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: tree-checker: add checker for items in remap tree
authorMark Harmstone <mark@harmstone.com>
Tue, 3 Mar 2026 15:59:12 +0000 (15:59 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:06 +0000 (18:56 +0200)
commitda08c02bc705694f51edb67b094f1e5db629c1e2
tree508f93c1c5e04b229ffc025066d92bcb572a6483
parent0e6a169c6487ca3a13d19a9ec6dc9673af5a1cf7
btrfs: tree-checker: add checker for items in remap tree

Add write-time checking of items in the remap tree, to catch errors
before they are written to disk.

We're checking:

* That remap items, remap backrefs, and identity remaps aren't written
  unless the REMAP_TREE incompat flag is set
* That identity remaps have a size of 0
* That remap items and remap backrefs have a size of sizeof(struct
  btrfs_remap_item)
* That the objectid for these items is aligned to the sector size
* That the offset for these items (i.e. the size of the remapping) isn't
  0 and is aligned to the sector size
* That objectid + offset doesn't overflow

Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-checker.c