Repository navigation
Expand file tree
/
Copy pathRFC-btrfs-send-Disable-clone-detection.patch
More file actions
73 lines (66 loc) · 2.03 KB
/
Copy pathRFC-btrfs-send-Disable-clone-detection.patch
File metadata and controls
73 lines (66 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 2db8dc8..eed3f1c 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1166,6 +1166,7 @@ struct backref_ctx {
int found_itself;
};
+#if 0
static int __clone_root_cmp_bsearch(const void *key, const void *elt)
{
u64 root = (u64)(uintptr_t)key;
@@ -1177,6 +1178,7 @@ static int __clone_root_cmp_bsearch(const void *key, const void *elt)
return 1;
return 0;
}
+#endif
static int __clone_root_cmp_sort(const void *e1, const void *e2)
{
@@ -1190,6 +1192,7 @@ static int __clone_root_cmp_sort(const void *e1, const void *e2)
return 0;
}
+#if 0
/*
* Called for every backref that is found for the current extent.
* Results are collected in sctx->clone_roots->ino/offset/found_refs
@@ -1445,6 +1448,7 @@ out:
kfree(backref_ctx);
return ret;
}
+#endif
static int read_symlink(struct btrfs_root *root,
u64 ino,
@@ -5291,7 +5295,6 @@ static int process_extent(struct send_ctx *sctx,
struct btrfs_path *path,
struct btrfs_key *key)
{
- struct clone_root *found_clone = NULL;
int ret = 0;
if (S_ISLNK(sctx->cur_inode_mode))
@@ -5333,12 +5336,27 @@ static int process_extent(struct send_ctx *sctx,
}
}
+ /*
+ * Current clone detection is both time and memory consuming.
+ *
+ * Time consuming is caused by iterating all backref of extent.
+ * Memory consuming is caused by allocating "found_clone" every
+ * time for a backref.
+ *
+ * XXX: Disabling it is never the best method, but at least it
+ * won't cause OOM nor super long execution time.
+ * The root fix needs to change the iteration basis, from iterating
+ * file extents to iterating extents, so find_parent_nodes() and
+ * backref walk should be called only once for one extent.
+ */
+#if 0
ret = find_extent_clone(sctx, path, key->objectid, key->offset,
sctx->cur_inode_size, &found_clone);
if (ret != -ENOENT && ret < 0)
goto out;
+#endif
- ret = send_write_or_clone(sctx, path, key, found_clone);
+ ret = send_write_or_clone(sctx, path, key, NULL);
if (ret)
goto out;
out_hole: