Skip to content

Commit 50cae2c

Browse files
morbidrsakdave
authored andcommitted
btrfs: fix tail delete of RAID stripe-extents
Fix tail delete of RAID stripe-extents, if there is a range to be deleted as well after the tail delete of the extent. Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a678543 commit 50cae2c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

fs/btrfs/raid-stripe-tree.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,18 @@ int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start, u64 le
119119
* length to the new size and then re-insert the item.
120120
*/
121121
if (found_start < start) {
122-
u64 diff = start - found_start;
122+
u64 diff_start = start - found_start;
123123

124124
btrfs_partially_delete_raid_extent(trans, path, &key,
125-
diff, 0);
126-
break;
125+
diff_start, 0);
126+
127+
start += (key.offset - diff_start);
128+
length -= (key.offset - diff_start);
129+
if (length == 0)
130+
break;
131+
132+
btrfs_release_path(path);
133+
continue;
127134
}
128135

129136
/*

0 commit comments

Comments
 (0)