提交 0181e58f 编写于 作者: Y Yan 提交者: Chris Mason

btrfs_drop_extent fixe for inline items > 8K

When truncating a inline extent, btrfs_drop_extents doesn't properly
handle the case "key.offset > inline_limit". This bug can only happen
when max line size is larger than 8K.
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 1b0f7c29
...@@ -591,8 +591,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, ...@@ -591,8 +591,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
} }
} }
bookend = 1; bookend = 1;
if (found_inline && start <= key.offset && if (found_inline && start <= key.offset)
inline_limit < extent_end)
keep = 1; keep = 1;
} }
/* truncate existing extent */ /* truncate existing extent */
...@@ -672,11 +671,10 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, ...@@ -672,11 +671,10 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
if (!bookend) if (!bookend)
continue; continue;
} }
if (bookend && found_inline && start <= key.offset && if (bookend && found_inline && start <= key.offset) {
inline_limit < extent_end && key.offset <= inline_limit) {
u32 new_size; u32 new_size;
new_size = btrfs_file_extent_calc_inline_size( new_size = btrfs_file_extent_calc_inline_size(
extent_end - inline_limit); extent_end - end);
btrfs_truncate_item(trans, root, path, new_size, 0); btrfs_truncate_item(trans, root, path, new_size, 0);
} }
/* create bookend, splitting the extent in two */ /* create bookend, splitting the extent in two */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册