Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201053
b: refs/heads/master
c: b5384d4
h: refs/heads/master
i:
  201051: e409728
v: v3
  • Loading branch information
Sage Weil authored and Chris Mason committed Jul 19, 2010
1 parent 1213a30 commit d9b364d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99d8f83c98930100cd70437b0c81a935e7a14b0b
refs/heads/master: b5384d48f4e74edec3ca1887cb65e378a72af9a1
16 changes: 13 additions & 3 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
u64 disko = 0, diskl = 0;
u64 datao = 0, datal = 0;
u8 comp;
u64 endoff;

size = btrfs_item_size_nr(leaf, slot);
read_extent_buffer(leaf, buf,
Expand Down Expand Up @@ -1712,9 +1713,18 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
btrfs_release_path(root, path);

inode->i_mtime = inode->i_ctime = CURRENT_TIME;
if (new_key.offset + datal > inode->i_size)
btrfs_i_size_write(inode,
new_key.offset + datal);

/*
* we round up to the block size at eof when
* determining which extents to clone above,
* but shouldn't round up the file size
*/
endoff = new_key.offset + datal;
if (endoff > off+olen)
endoff = off+olen;
if (endoff > inode->i_size)
btrfs_i_size_write(inode, endoff);

BTRFS_I(inode)->flags = BTRFS_I(src)->flags;
ret = btrfs_update_inode(trans, root, inode);
BUG_ON(ret);
Expand Down

0 comments on commit d9b364d

Please sign in to comment.