]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: implement partial deletion of RAID stripe extents
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 23 Oct 2024 13:25:17 +0000 (15:25 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:19 +0000 (14:34 +0100)
commit6aea95ee318890d9add03b9275bde31fec682e80
tree8fc11f478b29ac317a62ec0e69267c2124a78958
parentd07eaa9995fc81eb18e390d860442e598427547d
btrfs: implement partial deletion of RAID stripe extents

In our CI system, the RAID stripe tree configuration sometimes fails with
the following ASSERT():

  assertion failed: found_start >= start && found_end <= end, in fs/btrfs/raid-stripe-tree.c:64

This ASSERT()ion triggers, because for the initial design of RAID
stripe-tree, I had the "one ordered-extent equals one bio" rule of zoned
btrfs in mind.

But for a RAID stripe-tree based system, that is not hosted on a zoned
storage device, but on a regular device this rule doesn't apply.

So in case the range we want to delete starts in the middle of the
previous item, grab the item and "truncate" it's length. That is, clone
the item, subtract the deleted portion from the key's offset, delete the
old item and insert the new one.

In case the range to delete ends in the middle of an item, we have to
adjust both the item's key as well as the stripe extents and then
re-insert the modified clone into the tree after deleting the old stripe
extent.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid-stripe-tree.c