提交 62e2390e 编写于 作者: F Filipe Manana 提交者: Chris Mason

Btrfs: clone, don't create invalid hole extent map

When cloning a file that consists of an inline extent, we were creating
an extent map that represents a non-existing trailing hole starting at a
file offset that isn't a multiple of the sector size. This happened because
when processing an inline extent we weren't aligning the extent's length to
the sector size, and therefore incorrectly treating the range
[inline_extent_length; sector_size[ as a hole.
Signed-off-by: NFilipe Manana <fdmanana@suse.com>
Reviewed-by: NSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 7064dd5c
...@@ -3494,7 +3494,8 @@ static int btrfs_clone(struct inode *src, struct inode *inode, ...@@ -3494,7 +3494,8 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(path); btrfs_release_path(path);
last_dest_end = new_key.offset + datal; last_dest_end = ALIGN(new_key.offset + datal,
root->sectorsize);
ret = clone_finish_inode_update(trans, inode, ret = clone_finish_inode_update(trans, inode,
last_dest_end, last_dest_end,
destoff, olen); destoff, olen);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册