Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263739
b: refs/heads/master
c: d72c084
h: refs/heads/master
i:
  263737: 612f927
  263735: d96ff3f
v: v3
  • Loading branch information
Li Zefan authored and Chris Mason committed Sep 11, 2011
1 parent 249369d commit 8ca8120
Show file tree
Hide file tree
Showing 2 changed files with 11 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: 4815053aba7f2304055745df820cd74a39fdaab2
refs/heads/master: d72c0842ff0e71342857723bb65f35b71f57b264
13 changes: 10 additions & 3 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2333,14 +2333,21 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,

if (type == BTRFS_FILE_EXTENT_REG ||
type == BTRFS_FILE_EXTENT_PREALLOC) {
/*
* a | --- range to clone ---| b
* | ------------- extent ------------- |
*/

/* substract range b */
if (key.offset + datal > off + len)
datal = off + len - key.offset;

/* substract range a */
if (off > key.offset) {
datao += off - key.offset;
datal -= off - key.offset;
}

if (key.offset + datal > off + len)
datal = off + len - key.offset;

ret = btrfs_drop_extents(trans, inode,
new_key.offset,
new_key.offset + datal,
Expand Down

0 comments on commit 8ca8120

Please sign in to comment.