diff options
author | Sage Weil <sage@newdream.net> | 2010-10-29 15:37:33 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-10-29 15:37:33 -0400 |
commit | 9a019196ecaa57780141ef5d1f0bb31050d6ed5b (patch) | |
tree | abd838acff1d6407d2d91efeb38e76e53271aadb /fs | |
parent | d8e39c457bc1ca2a7304bc086c7b0f0c10854921 (diff) |
Btrfs: fix delalloc checks in clone ioctl
The lookup_first_ordered_extent() was done on the wrong inode, and the
->delalloc_bytes test was wrong, as the following
btrfs_wait_ordered_range() would only invoke a range write and wouldn't
write the entire file data range. Also, a bad parameter was passed to
btrfs_wait_ordered_range().
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ioctl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 60f662c4778b..d94bef5179fc 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1520,13 +1520,15 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
1520 | while (1) { | 1520 | while (1) { |
1521 | struct btrfs_ordered_extent *ordered; | 1521 | struct btrfs_ordered_extent *ordered; |
1522 | lock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); | 1522 | lock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); |
1523 | ordered = btrfs_lookup_first_ordered_extent(inode, off+len); | 1523 | ordered = btrfs_lookup_first_ordered_extent(src, off+len); |
1524 | if (BTRFS_I(src)->delalloc_bytes == 0 && !ordered) | 1524 | if (!ordered && |
1525 | !test_range_bit(&BTRFS_I(src)->io_tree, off, off+len, | ||
1526 | EXTENT_DELALLOC, 0, NULL)) | ||
1525 | break; | 1527 | break; |
1526 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); | 1528 | unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); |
1527 | if (ordered) | 1529 | if (ordered) |
1528 | btrfs_put_ordered_extent(ordered); | 1530 | btrfs_put_ordered_extent(ordered); |
1529 | btrfs_wait_ordered_range(src, off, off+len); | 1531 | btrfs_wait_ordered_range(src, off, len); |
1530 | } | 1532 | } |
1531 | 1533 | ||
1532 | /* clone data */ | 1534 | /* clone data */ |