diff options
author | Filipe Manana <fdmanana@suse.com> | 2014-08-07 21:47:06 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-08-21 10:55:26 -0400 |
commit | 62e2390e1ad78f956e96a6a831761adc6f2bf58a (patch) | |
tree | 293bff9b4dcc58b928271a36a0421455aaf07ee1 /fs/btrfs/ioctl.c | |
parent | 7064dd5c36187725e7ccfd837e07678ae435d3f5 (diff) |
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: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 845287ca59c3..fce6fd0e3f50 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -3494,7 +3494,8 @@ process_slot: | |||
3494 | btrfs_mark_buffer_dirty(leaf); | 3494 | btrfs_mark_buffer_dirty(leaf); |
3495 | btrfs_release_path(path); | 3495 | btrfs_release_path(path); |
3496 | 3496 | ||
3497 | last_dest_end = new_key.offset + datal; | 3497 | last_dest_end = ALIGN(new_key.offset + datal, |
3498 | root->sectorsize); | ||
3498 | ret = clone_finish_inode_update(trans, inode, | 3499 | ret = clone_finish_inode_update(trans, inode, |
3499 | last_dest_end, | 3500 | last_dest_end, |
3500 | destoff, olen); | 3501 | destoff, olen); |