diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2025-01-13 22:31:45 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-01-14 17:49:04 +0300 |
commit | a678543e609dfb145f0498f895bee05bbc7994a5 (patch) | |
tree | 753cbc9e42b9479e4ec4133609c9ac603ecfa401 | |
parent | 5a0e38eab76991562e0754a93c2c4160819efb03 (diff) | |
download | linux-a678543e609dfb145f0498f895bee05bbc7994a5.tar.xz |
btrfs: fix front delete range calculation for RAID stripe extents
When deleting the front of a RAID stripe-extent the delete code
miscalculates the size on how much to pad the remaining extent part in the
front.
Fix the calculation so we're always having the sizes we expect.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/raid-stripe-tree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 0c351eda3551..9e559ad48810 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -136,10 +136,12 @@ int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start, u64 le * length to the new size and then re-insert the item. */ if (found_end > end) { - u64 diff = found_end - end; + u64 diff_end = found_end - end; btrfs_partially_delete_raid_extent(trans, path, &key, - diff, diff); + key.offset - length, + length); + ASSERT(key.offset - diff_end == length); break; } |