diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2010-11-18 20:36:34 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-11-21 22:26:06 -0500 |
commit | 5f3888ff6f0b9dce60705765752b788a92557644 (patch) | |
tree | c7745507d85f68b188f0c9b11cc6f783f0d0cb86 | |
parent | 2a6b8daedaf3682bed3fc1d4e2390491f6e19c49 (diff) |
btrfs: Set file size correctly in file clone
Set src_offset = 0, src_length = 20K, dest_offset = 20K. And the
original filesize of the dest file 'file2' is 30K:
# ls -l /mnt/file2
-rw-r--r-- 1 root root 30720 Nov 18 16:42 /mnt/file2
Now clone file1 to file2, the dest file should be 40K, but it
still shows 30K:
# ls -l /mnt/file2
-rw-r--r-- 1 root root 30720 Nov 18 16:42 /mnt/file2
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 81b47bd8a55..6b4bfa72bf8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1873,8 +1873,8 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
1873 | * but shouldn't round up the file size | 1873 | * but shouldn't round up the file size |
1874 | */ | 1874 | */ |
1875 | endoff = new_key.offset + datal; | 1875 | endoff = new_key.offset + datal; |
1876 | if (endoff > off+olen) | 1876 | if (endoff > destoff+olen) |
1877 | endoff = off+olen; | 1877 | endoff = destoff+olen; |
1878 | if (endoff > inode->i_size) | 1878 | if (endoff > inode->i_size) |
1879 | btrfs_i_size_write(inode, endoff); | 1879 | btrfs_i_size_write(inode, endoff); |
1880 | 1880 | ||