Skip to content

Commit a678543

Browse files
morbidrsakdave
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5a0e38e commit a678543

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/btrfs/raid-stripe-tree.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,12 @@ int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start, u64 le
136136
* length to the new size and then re-insert the item.
137137
*/
138138
if (found_end > end) {
139-
u64 diff = found_end - end;
139+
u64 diff_end = found_end - end;
140140

141141
btrfs_partially_delete_raid_extent(trans, path, &key,
142-
diff, diff);
142+
key.offset - length,
143+
length);
144+
ASSERT(key.offset - diff_end == length);
143145
break;
144146
}
145147

0 commit comments

Comments
 (0)