48 lines
1.4 KiB
Diff
48 lines
1.4 KiB
Diff
From: David Sterba <dsterba@suse.cz>
|
|
Date: Mon, 1 Aug 2011 18:11:57 +0200
|
|
Subject: [PATCH] btrfs: allow cross-subvolume file clone
|
|
Reference: bnc#698540
|
|
Patch-mainline: pending
|
|
|
|
Lift the EXDEV condition and allow different root trees for files being
|
|
cloned, then pass source inode's root when searching for extents.
|
|
|
|
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
---
|
|
fs/btrfs/ioctl.c | 7 ++++---
|
|
1 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
|
|
index 0b980af..58eb0ef 100644
|
|
--- a/fs/btrfs/ioctl.c
|
|
+++ b/fs/btrfs/ioctl.c
|
|
@@ -2183,7 +2183,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
|
|
goto out_fput;
|
|
|
|
ret = -EXDEV;
|
|
- if (src->i_sb != inode->i_sb || BTRFS_I(src)->root != root)
|
|
+ if (src->i_sb != inode->i_sb)
|
|
goto out_fput;
|
|
|
|
ret = -ENOMEM;
|
|
@@ -2247,13 +2247,14 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
|
|
* note the key will change type as we walk through the
|
|
* tree.
|
|
*/
|
|
- ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
|
+ ret = btrfs_search_slot(NULL, BTRFS_I(src)->root, &key, path,
|
|
+ 0, 0);
|
|
if (ret < 0)
|
|
goto out;
|
|
|
|
nritems = btrfs_header_nritems(path->nodes[0]);
|
|
if (path->slots[0] >= nritems) {
|
|
- ret = btrfs_next_leaf(root, path);
|
|
+ ret = btrfs_next_leaf(BTRFS_I(src)->root, path);
|
|
if (ret < 0)
|
|
goto out;
|
|
if (ret > 0)
|
|
--
|
|
1.7.6
|
|
|