Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-23 20:39:51 +0200
committerTakashi Iwai <tiwai@suse.de>2017-06-23 20:39:51 +0200
commit60fe65bd85a631618151d6a3342966cc51bbff4e (patch)
tree90cdf94be315b185d60e40f9139ef28c7a989d25
parent721d338718175d98384d8fd128c33413897c7bd0 (diff)
parentfa2f02770dcf7bd19bbf2087276d96452822ba7c (diff)
Merge branch 'users/jeffm/SLE12-SP3/for-next' into SLE12-SP3rpm-4.4.73-1
-rw-r--r--patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees49
-rw-r--r--patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs28
-rw-r--r--patches.suse/btrfs-allow-backref-search-checks-for-shared-extents72
-rw-r--r--patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging76
-rw-r--r--patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper21
-rw-r--r--patches.suse/btrfs-backref-cleanup-_-namespace-abuse136
-rw-r--r--patches.suse/btrfs-backref-constify-some-arguments33
-rw-r--r--patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction28
-rw-r--r--patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs24
-rw-r--r--patches.suse/btrfs-constify-tracepoint-arguments138
-rw-r--r--patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees147
-rw-r--r--patches.suse/btrfs-fix-leak-and-use-after-free-in-resolve_indirect_refs61
-rw-r--r--patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c102
-rw-r--r--patches.suse/btrfs-struct-funcs-constify-readers12
-rw-r--r--series.conf7
15 files changed, 476 insertions, 458 deletions
diff --git a/patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees b/patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees
index abf01d6fd8..64099f3ac4 100644
--- a/patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees
+++ b/patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees
@@ -1,8 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: add a node counter to each of the rbtrees
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
This patch adds counters to each of the rbtrees so that we can tell
how large they are growing for a given workload. These counters
@@ -10,16 +9,18 @@ will be exported by tracepoints in the next patch.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ fs/btrfs/backref.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
+index daae7b6..4018393 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -136,9 +136,10 @@ struct prelim_ref {
+@@ -141,9 +141,10 @@ struct prelim_ref {
struct preftree {
struct rb_root root;
-+ unsigned count;
++ unsigned int count;
};
-#define PREFTREE_INIT { .root = RB_ROOT }
@@ -27,7 +28,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct preftrees {
struct preftree direct; /* BTRFS_SHARED_[DATA|BLOCK]_REF_KEY */
-@@ -247,6 +248,7 @@ static void prelim_ref_insert(struct pre
+@@ -252,6 +253,7 @@ static void prelim_ref_insert(struct preftree *preftree,
}
}
@@ -35,28 +36,30 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
rb_link_node(&newref->rbnode, parent, p);
rb_insert_color(&newref->rbnode, root);
}
-@@ -260,6 +262,7 @@ static void prelim_release(struct preftr
- ref = rb_entry(node, struct prelim_ref, rbnode);
- node = rb_next(&ref->rbnode);
- rb_erase(&ref->rbnode, &preftree->root);
-+ preftree->count--;
+@@ -269,6 +271,7 @@ static void prelim_release(struct preftree *preftree)
release_pref(ref);
- }
+
+ preftree->root = RB_ROOT;
++ preftree->count = 0;
}
-@@ -593,6 +596,7 @@ static int resolve_indirect_refs(struct
- BUG_ON(ref->parent); /* should not be a direct ref */
+
+ /*
+@@ -604,6 +607,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
+ }
rb_erase(&ref->rbnode, &preftrees->indirect.root);
+ preftrees->indirect.count--;
if (ref->count == 0) {
release_pref(ref);
-@@ -1221,6 +1225,7 @@ again:
- }
-
- rb_erase(&ref->rbnode, &preftrees.direct.root);
-+ preftrees.direct.count--;
- release_pref(ref);
- }
- WARN_ON(!RB_EMPTY_ROOT(&preftrees.direct.root));
+--
+2.10.2
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs b/patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs
index ef28e0784e..32c80dd5eb 100644
--- a/patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs
+++ b/patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs
@@ -1,23 +1,22 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: add cond_resched() calls when resolving backrefs
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
Since backref resolution is CPU-intensive, the cond_resched calls
should help alleviate soft lockup occurences.
Signed-off-by: Edmund Nadolski <enadolski@suse.com>
-Acked-by: Jeff Mahoney <jeffm@suse.com>
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/backref.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
-index 72a1ed3..657a06b 100644
+index 0dffd7e..e95049a 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -651,6 +651,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
+@@ -658,6 +658,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
prelim_ref_insert(fs_info, &preftrees->direct, ref);
ulist_reinit(parents);
@@ -25,7 +24,7 @@ index 72a1ed3..657a06b 100644
}
out:
ulist_free(parents);
-@@ -689,6 +690,7 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
+@@ -697,6 +698,7 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
btrfs_node_key_to_cpu(eb, &ref->key_for_search, 0);
btrfs_tree_read_unlock(eb);
free_extent_buffer(eb);
@@ -33,15 +32,22 @@ index 72a1ed3..657a06b 100644
}
return 0;
}
-@@ -1231,6 +1233,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
- rb_erase(&ref->rbnode, &preftrees.direct.root);
- preftrees.direct.count--;
- release_pref(ref);
+@@ -1236,6 +1238,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
+ }
+ eie = NULL;
+ }
+ cond_resched();
}
- WARN_ON(!RB_EMPTY_ROOT(&preftrees.direct.root));
+
out:
--
2.10.2
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-allow-backref-search-checks-for-shared-extents b/patches.suse/btrfs-allow-backref-search-checks-for-shared-extents
index 977b731c82..b985921a60 100644
--- a/patches.suse/btrfs-allow-backref-search-checks-for-shared-extents
+++ b/patches.suse/btrfs-allow-backref-search-checks-for-shared-extents
@@ -1,15 +1,14 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: allow backref search checks for shared extents
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
When called with a struct share_check, find_parent_nodes()
will detect a shared extent and immediately return with
BACKREF_SHARED_FOUND.
Signed-off-by: Edmund Nadolski <enadolski@suse.com>
-Acked-by: Jeff Mahoney <jeffm@suse.com>
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/backref.c | 165 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 112 insertions(+), 53 deletions(-)
@@ -71,7 +70,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
struct rb_root *root;
struct rb_node **p;
-@@ -233,12 +264,20 @@ static void prelim_ref_insert(const stru
+@@ -234,12 +265,20 @@ static void prelim_ref_insert(const stru
eie->next = newref->inode_list;
trace_btrfs_prelim_ref_merge(fs_info, ref, newref,
preftree->count);
@@ -92,7 +91,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
preftree->count++;
trace_btrfs_prelim_ref_insert(fs_info, newref, NULL, preftree->count);
rb_link_node(&newref->rbnode, parent, p);
-@@ -300,7 +339,8 @@ static void prelim_release(struct preftr
+@@ -303,7 +342,8 @@ static void prelim_release(struct preftr
static int add_prelim_ref(const struct btrfs_fs_info *fs_info,
struct preftree *preftree, u64 root_id,
const struct btrfs_key *key, int level, u64 parent,
@@ -102,7 +101,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
struct prelim_ref *ref;
-@@ -345,31 +385,31 @@ static int add_prelim_ref(const struct b
+@@ -348,31 +388,31 @@ static int add_prelim_ref(const struct b
ref->count = count;
ref->parent = parent;
ref->wanted_disk_byte = wanted_disk_byte;
@@ -142,7 +141,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
struct ulist *parents, struct prelim_ref *ref,
int level, u64 time_seq, const u64 *extent_item_pos,
-@@ -565,7 +605,7 @@ static int resolve_indirect_refs(struct
+@@ -568,7 +608,7 @@ static int resolve_indirect_refs(struct
struct btrfs_path *path, u64 time_seq,
struct preftrees *preftrees,
const u64 *extent_item_pos, u64 total_refs,
@@ -151,7 +150,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
int err;
int ret = 0;
-@@ -598,7 +638,8 @@ static int resolve_indirect_refs(struct
+@@ -605,7 +645,8 @@ static int resolve_indirect_refs(struct
continue;
}
@@ -161,7 +160,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
release_pref(ref);
ret = BACKREF_FOUND_SHARED;
goto out;
-@@ -640,11 +681,15 @@ static int resolve_indirect_refs(struct
+@@ -647,11 +688,15 @@ static int resolve_indirect_refs(struct
memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val;
new_ref->inode_list = unode_aux_to_inode_list(node);
@@ -180,7 +179,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
ulist_reinit(parents);
cond_resched();
-@@ -699,7 +744,7 @@ static int add_missing_keys(struct btrfs
+@@ -707,7 +752,7 @@ static int add_missing_keys(struct btrfs
static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_head *head, u64 seq,
struct preftrees *preftrees, u64 *total_refs,
@@ -189,7 +188,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_delayed_ref_node *node;
struct btrfs_delayed_extent_op *extent_op = head->extent_op;
-@@ -741,7 +786,7 @@ static int add_delayed_refs(const struct
+@@ -749,7 +794,7 @@ static int add_delayed_refs(const struct
&op_key, ref->level + 1,
node->bytenr,
node->ref_mod * sgn,
@@ -198,7 +197,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_SHARED_BLOCK_REF_KEY: {
-@@ -753,7 +798,7 @@ static int add_delayed_refs(const struct
+@@ -761,7 +806,7 @@ static int add_delayed_refs(const struct
ret = add_direct_ref(fs_info, preftrees,
ref->level + 1, ref->parent,
node->bytenr, node->ref_mod * sgn,
@@ -207,7 +206,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_EXTENT_DATA_REF_KEY: {
-@@ -769,15 +814,15 @@ static int add_delayed_refs(const struct
+@@ -777,15 +822,15 @@ static int add_delayed_refs(const struct
* Found a inum that doesn't match our known inum, we
* know it's shared.
*/
@@ -226,7 +225,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_SHARED_DATA_REF_KEY: {
-@@ -789,26 +834,35 @@ static int add_delayed_refs(const struct
+@@ -797,26 +842,35 @@ static int add_delayed_refs(const struct
ret = add_direct_ref(fs_info, preftrees, 0,
ref->parent, node->bytenr,
node->ref_mod * sgn,
@@ -265,7 +264,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
int ret = 0;
int slot;
-@@ -865,7 +919,7 @@ static int add_inline_refs(const struct
+@@ -873,7 +927,7 @@ static int add_inline_refs(const struct
case BTRFS_SHARED_BLOCK_REF_KEY:
ret = add_direct_ref(fs_info, preftrees,
*info_level + 1, offset,
@@ -274,7 +273,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
struct btrfs_shared_data_ref *sdref;
-@@ -875,13 +929,13 @@ static int add_inline_refs(const struct
+@@ -883,13 +937,13 @@ static int add_inline_refs(const struct
count = btrfs_shared_data_ref_count(leaf, sdref);
ret = add_direct_ref(fs_info, preftrees, 0, offset,
@@ -290,7 +289,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
struct btrfs_extent_data_ref *dref;
-@@ -895,7 +949,7 @@ static int add_inline_refs(const struct
+@@ -903,7 +957,7 @@ static int add_inline_refs(const struct
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = btrfs_extent_data_ref_offset(leaf, dref);
@@ -299,7 +298,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
ret = BACKREF_FOUND_SHARED;
break;
}
-@@ -904,7 +958,7 @@ static int add_inline_refs(const struct
+@@ -912,7 +966,7 @@ static int add_inline_refs(const struct
ret = add_indirect_ref(fs_info, preftrees, root,
&key, 0, bytenr, count,
@@ -308,7 +307,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -920,11 +974,13 @@ static int add_inline_refs(const struct
+@@ -928,11 +982,13 @@ static int add_inline_refs(const struct
/*
* add all non-inline backrefs for bytenr to the list
@@ -323,7 +322,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_root *extent_root = fs_info->extent_root;
int ret;
-@@ -957,7 +1013,7 @@ static int add_keyed_refs(struct btrfs_f
+@@ -965,7 +1021,7 @@ static int add_keyed_refs(struct btrfs_f
/* SHARED DIRECT METADATA backref */
ret = add_direct_ref(fs_info, preftrees,
info_level + 1, key.offset,
@@ -332,7 +331,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
/* SHARED DIRECT FULL backref */
-@@ -969,14 +1025,14 @@ static int add_keyed_refs(struct btrfs_f
+@@ -977,14 +1033,14 @@ static int add_keyed_refs(struct btrfs_f
count = btrfs_shared_data_ref_count(leaf, sdref);
ret = add_direct_ref(fs_info, preftrees, 0,
key.offset, bytenr, count,
@@ -349,7 +348,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
/* NORMAL INDIRECT DATA backref */
-@@ -992,7 +1048,7 @@ static int add_keyed_refs(struct btrfs_f
+@@ -1000,7 +1056,7 @@ static int add_keyed_refs(struct btrfs_f
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = btrfs_extent_data_ref_offset(leaf, dref);
@@ -358,7 +357,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
ret = BACKREF_FOUND_SHARED;
break;
}
-@@ -1000,7 +1056,7 @@ static int add_keyed_refs(struct btrfs_f
+@@ -1008,7 +1064,7 @@ static int add_keyed_refs(struct btrfs_f
root = btrfs_extent_data_ref_root(leaf, dref);
ret = add_indirect_ref(fs_info, preftrees, root,
&key, 0, bytenr, count,
@@ -367,7 +366,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -1020,20 +1076,23 @@ static int add_keyed_refs(struct btrfs_f
+@@ -1028,20 +1084,23 @@ static int add_keyed_refs(struct btrfs_f
* indirect refs to their parent bytenr.
* When roots are found, they're added to the roots list
*
@@ -394,7 +393,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_key key;
struct btrfs_path *path;
-@@ -1113,17 +1172,13 @@ again:
+@@ -1121,17 +1180,13 @@ again:
}
spin_unlock(&delayed_refs->lock);
ret = add_delayed_refs(fs_info, head, time_seq,
@@ -413,7 +412,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
}
if (path->slots[0]) {
-@@ -1139,11 +1194,11 @@ again:
+@@ -1147,11 +1202,11 @@ again:
key.type == BTRFS_METADATA_ITEM_KEY)) {
ret = add_inline_refs(fs_info, path, bytenr,
&info_level, &preftrees,
@@ -421,13 +420,13 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
+ &total_refs, sc);
if (ret)
goto out;
- ret = add_keyed_refs(fs_info, path, bytenr,
-- info_level, &preftrees, inum);
-+ info_level, &preftrees, sc);
+ ret = add_keyed_refs(fs_info, path, bytenr, info_level,
+- &preftrees, inum);
++ &preftrees, sc);
if (ret)
goto out;
}
-@@ -1156,8 +1211,7 @@ again:
+@@ -1164,8 +1219,7 @@ again:
goto out;
ret = resolve_indirect_refs(fs_info, path, time_seq, &preftrees,
@@ -437,8 +436,8 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
if (ret)
goto out;
-@@ -1174,7 +1228,8 @@ again:
- // node = rb_next(&ref->rbnode);
+@@ -1184,7 +1238,8 @@ again:
+ node = rb_next(&ref->rbnode);
WARN_ON(ref->count < 0);
if (roots && ref->count && ref->root_id && ref->parent == 0) {
- if (root_objectid && ref->root_id != root_objectid) {
@@ -447,7 +446,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
ret = BACKREF_FOUND_SHARED;
goto out;
}
-@@ -1282,7 +1337,7 @@ static int btrfs_find_all_leafs(struct b
+@@ -1288,7 +1343,7 @@ static int btrfs_find_all_leafs(struct b
return -ENOMEM;
ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
@@ -456,7 +455,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0 && ret != -ENOENT) {
free_leaf_list(*leafs);
return ret;
-@@ -1325,7 +1380,7 @@ static int btrfs_find_all_roots_safe(str
+@@ -1331,7 +1386,7 @@ static int btrfs_find_all_roots_safe(str
ULIST_ITER_INIT(&uiter);
while (1) {
ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
@@ -465,7 +464,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0 && ret != -ENOENT) {
ulist_free(tmp);
ulist_free(*roots);
-@@ -1381,6 +1436,11 @@ int btrfs_check_shared(struct btrfs_root
+@@ -1387,6 +1442,11 @@ int btrfs_check_shared(struct btrfs_root
struct ulist_node *node;
struct seq_list elem = SEQ_LIST_INIT(elem);
int ret = 0;
@@ -477,7 +476,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
tmp = ulist_alloc(GFP_NOFS);
roots = ulist_alloc(GFP_NOFS);
-@@ -1400,9 +1460,8 @@ int btrfs_check_shared(struct btrfs_root
+@@ -1406,9 +1466,8 @@ int btrfs_check_shared(struct btrfs_root
ULIST_ITER_INIT(&uiter);
while (1) {
@@ -488,4 +487,3 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
if (ret == BACKREF_FOUND_SHARED) {
/* this is the only condition under which we return 1 */
ret = 1;
-
diff --git a/patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging b/patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging
index 83df382011..59ab298736 100644
--- a/patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging
+++ b/patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging
@@ -1,8 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: backref, add tracepoints for prelim_ref insertion and merging
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
This patch adds a tracepoint event for prelim_ref insertion and
merging. For each, the ref being inserted or merged and the count
@@ -10,11 +9,11 @@ of tree nodes is issued.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 117 +++++++++++++++++++++----------------------
+ fs/btrfs/backref.c | 111 +++++++++++++++++++++----------------------
fs/btrfs/backref.h | 12 ++++
fs/btrfs/super.c | 1
- include/trace/events/btrfs.h | 58 +++++++++++++++++++++
- 4 files changed, 129 insertions(+), 59 deletions(-)
+ include/trace/events/btrfs.h | 58 ++++++++++++++++++++++
+ 4 files changed, 127 insertions(+), 55 deletions(-)
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -47,7 +46,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
-
struct preftree {
struct rb_root root;
- unsigned count;
+ unsigned int count;
@@ -212,7 +200,8 @@ static int prelim_ref_compare(struct pre
*
* Callers should assumed that newref has been freed after calling.
@@ -58,7 +57,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct prelim_ref *newref)
{
struct rb_root *root;
-@@ -242,6 +231,8 @@ static void prelim_ref_insert(struct pre
+@@ -243,6 +232,8 @@ static void prelim_ref_insert(struct pre
ref->inode_list = newref->inode_list;
else
eie->next = newref->inode_list;
@@ -67,7 +66,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ref->count += newref->count;
release_pref(newref);
return;
-@@ -249,6 +240,7 @@ static void prelim_ref_insert(struct pre
+@@ -250,6 +241,7 @@ static void prelim_ref_insert(struct pre
}
preftree->count++;
@@ -75,7 +74,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
rb_link_node(&newref->rbnode, parent, p);
rb_insert_color(&newref->rbnode, root);
}
-@@ -305,7 +297,8 @@ static void prelim_release(struct preftr
+@@ -308,7 +300,8 @@ static void prelim_release(struct preftr
* additional information that's available but not required to find the parent
* block might help in merging entries to gain some speed.
*/
@@ -85,7 +84,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
const struct btrfs_key *key, int level, u64 parent,
u64 wanted_disk_byte, int count, gfp_t gfp_mask)
{
-@@ -352,26 +345,28 @@ static int add_prelim_ref(struct preftre
+@@ -355,26 +348,28 @@ static int add_prelim_ref(struct preftre
ref->count = count;
ref->parent = parent;
ref->wanted_disk_byte = wanted_disk_byte;
@@ -121,16 +120,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
}
-@@ -631,7 +626,7 @@ static int resolve_indirect_refs(struct
- ref->inode_list = unode_aux_to_inode_list(node);
-
- /* Now it's a direct ref, put it in the the direct tree */
-- prelim_ref_insert(&preftrees->direct, ref);
-+ prelim_ref_insert(fs_info, &preftrees->direct, ref);
-
- /* Add a prelim_ref(s) for any other parent(s). */
- while ((node = ulist_next(parents, &uiter))) {
-@@ -646,7 +641,7 @@ static int resolve_indirect_refs(struct
+@@ -652,11 +647,11 @@ static int resolve_indirect_refs(struct
memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val;
new_ref->inode_list = unode_aux_to_inode_list(node);
@@ -138,8 +128,13 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ prelim_ref_insert(fs_info, &preftrees->direct, new_ref);
}
+ /* Now it's a direct ref, put it in the the direct tree */
+- prelim_ref_insert(&preftrees->direct, ref);
++ prelim_ref_insert(fs_info, &preftrees->direct, ref);
+
ulist_reinit(parents);
-@@ -697,7 +692,8 @@ static int add_missing_keys(struct btrfs
+ }
+@@ -707,7 +702,8 @@ static int add_missing_keys(struct btrfs
* add all currently queued delayed refs from this head whose seq nr is
* smaller or equal that seq to the list
*/
@@ -149,7 +144,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct preftrees *preftrees, u64 *total_refs,
u64 inum)
{
-@@ -737,8 +733,9 @@ static int add_delayed_refs(struct btrfs
+@@ -747,8 +743,9 @@ static int add_delayed_refs(struct btrfs
struct btrfs_delayed_tree_ref *ref;
ref = btrfs_delayed_node_to_tree_ref(node);
@@ -161,7 +156,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
node->ref_mod * sgn,
GFP_ATOMIC);
break;
-@@ -749,9 +746,9 @@ static int add_delayed_refs(struct btrfs
+@@ -759,9 +756,9 @@ static int add_delayed_refs(struct btrfs
ref = btrfs_delayed_node_to_tree_ref(node);
@@ -174,7 +169,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
GFP_ATOMIC);
break;
}
-@@ -773,8 +770,8 @@ static int add_delayed_refs(struct btrfs
+@@ -783,8 +780,8 @@ static int add_delayed_refs(struct btrfs
break;
}
@@ -185,7 +180,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
node->ref_mod * sgn,
GFP_ATOMIC);
break;
-@@ -785,8 +782,8 @@ static int add_delayed_refs(struct btrfs
+@@ -795,8 +792,8 @@ static int add_delayed_refs(struct btrfs
ref = btrfs_delayed_node_to_data_ref(node);
@@ -196,7 +191,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
node->ref_mod * sgn,
GFP_ATOMIC);
break;
-@@ -804,7 +801,7 @@ static int add_delayed_refs(struct btrfs
+@@ -814,7 +811,7 @@ static int add_delayed_refs(struct btrfs
/*
* add all inline backrefs for bytenr to the list
*/
@@ -205,7 +200,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_path *path, u64 bytenr,
int *info_level, struct preftrees *preftrees,
u64 *total_refs, u64 inum)
-@@ -862,7 +859,8 @@ static int add_inline_refs(struct btrfs_
+@@ -872,7 +869,8 @@ static int add_inline_refs(struct btrfs_
switch (type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
@@ -215,7 +210,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
bytenr, 1, GFP_NOFS);
break;
case BTRFS_SHARED_DATA_REF_KEY: {
-@@ -872,14 +870,14 @@ static int add_inline_refs(struct btrfs_
+@@ -882,14 +880,14 @@ static int add_inline_refs(struct btrfs_
sdref = (struct btrfs_shared_data_ref *)(iref + 1);
count = btrfs_shared_data_ref_count(leaf, sdref);
@@ -234,7 +229,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
struct btrfs_extent_data_ref *dref;
-@@ -900,8 +898,9 @@ static int add_inline_refs(struct btrfs_
+@@ -910,8 +908,9 @@ static int add_inline_refs(struct btrfs_
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -246,7 +241,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -952,9 +951,9 @@ static int add_keyed_refs(struct btrfs_f
+@@ -962,9 +961,9 @@ static int add_keyed_refs(struct btrfs_f
switch (key.type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
/* SHARED DIRECT METADATA backref */
@@ -259,7 +254,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
/* SHARED DIRECT FULL backref */
-@@ -964,15 +963,16 @@ static int add_keyed_refs(struct btrfs_f
+@@ -974,15 +973,16 @@ static int add_keyed_refs(struct btrfs_f
sdref = btrfs_item_ptr(leaf, slot,
struct btrfs_shared_data_ref);
count = btrfs_shared_data_ref_count(leaf, sdref);
@@ -281,7 +276,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
/* NORMAL INDIRECT DATA backref */
-@@ -994,8 +994,9 @@ static int add_keyed_refs(struct btrfs_f
+@@ -1004,8 +1004,9 @@ static int add_keyed_refs(struct btrfs_f
}
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -293,7 +288,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -1107,8 +1108,8 @@ again:
+@@ -1117,8 +1118,8 @@ again:
goto again;
}
spin_unlock(&delayed_refs->lock);
@@ -304,20 +299,6 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
mutex_unlock(&head->mutex);
if (ret)
goto out;
-@@ -1164,11 +1165,9 @@ again:
- * the list of found roots is updated. All prelim_refs are
- * deallocated here.
- */
-- node = rb_first(&preftrees.direct.root);
-- while (node) {
--
-+ while ((node = rb_first(&preftrees.direct.root))) {
- ref = rb_entry(node, struct prelim_ref, rbnode);
-- node = rb_next(&ref->rbnode);
-+// node = rb_next(&ref->rbnode);
- WARN_ON(ref->count < 0);
- if (roots && ref->count && ref->root_id && ref->parent == 0) {
- if (root_objectid && ref->root_id != root_objectid) {
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -72,4 +72,16 @@ int btrfs_check_shared(struct btrfs_root
@@ -421,4 +402,3 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
#endif /* _TRACE_BTRFS_H */
/* This part must be outside protection */
-
diff --git a/patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper b/patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper
index 65c0ae8649..2757ddfe44 100644
--- a/patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper
+++ b/patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper
@@ -1,9 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: backref, add unode_aux_to_inode_list helper
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
-
+Patch-mainline: Submitted, 20 June 2017
Replacing the double cast and ternary conditional with a helper makes
the code easier on the eyes.
@@ -14,10 +12,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
-index 3c70dda..7dfb035 100644
+index 9d6474d..4a7a4b0 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -422,6 +422,14 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
+@@ -682,6 +682,14 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
return ret;
}
@@ -32,7 +30,7 @@ index 3c70dda..7dfb035 100644
/*
* resolve all indirect backrefs from the list
*/
-@@ -476,8 +484,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
+@@ -736,8 +744,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
ULIST_ITER_INIT(&uiter);
node = ulist_next(parents, &uiter);
ref->parent = node ? node->val : 0;
@@ -42,7 +40,7 @@ index 3c70dda..7dfb035 100644
/* additional parents require new refs being added here */
while ((node = ulist_next(parents, &uiter))) {
-@@ -489,8 +496,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
+@@ -749,8 +756,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
}
memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val;
@@ -52,7 +50,7 @@ index 3c70dda..7dfb035 100644
list_add(&new_ref->list, &ref->list);
}
ulist_reinit(parents);
-@@ -1134,7 +1140,7 @@ static void free_leaf_list(struct ulist *blocks)
+@@ -1476,7 +1482,7 @@ static void free_leaf_list(struct ulist *blocks)
while ((node = ulist_next(blocks, &uiter))) {
if (!node->aux)
continue;
@@ -64,4 +62,11 @@ index 3c70dda..7dfb035 100644
--
2.10.2
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-backref-cleanup-_-namespace-abuse b/patches.suse/btrfs-backref-cleanup-_-namespace-abuse
index 8aa4739bad..c68d53b1e9 100644
--- a/patches.suse/btrfs-backref-cleanup-_-namespace-abuse
+++ b/patches.suse/btrfs-backref-cleanup-_-namespace-abuse
@@ -1,8 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: backref, cleanup __ namespace abuse
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
We typically use __ to indicate a helper routine that shouldn't be
called directly without understanding the proper context required
@@ -14,12 +13,14 @@ shouldn't be followed. This patch drops all the unnecessary prefixes.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 228 +++++++++++++++++++++++++----------------------------
- 1 file changed, 111 insertions(+), 117 deletions(-)
+ fs/btrfs/backref.c | 225 ++++++++++++++++++++++++++---------------------------
+ 1 file changed, 109 insertions(+), 116 deletions(-)
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
+index 4a7a4b0..3725277 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -123,7 +123,7 @@ static int find_extent_in_eb(const struc
+@@ -387,7 +387,7 @@ static int find_extent_in_eb(const struct extent_buffer *eb,
/*
* this structure records all encountered refs on the way up to the root
*/
@@ -28,7 +29,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct list_head list;
u64 root_id;
struct btrfs_key key_for_search;
-@@ -139,7 +139,7 @@ static struct kmem_cache *btrfs_prelim_r
+@@ -403,7 +403,7 @@ static struct kmem_cache *btrfs_prelim_ref_cache;
int __init btrfs_prelim_ref_init(void)
{
btrfs_prelim_ref_cache = kmem_cache_create("btrfs_prelim_ref",
@@ -37,7 +38,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
0,
SLAB_MEM_SPREAD,
NULL);
-@@ -186,19 +186,17 @@ void btrfs_prelim_ref_exit(void)
+@@ -449,19 +449,17 @@ void btrfs_prelim_ref_exit(void)
*
* - column 1, 3: we've the parent -> done
* - column 2: we take the first key from the block to find the parent
@@ -62,7 +63,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (root_id == BTRFS_DATA_RELOC_TREE_OBJECTID)
return 0;
-@@ -247,7 +245,7 @@ static int __add_prelim_ref(struct list_
+@@ -510,7 +508,7 @@ static int __add_prelim_ref(struct list_head *head, u64 root_id,
}
static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
@@ -71,7 +72,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int level, u64 time_seq, const u64 *extent_item_pos,
u64 total_refs)
{
-@@ -337,11 +335,10 @@ next:
+@@ -600,11 +598,10 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
* resolve an indirect backref in the form (root_id, key, level)
* to a logical address
*/
@@ -87,7 +88,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_root *root;
struct btrfs_key root_key;
-@@ -430,17 +427,17 @@ unode_aux_to_inode_list(struct ulist_nod
+@@ -693,17 +690,17 @@ unode_aux_to_inode_list(struct ulist_node *node)
/*
* resolve all indirect backrefs from the list
*/
@@ -113,7 +114,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct ulist *parents;
struct ulist_node *node;
struct ulist_iterator uiter;
-@@ -463,9 +460,9 @@ static int __resolve_indirect_refs(struc
+@@ -726,9 +723,9 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
ret = BACKREF_FOUND_SHARED;
goto out;
}
@@ -126,7 +127,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
/*
* we can only tolerate ENOENT,otherwise,we should catch error
* and return directly.
-@@ -503,8 +500,8 @@ out:
+@@ -766,8 +763,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
return ret;
}
@@ -137,7 +138,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
if (ref1->level != ref2->level)
return 0;
-@@ -525,15 +522,15 @@ static inline int ref_for_same_block(str
+@@ -788,15 +785,15 @@ static inline int ref_for_same_block(struct __prelim_ref *ref1,
/*
* read tree blocks and add keys where required.
*/
@@ -157,7 +158,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ref->parent)
continue;
-@@ -563,30 +560,30 @@ static int __add_missing_keys(struct btr
+@@ -821,30 +818,30 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
* merge backrefs and adjust counts accordingly
*
* mode = 1: merge identical keys, if key is set
@@ -177,25 +178,25 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct list_head *n2;
struct list_head *pos2;
- struct __prelim_ref *ref1;
-+ struct prelim_ref *ref1;
++ struct __prelim_ref *ref1;
- ref1 = list_entry(pos1, struct __prelim_ref, list);
-+ ref1 = list_entry(pos1, struct prelim_ref, list);
++ ref1 = list_entry(pos1, struct __prelim_ref, list);
for (pos2 = pos1->next, n2 = pos2->next; pos2 != head;
pos2 = n2, n2 = pos2->next) {
- struct __prelim_ref *ref2;
- struct __prelim_ref *xchg;
-+ struct prelim_ref *ref2;
-+ struct prelim_ref *xchg;
++ struct __prelim_ref *ref2;
++ struct __prelim_ref *xchg;
struct extent_inode_elem *eie;
- ref2 = list_entry(pos2, struct __prelim_ref, list);
-+ ref2 = list_entry(pos2, struct prelim_ref, list);
++ ref2 = list_entry(pos2, struct __prelim_ref, list);
if (!ref_for_same_block(ref1, ref2))
continue;
-@@ -622,9 +619,9 @@ static void __merge_refs(struct list_hea
+@@ -868,9 +865,9 @@ static void __merge_refs(struct list_head *head, enum merge_mode mode)
* add all currently queued delayed refs from this head whose seq nr is
* smaller or equal that seq to the list
*/
@@ -208,7 +209,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_delayed_ref_node *node;
struct btrfs_delayed_extent_op *extent_op = head->extent_op;
-@@ -661,19 +658,18 @@ static int __add_delayed_refs(struct btr
+@@ -907,19 +904,18 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
struct btrfs_delayed_tree_ref *ref;
ref = btrfs_delayed_node_to_tree_ref(node);
@@ -234,7 +235,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_EXTENT_DATA_REF_KEY: {
-@@ -693,18 +689,18 @@ static int __add_delayed_refs(struct btr
+@@ -939,18 +935,18 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
break;
}
@@ -259,22 +260,24 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -720,10 +716,10 @@ static int __add_delayed_refs(struct btr
+@@ -966,11 +962,11 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
/*
* add all inline backrefs for bytenr to the list
*/
-static int __add_inline_refs(struct btrfs_fs_info *fs_info,
- struct btrfs_path *path, u64 bytenr,
- int *info_level, struct list_head *prefs,
+- struct ref_root *ref_tree,
- u64 *total_refs, u64 inum)
+static int add_inline_refs(struct btrfs_fs_info *fs_info,
+ struct btrfs_path *path, u64 bytenr,
+ int *info_level, struct list_head *prefs,
++ struct ref_root *ref_tree,
+ u64 *total_refs, u64 inum)
{
int ret = 0;
int slot;
-@@ -778,9 +774,8 @@ static int __add_inline_refs(struct btrf
+@@ -1024,9 +1020,8 @@ static int __add_inline_refs(struct btrfs_path *path, u64 bytenr,
switch (type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
@@ -286,7 +289,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
struct btrfs_shared_data_ref *sdref;
-@@ -788,14 +783,14 @@ static int __add_inline_refs(struct btrf
+@@ -1034,8 +1029,8 @@ static int __add_inline_refs(struct btrfs_path *path, u64 bytenr,
sdref = (struct btrfs_shared_data_ref *)(iref + 1);
count = btrfs_shared_data_ref_count(leaf, sdref);
@@ -294,6 +297,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, 0, NULL, 0, offset,
+ bytenr, count, GFP_NOFS);
+ if (ref_tree) {
+ if (!ret)
+ ret = ref_tree_add(ref_tree, 0, 0, 0,
+@@ -1046,9 +1041,9 @@ static int __add_inline_refs(struct btrfs_path *path, u64 bytenr,
break;
}
case BTRFS_TREE_BLOCK_REF_KEY:
@@ -306,7 +313,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
struct btrfs_extent_data_ref *dref;
-@@ -815,8 +810,8 @@ static int __add_inline_refs(struct btrf
+@@ -1068,8 +1063,8 @@ static int __add_inline_refs(struct btrfs_path *path, u64 bytenr,
}
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -314,24 +321,25 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, root, &key, 0, 0,
+ bytenr, count, GFP_NOFS);
- break;
- }
- default:
-@@ -833,10 +828,9 @@ static int __add_inline_refs(struct btrf
+ if (ref_tree) {
+ if (!ret)
+ ret = ref_tree_add(ref_tree, root,
+@@ -1095,10 +1090,10 @@ static int __add_inline_refs(struct btrfs_path *path, u64 bytenr,
/*
* add all non-inline backrefs for bytenr to the list
*/
-static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
- struct btrfs_path *path, u64 bytenr,
- int info_level, struct list_head *prefs,
-- u64 inum)
+- struct ref_root *ref_tree, u64 inum)
+static int add_keyed_refs(struct btrfs_fs_info *fs_info,
+ struct btrfs_path *path, u64 bytenr,
-+ int info_level, struct list_head *prefs, u64 inum)
++ int info_level, struct list_head *prefs,
++ struct ref_root *ref_tree, u64 inum)
{
struct btrfs_root *extent_root = fs_info->extent_root;
int ret;
-@@ -866,9 +860,8 @@ static int __add_keyed_refs(struct btrfs
+@@ -1128,9 +1123,8 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
switch (key.type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
@@ -343,7 +351,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
struct btrfs_shared_data_ref *sdref;
-@@ -877,14 +870,14 @@ static int __add_keyed_refs(struct btrfs
+@@ -1139,8 +1133,8 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
sdref = btrfs_item_ptr(leaf, slot,
struct btrfs_shared_data_ref);
count = btrfs_shared_data_ref_count(leaf, sdref);
@@ -351,6 +359,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, 0, NULL, 0, key.offset,
+ bytenr, count, GFP_NOFS);
+ if (ref_tree) {
+ if (!ret)
+ ret = ref_tree_add(ref_tree, 0, 0, 0,
+@@ -1151,9 +1145,9 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
break;
}
case BTRFS_TREE_BLOCK_REF_KEY:
@@ -363,7 +375,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
struct btrfs_extent_data_ref *dref;
-@@ -905,8 +898,8 @@ static int __add_keyed_refs(struct btrfs
+@@ -1174,8 +1168,8 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
}
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -371,19 +383,19 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, root, &key, 0, 0,
+ bytenr, count, GFP_NOFS);
- break;
- }
- default:
-@@ -949,7 +942,7 @@ static int find_parent_nodes(struct btrf
+ if (ref_tree) {
+ if (!ret)
+ ret = ref_tree_add(ref_tree, root,
+@@ -1230,7 +1224,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
int ret;
struct list_head prefs_delayed;
struct list_head prefs;
- struct __prelim_ref *ref;
+ struct prelim_ref *ref;
struct extent_inode_elem *eie = NULL;
+ struct ref_root *ref_tree = NULL;
u64 total_refs = 0;
-
-@@ -1017,9 +1010,9 @@ again:
+@@ -1311,9 +1305,9 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
goto again;
}
spin_unlock(&delayed_refs->lock);
@@ -396,26 +408,28 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
mutex_unlock(&head->mutex);
if (ret)
goto out;
-@@ -1039,13 +1032,13 @@ again:
+@@ -1363,15 +1357,13 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
if (key.objectid == bytenr &&
(key.type == BTRFS_EXTENT_ITEM_KEY ||
key.type == BTRFS_METADATA_ITEM_KEY)) {
- ret = __add_inline_refs(fs_info, path, bytenr,
- &info_level, &prefs,
-- &total_refs, inum);
+- ref_tree, &total_refs,
+- inum);
+ ret = add_inline_refs(fs_info, path, bytenr,
-+ &info_level, &prefs,
++ &info_level, &prefs, ref_tree,
+ &total_refs, inum);
if (ret)
goto out;
- ret = __add_keyed_refs(fs_info, path, bytenr,
-- info_level, &prefs, inum);
-+ ret = add_keyed_refs(fs_info, path, bytenr,
-+ info_level, &prefs, inum);
+- info_level, &prefs,
+- ref_tree, inum);
++ ret = add_keyed_refs(fs_info, path, bytenr, info_level,
++ &prefs, ref_tree, inum);
if (ret)
goto out;
}
-@@ -1054,22 +1047,22 @@ again:
+@@ -1380,22 +1372,22 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
list_splice_init(&prefs_delayed, &prefs);
@@ -445,9 +459,9 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
WARN_ON(ref->count < 0);
if (roots && ref->count && ref->root_id && ref->parent == 0) {
if (root_objectid && ref->root_id != root_objectid) {
-@@ -1131,12 +1124,12 @@ again:
- out:
+@@ -1457,12 +1449,12 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
btrfs_free_path(path);
+ ref_root_free(ref_tree);
while (!list_empty(&prefs)) {
- ref = list_first_entry(&prefs, struct __prelim_ref, list);
+ ref = list_first_entry(&prefs, struct prelim_ref, list);
@@ -460,7 +474,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
list);
list_del(&ref->list);
kmem_cache_free(btrfs_prelim_ref_cache, ref);
-@@ -1206,9 +1199,9 @@ static int btrfs_find_all_leafs(struct b
+@@ -1532,9 +1524,9 @@ static int btrfs_find_all_leafs(struct btrfs_trans_handle *trans,
*
* returns 0 on success, < 0 on error.
*/
@@ -473,7 +487,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
struct ulist *tmp;
struct ulist_node *node = NULL;
-@@ -1252,7 +1245,8 @@ int btrfs_find_all_roots(struct btrfs_tr
+@@ -1578,7 +1570,8 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
if (!trans)
down_read(&fs_info->commit_root_sem);
@@ -483,7 +497,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (!trans)
up_read(&fs_info->commit_root_sem);
return ret;
-@@ -1560,17 +1554,17 @@ int extent_from_logical(struct btrfs_fs_
+@@ -1877,17 +1870,17 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
* helper function to iterate extent inline refs. ptr must point to a 0 value
* for the first call and may be modified. it is used to track state.
* if more refs exist, 0 is returned and the next call to
@@ -509,7 +523,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
unsigned long end;
u64 flags;
-@@ -1613,7 +1607,7 @@ static int __get_extent_inline_ref(unsig
+@@ -1930,7 +1923,7 @@ static int __get_extent_inline_ref(unsigned long *ptr,
/*
* reads the tree block backref for an extent. tree level and root are returned
* through out_level and out_root. ptr must point to a 0 value for the first
@@ -518,7 +532,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
* returns 0 if data was provided, 1 if there was no more data to provide or
* <0 on error.
*/
-@@ -1629,7 +1623,7 @@ int tree_backref_for_extent(unsigned lon
+@@ -1946,7 +1939,7 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
return 1;
while (1) {
@@ -527,7 +541,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
&eiref, &type);
if (ret < 0)
return ret;
-@@ -1726,8 +1720,8 @@ int iterate_extent_inodes(struct btrfs_f
+@@ -2043,8 +2036,8 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
ULIST_ITER_INIT(&ref_uiter);
while (!ret && (ref_node = ulist_next(refs, &ref_uiter))) {
@@ -538,4 +552,14 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret)
break;
ULIST_ITER_INIT(&root_uiter);
+--
+2.10.2
+
+--
+to unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+more majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-backref-constify-some-arguments b/patches.suse/btrfs-backref-constify-some-arguments
index 730351d746..3091d53fea 100644
--- a/patches.suse/btrfs-backref-constify-some-arguments
+++ b/patches.suse/btrfs-backref-constify-some-arguments
@@ -1,21 +1,22 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: backref, constify some arguments
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
This constifies a few buffers used in the backref code.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 29 ++++++++++++++++-------------
+ fs/btrfs/backref.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
+index f723c11..9d6474d 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -35,10 +35,11 @@ struct extent_inode_elem {
- struct extent_inode_elem *next;
- };
+@@ -299,10 +299,11 @@ static int ref_tree_add(struct ref_root *ref_tree, u64 root_id, u64 object_id,
+ return 0;
+ }
-static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb,
- struct btrfs_file_extent_item *fi,
@@ -29,7 +30,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
u64 offset = 0;
struct extent_inode_elem *e;
-@@ -80,9 +81,9 @@ static void free_inode_elem_list(struct
+@@ -344,9 +345,9 @@ static void free_inode_elem_list(struct extent_inode_elem *eie)
}
}
@@ -42,7 +43,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
u64 disk_byte;
struct btrfs_key key;
-@@ -193,7 +194,7 @@ void btrfs_prelim_ref_exit(void)
+@@ -456,7 +457,7 @@ void btrfs_prelim_ref_exit(void)
*/
static int __add_prelim_ref(struct list_head *head, u64 root_id,
@@ -51,7 +52,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 parent, u64 wanted_disk_byte, int count,
gfp_t gfp_mask)
{
-@@ -1338,7 +1339,7 @@ int btrfs_find_one_extref(struct btrfs_r
+@@ -1649,7 +1650,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
struct btrfs_key key;
struct btrfs_key found_key;
struct btrfs_inode_extref *extref;
@@ -60,7 +61,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
unsigned long ptr;
key.objectid = inode_objectid;
-@@ -1495,7 +1496,7 @@ int extent_from_logical(struct btrfs_fs_
+@@ -1806,7 +1807,7 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
u64 flags;
u64 size = 0;
u32 item_size;
@@ -69,7 +70,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_extent_item *ei;
struct btrfs_key key;
-@@ -1563,9 +1564,11 @@ int extent_from_logical(struct btrfs_fs_
+@@ -1874,9 +1875,11 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
* next ref. after the last ref was processed, 1 is returned.
* returns <0 on error
*/
@@ -84,4 +85,14 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_extent_inline_ref **out_eiref,
int *out_type)
{
+--
+2.10.2
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction b/patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction
index c385f4a909..641cb9cbd3 100644
--- a/patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction
+++ b/patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction
@@ -1,20 +1,21 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: btrfs_check_shared should manage its own transaction
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
Signed-off-by: Edmund Nadolski <enadolski@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 30 +++++++++++++++++++-----------
- fs/btrfs/backref.h | 4 +---
- fs/btrfs/extent_io.c | 21 ++-------------------
- 3 files changed, 22 insertions(+), 33 deletions(-)
+ fs/btrfs/backref.c | 30 +++++++++++++++++++-----------
+ fs/btrfs/backref.h | 4 +---
+ fs/btrfs/extent_io.c | 22 +++-------------------
+ 3 files changed, 23 insertions(+), 33 deletions(-)
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
+index 3725277..35cfa38 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -1595,20 +1595,21 @@ int btrfs_find_all_roots(struct btrfs_tr
+@@ -1580,20 +1580,21 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
/**
* btrfs_check_shared - tell us whether an extent is shared
*
@@ -41,7 +42,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct ulist *tmp = NULL;
struct ulist *roots = NULL;
struct ulist_iterator uiter;
-@@ -1624,14 +1625,18 @@ int btrfs_check_shared(struct btrfs_tran
+@@ -1609,14 +1610,18 @@ int btrfs_check_shared(struct btrfs_trans_handle *trans,
return -ENOMEM;
}
@@ -64,7 +65,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret == BACKREF_FOUND_SHARED) {
/* this is the only condition under which we return 1 */
ret = 1;
-@@ -1646,10 +1651,13 @@ int btrfs_check_shared(struct btrfs_tran
+@@ -1631,10 +1636,13 @@ int btrfs_check_shared(struct btrfs_trans_handle *trans,
bytenr = node->val;
cond_resched();
}
@@ -80,9 +81,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ulist_free(tmp);
ulist_free(roots);
return ret;
+diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
+index 9c41fba..f9428aa 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
-@@ -68,9 +68,7 @@ int btrfs_find_one_extref(struct btrfs_r
+@@ -68,9 +68,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
u64 start_off, struct btrfs_path *path,
struct btrfs_inode_extref **ret_extref,
u64 *found_off);
@@ -93,6 +96,8 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int __init btrfs_prelim_ref_init(void);
void btrfs_prelim_ref_exit(void);
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
+index 7ee62f6..ae31046 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -20,7 +20,6 @@
@@ -103,7 +108,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
static struct kmem_cache *extent_state_cache;
static struct kmem_cache *extent_buffer_cache;
-@@ -4511,36 +4510,20 @@ int extent_fiemap(struct inode *inode, s
+@@ -4607,36 +4606,20 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
flags |= (FIEMAP_EXTENT_DELALLOC |
FIEMAP_EXTENT_UNKNOWN);
} else if (fieinfo->fi_extents_max) {
@@ -142,4 +147,3 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0)
goto out_free;
if (ret)
-
diff --git a/patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs b/patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs
index 9407f52779..5550cb77db 100644
--- a/patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs
+++ b/patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs
@@ -1,8 +1,7 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: clean up extraneous computations in add_delayed_refs
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
Repeating the same computation in multiple places is not
necessary.
@@ -14,10 +13,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
-index 2cbf46d..3cdbdd1 100644
+index 7f02c51..05f37bb 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -753,7 +753,7 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -761,7 +761,7 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
struct btrfs_delayed_extent_op *extent_op = head->extent_op;
struct btrfs_key key;
struct btrfs_key op_key = {0};
@@ -26,7 +25,7 @@ index 2cbf46d..3cdbdd1 100644
int ret = 0;
if (extent_op && extent_op->update_key)
-@@ -770,15 +770,15 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -778,15 +778,15 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
WARN_ON(1);
continue;
case BTRFS_ADD_DELAYED_REF:
@@ -45,7 +44,7 @@ index 2cbf46d..3cdbdd1 100644
switch (node->type) {
case BTRFS_TREE_BLOCK_REF_KEY: {
/* NORMAL INDIRECT METADATA backref */
-@@ -787,9 +787,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -795,9 +795,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
ref = btrfs_delayed_node_to_tree_ref(node);
ret = add_indirect_ref(fs_info, preftrees, ref->root,
&op_key, ref->level + 1,
@@ -57,7 +56,7 @@ index 2cbf46d..3cdbdd1 100644
break;
}
case BTRFS_SHARED_BLOCK_REF_KEY: {
-@@ -798,9 +797,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -806,9 +805,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
ref = btrfs_delayed_node_to_tree_ref(node);
@@ -69,7 +68,7 @@ index 2cbf46d..3cdbdd1 100644
sc, GFP_ATOMIC);
break;
}
-@@ -823,9 +821,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -831,9 +829,8 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
}
ret = add_indirect_ref(fs_info, preftrees, ref->root,
@@ -81,7 +80,7 @@ index 2cbf46d..3cdbdd1 100644
break;
}
case BTRFS_SHARED_DATA_REF_KEY: {
-@@ -834,10 +831,9 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
+@@ -842,10 +839,9 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
ref = btrfs_delayed_node_to_data_ref(node);
@@ -98,4 +97,11 @@ index 2cbf46d..3cdbdd1 100644
--
2.10.2
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-constify-tracepoint-arguments b/patches.suse/btrfs-constify-tracepoint-arguments
index 351d4b4a22..30bced2d56 100644
--- a/patches.suse/btrfs-constify-tracepoint-arguments
+++ b/patches.suse/btrfs-constify-tracepoint-arguments
@@ -1,8 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: constify tracepoint arguments
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
Tracepoint arguments are all read-only. If we mark the arguments
as const, we're able to keep or convert those arguments to const
@@ -10,15 +9,17 @@ where appropriate.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/async-thread.c | 6 -
- fs/btrfs/async-thread.h | 6 -
- fs/btrfs/btrfs_inode.h | 2
- include/trace/events/btrfs.h | 240 ++++++++++++++++++++++---------------------
- 4 files changed, 134 insertions(+), 120 deletions(-)
+ fs/btrfs/async-thread.c | 6 +-
+ fs/btrfs/async-thread.h | 6 +-
+ fs/btrfs/btrfs_inode.h | 4 +-
+ include/trace/events/btrfs.h | 242 +++++++++++++++++++++++--------------------
+ 4 files changed, 136 insertions(+), 122 deletions(-)
+diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
+index ff0b0be..e00c8a9 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
-@@ -74,7 +74,7 @@ void btrfs_##name(struct work_struct *ar
+@@ -75,7 +75,7 @@ void btrfs_##name(struct work_struct *arg) \
normal_work_helper(work); \
}
@@ -27,7 +28,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
/*
* We could compare wq->normal->pending with num_online_cpus()
-@@ -89,13 +89,13 @@ bool btrfs_workqueue_normal_congested(st
+@@ -80,13 +80,13 @@
}
struct btrfs_fs_info *
@@ -43,9 +44,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
return work->wq->fs_info;
}
+diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
+index 1f95973..fc957e0 100644
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
-@@ -82,7 +82,7 @@ void btrfs_queue_work(struct btrfs_workq
+@@ -82,7 +82,7 @@ void btrfs_queue_work(struct btrfs_workqueue *wq,
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
void btrfs_set_work_high_priority(struct btrfs_work *work);
@@ -56,9 +59,20 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+struct btrfs_fs_info *btrfs_work_owner(const struct btrfs_work *work);
+struct btrfs_fs_info *btrfs_workqueue_owner(const struct __btrfs_workqueue *wq);
#endif
+diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
+index b8622e4..a68fbf6 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
-@@ -224,7 +224,7 @@ static inline void btrfs_insert_inode_ha
+@@ -207,7 +207,7 @@ struct btrfs_inode {
+
+ extern unsigned char btrfs_filetype_table[];
+
+-static inline struct btrfs_inode *BTRFS_I(const struct inode *inode)
++static inline struct btrfs_inode *BTRFS_I(const struct inode *inode)
+ {
+ return container_of(inode, struct btrfs_inode, vfs_inode);
+ }
+@@ -231,7 +231,7 @@ static inline void btrfs_insert_inode_hash(struct inode *inode)
__insert_inode_hash(inode, h);
}
@@ -67,9 +81,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
u64 ino = BTRFS_I(inode)->location.objectid;
+diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
+index cd99a36..42560fe 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
-@@ -83,7 +83,7 @@ struct btrfs_qgroup_extent_record;
+@@ -92,7 +92,7 @@ struct btrfs_qgroup;
TRACE_EVENT(btrfs_transaction_commit,
@@ -78,7 +94,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root),
-@@ -104,7 +104,7 @@ TRACE_EVENT(btrfs_transaction_commit,
+@@ -113,7 +113,7 @@ TRACE_EVENT(btrfs_transaction_commit,
DECLARE_EVENT_CLASS(btrfs__inode,
@@ -87,7 +103,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(inode),
-@@ -142,21 +142,21 @@ DECLARE_EVENT_CLASS(btrfs__inode,
+@@ -151,21 +151,21 @@ DECLARE_EVENT_CLASS(btrfs__inode,
DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
@@ -112,7 +128,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(inode)
);
-@@ -183,7 +183,7 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_e
+@@ -192,7 +192,7 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
TRACE_EVENT_CONDITION(btrfs_get_extent,
@@ -121,7 +137,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root, map),
-@@ -243,7 +243,8 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
+@@ -388,7 +388,8 @@ DEFINE_EVENT(
DECLARE_EVENT_CLASS(btrfs__ordered_extent,
@@ -131,7 +147,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(inode, ordered),
-@@ -291,36 +292,40 @@ DECLARE_EVENT_CLASS(btrfs__ordered_exten
+@@ -440,36 +441,40 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent,
DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
@@ -178,7 +194,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(page, inode, wbc),
-@@ -368,15 +373,15 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
+@@ -517,15 +522,15 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
DEFINE_EVENT(btrfs__writepage, __extent_writepage,
@@ -197,7 +213,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(page, start, end, uptodate),
-@@ -409,7 +414,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
+@@ -558,7 +563,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
TRACE_EVENT(btrfs_sync_file,
@@ -206,7 +222,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(file, datasync),
-@@ -421,8 +426,8 @@ TRACE_EVENT(btrfs_sync_file,
+@@ -570,8 +575,8 @@ TRACE_EVENT(btrfs_sync_file,
),
TP_fast_assign(
@@ -217,7 +233,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
__entry->ino = inode->i_ino;
-@@ -440,7 +445,7 @@ TRACE_EVENT(btrfs_sync_file,
+@@ -589,7 +594,7 @@ TRACE_EVENT(btrfs_sync_file,
TRACE_EVENT(btrfs_sync_fs,
@@ -226,7 +242,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(fs_info, wait),
-@@ -457,8 +462,8 @@ TRACE_EVENT(btrfs_sync_fs,
+@@ -606,8 +611,8 @@ TRACE_EVENT(btrfs_sync_fs,
TRACE_EVENT(btrfs_add_block_group,
@@ -237,7 +253,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(fs_info, block_group, create),
-@@ -505,9 +510,9 @@ TRACE_EVENT(btrfs_add_block_group,
+@@ -654,9 +659,9 @@ TRACE_EVENT(btrfs_add_block_group,
DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
@@ -250,7 +266,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action),
-@@ -548,9 +553,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_r
+@@ -697,9 +702,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
@@ -263,7 +279,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action)
-@@ -558,9 +563,9 @@ DEFINE_EVENT(btrfs_delayed_tree_ref, ad
+@@ -707,9 +712,9 @@ DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
@@ -276,7 +292,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action)
-@@ -568,9 +573,9 @@ DEFINE_EVENT(btrfs_delayed_tree_ref, ru
+@@ -717,9 +722,9 @@ DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
@@ -289,7 +305,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action),
-@@ -615,9 +620,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_r
+@@ -764,9 +769,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
@@ -302,7 +318,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action)
-@@ -625,9 +630,9 @@ DEFINE_EVENT(btrfs_delayed_data_ref, ad
+@@ -774,9 +779,9 @@ DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
@@ -315,7 +331,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, full_ref, action)
-@@ -635,9 +640,9 @@ DEFINE_EVENT(btrfs_delayed_data_ref, ru
+@@ -784,9 +789,9 @@ DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
@@ -328,7 +344,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, head_ref, action),
-@@ -665,9 +670,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_he
+@@ -814,9 +819,9 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
@@ -341,7 +357,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, head_ref, action)
-@@ -675,9 +680,9 @@ DEFINE_EVENT(btrfs_delayed_ref_head, ad
+@@ -824,9 +829,9 @@ DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
@@ -354,7 +370,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int action),
TP_ARGS(fs_info, ref, head_ref, action)
-@@ -697,8 +702,8 @@ DEFINE_EVENT(btrfs_delayed_ref_head, ru
+@@ -846,8 +851,8 @@ DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
DECLARE_EVENT_CLASS(btrfs__chunk,
@@ -365,7 +381,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root, map, offset, size),
-@@ -731,24 +736,24 @@ DECLARE_EVENT_CLASS(btrfs__chunk,
+@@ -880,24 +885,24 @@ DECLARE_EVENT_CLASS(btrfs__chunk,
DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
@@ -396,7 +412,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root, buf, cow),
-@@ -782,7 +787,7 @@ TRACE_EVENT(btrfs_cow_block,
+@@ -931,7 +936,7 @@ TRACE_EVENT(btrfs_cow_block,
TRACE_EVENT(btrfs_space_reservation,
@@ -405,7 +421,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 bytes, int reserve),
TP_ARGS(fs_info, type, val, bytes, reserve),
-@@ -814,7 +819,7 @@ TRACE_EVENT(btrfs_space_reservation,
+@@ -963,7 +968,7 @@ TRACE_EVENT(btrfs_space_reservation,
TRACE_EVENT(btrfs_trigger_flush,
@@ -414,7 +430,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
int flush, char *reason),
TP_ARGS(fs_info, flags, bytes, flush, reason),
-@@ -855,7 +860,7 @@ TRACE_EVENT(btrfs_trigger_flush,
+@@ -1004,7 +1009,7 @@ TRACE_EVENT(btrfs_trigger_flush,
TRACE_EVENT(btrfs_flush_space,
@@ -423,7 +439,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 orig_bytes, int state, int ret),
TP_ARGS(fs_info, flags, num_bytes, orig_bytes, state, ret),
-@@ -890,7 +895,7 @@ TRACE_EVENT(btrfs_flush_space,
+@@ -1039,7 +1044,7 @@ TRACE_EVENT(btrfs_flush_space,
DECLARE_EVENT_CLASS(btrfs__reserved_extent,
@@ -432,7 +448,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root, start, len),
-@@ -914,22 +919,22 @@ DECLARE_EVENT_CLASS(btrfs__reserved_exte
+@@ -1061,22 +1066,22 @@ DECLARE_EVENT_CLASS(btrfs__reserved_extent,
DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
@@ -459,7 +475,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(root, num_bytes, empty_size, data),
-@@ -956,8 +961,8 @@ TRACE_EVENT(find_free_extent,
+@@ -1101,8 +1106,8 @@ TRACE_EVENT(find_free_extent,
DECLARE_EVENT_CLASS(btrfs__reserve_extent,
@@ -470,7 +486,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 len),
TP_ARGS(root, block_group, start, len),
-@@ -988,8 +993,8 @@ DECLARE_EVENT_CLASS(btrfs__reserve_exten
+@@ -1132,8 +1137,8 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent,
DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
@@ -481,7 +497,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 len),
TP_ARGS(root, block_group, start, len)
-@@ -997,8 +1002,8 @@ DEFINE_EVENT(btrfs__reserve_extent, btrf
+@@ -1141,8 +1146,8 @@ DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
@@ -492,7 +508,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 len),
TP_ARGS(root, block_group, start, len)
-@@ -1006,7 +1011,7 @@ DEFINE_EVENT(btrfs__reserve_extent, btrf
+@@ -1150,7 +1155,7 @@ DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
TRACE_EVENT(btrfs_find_cluster,
@@ -501,7 +517,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 bytes, u64 empty_size, u64 min_bytes),
TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
-@@ -1039,7 +1044,7 @@ TRACE_EVENT(btrfs_find_cluster,
+@@ -1183,7 +1188,7 @@ TRACE_EVENT(btrfs_find_cluster,
TRACE_EVENT(btrfs_failed_cluster_setup,
@@ -510,7 +526,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(block_group),
-@@ -1056,8 +1061,9 @@ TRACE_EVENT(btrfs_failed_cluster_setup,
+@@ -1200,8 +1205,9 @@ TRACE_EVENT(btrfs_failed_cluster_setup,
TRACE_EVENT(btrfs_setup_cluster,
@@ -522,7 +538,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(block_group, cluster, size, bitmap),
-@@ -1091,12 +1097,13 @@ TRACE_EVENT(btrfs_setup_cluster,
+@@ -1235,12 +1241,13 @@ TRACE_EVENT(btrfs_setup_cluster,
struct extent_state;
TRACE_EVENT(alloc_extent_state,
@@ -538,7 +554,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
__field(gfp_t, mask)
__field(unsigned long, ip)
),
-@@ -1108,17 +1115,17 @@ TRACE_EVENT(alloc_extent_state,
+@@ -1252,17 +1259,17 @@ TRACE_EVENT(alloc_extent_state,
),
TP_printk("state=%p; mask = %s; caller = %pS", __entry->state,
@@ -559,7 +575,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
__field(unsigned long, ip)
),
-@@ -1128,22 +1135,22 @@ TRACE_EVENT(free_extent_state,
+@@ -1272,22 +1279,22 @@ TRACE_EVENT(free_extent_state,
),
TP_printk(" state=%p; caller = %pS", __entry->state,
@@ -590,7 +606,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
),
TP_fast_assign_btrfs(btrfs_work_owner(work),
-@@ -1168,12 +1175,12 @@ DECLARE_EVENT_CLASS(btrfs__work,
+@@ -1312,12 +1319,12 @@ DECLARE_EVENT_CLASS(btrfs__work,
*/
DECLARE_EVENT_CLASS(btrfs__work__done,
@@ -605,7 +621,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
),
TP_fast_assign_btrfs(fs_info,
-@@ -1185,40 +1192,41 @@ DECLARE_EVENT_CLASS(btrfs__work__done,
+@@ -1329,40 +1336,41 @@ DECLARE_EVENT_CLASS(btrfs__work__done,
DEFINE_EVENT(btrfs__work, btrfs_work_queued,
@@ -653,7 +669,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
__string( name, name )
__field( int , high )
),
-@@ -1237,19 +1245,20 @@ DECLARE_EVENT_CLASS(btrfs__workqueue,
+@@ -1381,19 +1389,20 @@ DECLARE_EVENT_CLASS(btrfs__workqueue,
DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
@@ -677,7 +693,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
),
TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
-@@ -1261,7 +1270,7 @@ DECLARE_EVENT_CLASS(btrfs__workqueue_don
+@@ -1405,7 +1414,7 @@ DECLARE_EVENT_CLASS(btrfs__workqueue_done,
DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
@@ -686,7 +702,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(wq)
);
-@@ -1309,7 +1318,8 @@ DEFINE_EVENT(btrfs__qgroup_data_map, btr
+@@ -1417,7 +1426,8 @@ DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
@@ -696,7 +712,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(inode, start, len, reserved, op),
-@@ -1341,21 +1351,24 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_da
+@@ -1449,21 +1459,24 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
@@ -724,7 +740,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(fs_info, ref_root, reserved),
-@@ -1375,14 +1388,15 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_delaye
+@@ -1483,14 +1496,15 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
@@ -743,7 +759,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
TP_ARGS(fs_info, rec),
-@@ -1403,23 +1417,23 @@ DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
+@@ -1511,23 +1525,23 @@ DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
@@ -772,7 +788,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
-@@ -1448,7 +1462,7 @@ TRACE_EVENT(btrfs_qgroup_account_extent,
+@@ -1556,7 +1570,7 @@ TRACE_EVENT(btrfs_qgroup_account_extent,
TRACE_EVENT(qgroup_update_counters,
@@ -781,4 +797,14 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 cur_old_count, u64 cur_new_count),
TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
+--
+2.10.2
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees b/patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees
index 0bb726cf72..430359262f 100644
--- a/patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees
+++ b/patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees
@@ -1,8 +1,7 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: convert prelimary reference tracking to use rbtrees
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
It's been known for a while that the use of multiple lists
that are periodically merged was an algorithmic problem within
@@ -21,12 +20,14 @@ shared across multiple calls to find_parent_nodes.
Signed-off-by: Edmund Nadolski <enadolski@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 426 ++++++++++++++++++++++++++++++++---------------------
- 1 file changed, 261 insertions(+), 165 deletions(-)
+ fs/btrfs/backref.c | 415 ++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 267 insertions(+), 148 deletions(-)
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
+index 0d1e7cb..daae7b6 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
-@@ -124,7 +124,7 @@ static int find_extent_in_eb(const struc
+@@ -129,7 +129,7 @@ static int find_extent_in_eb(const struct extent_buffer *eb,
* this structure records all encountered refs on the way up to the root
*/
struct prelim_ref {
@@ -35,7 +36,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 root_id;
struct btrfs_key key_for_search;
int level;
-@@ -134,6 +134,17 @@ struct prelim_ref {
+@@ -139,6 +139,17 @@ struct prelim_ref {
u64 wanted_disk_byte;
};
@@ -53,7 +54,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
static struct kmem_cache *btrfs_prelim_ref_cache;
int __init btrfs_prelim_ref_init(void)
-@@ -154,6 +165,105 @@ void btrfs_prelim_ref_exit(void)
+@@ -158,6 +169,108 @@ void btrfs_prelim_ref_exit(void)
kmem_cache_destroy(btrfs_prelim_ref_cache);
}
@@ -126,6 +127,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ } else {
+ /* Identical refs, merge them and free @newref */
+ struct extent_inode_elem *eie = ref->inode_list;
++
+ while (eie && eie->next)
+ eie = eie->next;
+
@@ -143,23 +145,25 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ rb_insert_color(&newref->rbnode, root);
+}
+
++/*
++ * Release the entire tree. We don't care about internal consistency so
++ * just free everything and then reset the tree root.
++ */
+static void prelim_release(struct preftree *preftree)
+{
-+ struct prelim_ref *ref;
-+ struct rb_node *node = rb_first(&preftree->root);
++ struct prelim_ref *ref, *next_ref;
+
-+ while (node) {
-+ ref = rb_entry(node, struct prelim_ref, rbnode);
-+ node = rb_next(&ref->rbnode);
-+ rb_erase(&ref->rbnode, &preftree->root);
++ rbtree_postorder_for_each_entry_safe(ref, next_ref, &preftree->root,
++ rbnode)
+ release_pref(ref);
-+ }
++
++ preftree->root = RB_ROOT;
+}
+
/*
* the rules for all callers of this function are:
* - obtaining the parent is the goal
-@@ -192,7 +302,7 @@ void btrfs_prelim_ref_exit(void)
+@@ -196,7 +309,7 @@ void btrfs_prelim_ref_exit(void)
* additional information that's available but not required to find the parent
* block might help in merging entries to gain some speed.
*/
@@ -168,7 +172,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
const struct btrfs_key *key, int level, u64 parent,
u64 wanted_disk_byte, int count, gfp_t gfp_mask)
{
-@@ -239,11 +349,29 @@ static int add_prelim_ref(struct list_he
+@@ -243,11 +356,29 @@ static int add_prelim_ref(struct list_head *head, u64 root_id,
ref->count = count;
ref->parent = parent;
ref->wanted_disk_byte = wanted_disk_byte;
@@ -199,7 +203,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
struct ulist *parents, struct prelim_ref *ref,
int level, u64 time_seq, const u64 *extent_item_pos,
-@@ -425,37 +553,52 @@ unode_aux_to_inode_list(struct ulist_nod
+@@ -429,38 +560,58 @@ unode_aux_to_inode_list(struct ulist_node *node)
}
/*
@@ -252,7 +256,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ struct prelim_ref *ref;
+
+ ref = rb_entry(rnode, struct prelim_ref, rbnode);
-+ BUG_ON(ref->parent); /* should not be a direct ref */
++ if (WARN(ref->parent,
++ "BUG: direct ref found in indirect tree")) {
++ ret = -EINVAL;
++ goto out;
++ }
+
+ rb_erase(&ref->rbnode, &preftrees->indirect.root);
+
@@ -262,9 +270,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ }
+
if (root_objectid && ref->root_id != root_objectid) {
++ release_pref(ref);
ret = BACKREF_FOUND_SHARED;
goto out;
-@@ -468,8 +611,11 @@ static int resolve_indirect_refs(struct
+ }
+@@ -472,8 +623,11 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
* and return directly.
*/
if (err == -ENOENT) {
@@ -276,14 +286,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ret = err;
goto out;
}
-@@ -480,8 +626,13 @@ static int resolve_indirect_refs(struct
+@@ -484,19 +638,26 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
ref->parent = node ? node->val : 0;
ref->inode_list = unode_aux_to_inode_list(node);
- /* additional parents require new refs being added here */
-+ /* Now it's a direct ref, put it in the the direct tree */
-+ prelim_ref_insert(&preftrees->direct, ref);
-+
+ /* Add a prelim_ref(s) for any other parent(s). */
while ((node = ulist_next(parents, &uiter))) {
+ struct prelim_ref *new_ref;
@@ -291,7 +298,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
new_ref = kmem_cache_alloc(btrfs_prelim_ref_cache,
GFP_NOFS);
if (!new_ref) {
-@@ -491,8 +642,9 @@ static int resolve_indirect_refs(struct
++ release_pref(ref);
+ ret = -ENOMEM;
+ goto out;
+ }
memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val;
new_ref->inode_list = unode_aux_to_inode_list(node);
@@ -299,10 +309,13 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ prelim_ref_insert(&preftrees->direct, new_ref);
}
+
++ /* Now it's a direct ref, put it in the the direct tree */
++ prelim_ref_insert(&preftrees->direct, ref);
++
ulist_reinit(parents);
}
out:
-@@ -500,40 +652,21 @@ out:
+@@ -504,40 +665,22 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
return ret;
}
@@ -336,21 +349,23 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+ struct prelim_ref *ref;
struct extent_buffer *eb;
+ struct rb_node *node = rb_first(&preftrees->indirect.root);
-
-- list_for_each(pos, head) {
-- struct prelim_ref *ref;
-- ref = list_entry(pos, struct prelim_ref, list);
++
+ while (node) {
+ ref = rb_entry(node, struct prelim_ref, rbnode);
+ node = rb_next(&ref->rbnode);
-+ BUG_ON(ref->parent); /* should not be a direct ref */
++ if (WARN(ref->parent, "BUG: direct ref found in indirect tree"))
++ return -EINVAL;
+- list_for_each(pos, head) {
+- struct prelim_ref *ref;
+- ref = list_entry(pos, struct prelim_ref, list);
+-
- if (ref->parent)
- continue;
if (ref->key_for_search.type)
continue;
BUG_ON(!ref->wanted_disk_byte);
-@@ -557,70 +690,11 @@ static int add_missing_keys(struct btrfs
+@@ -557,70 +703,11 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
}
/*
@@ -370,17 +385,17 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- list_for_each(pos1, head) {
- struct list_head *n2;
- struct list_head *pos2;
-- struct prelim_ref *ref1;
+- struct __prelim_ref *ref1;
-
-- ref1 = list_entry(pos1, struct prelim_ref, list);
+- ref1 = list_entry(pos1, struct __prelim_ref, list);
-
- for (pos2 = pos1->next, n2 = pos2->next; pos2 != head;
- pos2 = n2, n2 = pos2->next) {
-- struct prelim_ref *ref2;
-- struct prelim_ref *xchg;
+- struct __prelim_ref *ref2;
+- struct __prelim_ref *xchg;
- struct extent_inode_elem *eie;
-
-- ref2 = list_entry(pos2, struct prelim_ref, list);
+- ref2 = list_entry(pos2, struct __prelim_ref, list);
-
- if (!ref_for_same_block(ref1, ref2))
- continue;
@@ -422,7 +437,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 inum)
{
struct btrfs_delayed_ref_node *node;
-@@ -655,24 +729,30 @@ static int add_delayed_refs(struct btrfs
+@@ -642,24 +742,30 @@ static int add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
*total_refs += (node->ref_mod * sgn);
switch (node->type) {
case BTRFS_TREE_BLOCK_REF_KEY: {
@@ -458,7 +473,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_delayed_data_ref *ref;
ref = btrfs_delayed_node_to_data_ref(node);
-@@ -689,17 +769,21 @@ static int add_delayed_refs(struct btrfs
+@@ -676,17 +782,21 @@ static int add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
break;
}
@@ -485,7 +500,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
GFP_ATOMIC);
break;
}
-@@ -718,7 +802,7 @@ static int add_delayed_refs(struct btrfs
+@@ -704,7 +814,7 @@ static int add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
*/
static int add_inline_refs(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, u64 bytenr,
@@ -494,7 +509,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 *total_refs, u64 inum)
{
int ret = 0;
-@@ -774,8 +858,8 @@ static int add_inline_refs(struct btrfs_
+@@ -760,8 +870,8 @@ static int add_inline_refs(struct btrfs_path *path, u64 bytenr,
switch (type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
@@ -505,7 +520,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_SHARED_DATA_REF_KEY: {
struct btrfs_shared_data_ref *sdref;
-@@ -783,14 +867,15 @@ static int add_inline_refs(struct btrfs_
+@@ -769,14 +879,15 @@ static int add_inline_refs(struct btrfs_path *path, u64 bytenr,
sdref = (struct btrfs_shared_data_ref *)(iref + 1);
count = btrfs_shared_data_ref_count(leaf, sdref);
@@ -525,7 +540,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case BTRFS_EXTENT_DATA_REF_KEY: {
struct btrfs_extent_data_ref *dref;
-@@ -810,8 +895,9 @@ static int add_inline_refs(struct btrfs_
+@@ -796,8 +907,9 @@ static int add_inline_refs(struct btrfs_path *path, u64 bytenr,
}
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -537,7 +552,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -830,7 +916,8 @@ static int add_inline_refs(struct btrfs_
+@@ -816,7 +928,8 @@ static int add_inline_refs(struct btrfs_path *path, u64 bytenr,
*/
static int add_keyed_refs(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, u64 bytenr,
@@ -547,7 +562,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_root *extent_root = fs_info->extent_root;
int ret;
-@@ -860,26 +947,31 @@ static int add_keyed_refs(struct btrfs_f
+@@ -846,26 +959,31 @@ static int add_keyed_refs(struct btrfs_fs_info *fs_info,
switch (key.type) {
case BTRFS_SHARED_BLOCK_REF_KEY:
@@ -586,7 +601,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_extent_data_ref *dref;
int count;
u64 root;
-@@ -898,8 +990,8 @@ static int add_keyed_refs(struct btrfs_f
+@@ -884,8 +1002,8 @@ static int add_keyed_refs(struct btrfs_fs_info *fs_info,
}
root = btrfs_extent_data_ref_root(leaf, dref);
@@ -597,7 +612,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -940,14 +1032,15 @@ static int find_parent_nodes(struct btrf
+@@ -926,14 +1044,15 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
struct btrfs_delayed_ref_head *head;
int info_level = 0;
int ret;
@@ -618,7 +633,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
key.objectid = bytenr;
key.offset = (u64)-1;
-@@ -1010,15 +1103,18 @@ again:
+@@ -996,15 +1115,18 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
goto again;
}
spin_unlock(&delayed_refs->lock);
@@ -640,7 +655,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
}
if (path->slots[0]) {
-@@ -1033,36 +1129,42 @@ again:
+@@ -1019,36 +1141,42 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
(key.type == BTRFS_EXTENT_ITEM_KEY ||
key.type == BTRFS_METADATA_ITEM_KEY)) {
ret = add_inline_refs(fs_info, path, bytenr,
@@ -649,9 +664,9 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
&total_refs, inum);
if (ret)
goto out;
- ret = add_keyed_refs(fs_info, path, bytenr,
-- info_level, &prefs, inum);
-+ info_level, &preftrees, inum);
+ ret = add_keyed_refs(fs_info, path, bytenr, info_level,
+- &prefs, inum);
++ &preftrees, inum);
if (ret)
goto out;
}
@@ -677,35 +692,31 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- merge_refs(&prefs, 2);
+ WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect.root));
-+
+
+- while (!list_empty(&prefs)) {
+- ref = list_first_entry(&prefs, struct prelim_ref, list);
+ /*
+ * This walks the tree of merged and resolved refs. Tree blocks are
+ * read in as needed. Unique entries are added to the ulist, and
-+ * the list of found roots is updated. All prelim_refs are
-+ * deallocated here.
++ * the list of found roots is updated.
++ *
++ * We release the entire tree in one go before returning.
+ */
+ node = rb_first(&preftrees.direct.root);
+ while (node) {
-
-- while (!list_empty(&prefs)) {
-- ref = list_first_entry(&prefs, struct prelim_ref, list);
+ ref = rb_entry(node, struct prelim_ref, rbnode);
+ node = rb_next(&ref->rbnode);
WARN_ON(ref->count < 0);
if (roots && ref->count && ref->root_id && ref->parent == 0) {
if (root_objectid && ref->root_id != root_objectid) {
-@@ -1117,23 +1219,17 @@ again:
+@@ -1101,23 +1229,14 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
}
eie = NULL;
}
- list_del(&ref->list);
- kmem_cache_free(btrfs_prelim_ref_cache, ref);
-- }
+ }
-+ rb_erase(&ref->rbnode, &preftrees.direct.root);
-+ release_pref(ref);
-+ }
-+ WARN_ON(!RB_EMPTY_ROOT(&preftrees.direct.root));
out:
btrfs_free_path(path);
- while (!list_empty(&prefs)) {
@@ -726,4 +737,14 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0)
free_inode_elem_list(eie);
return ret;
+--
+2.10.2
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+
+
+
diff --git a/patches.suse/btrfs-fix-leak-and-use-after-free-in-resolve_indirect_refs b/patches.suse/btrfs-fix-leak-and-use-after-free-in-resolve_indirect_refs
deleted file mode 100644
index e21a75c4d4..0000000000
--- a/patches.suse/btrfs-fix-leak-and-use-after-free-in-resolve_indirect_refs
+++ /dev/null
@@ -1,61 +0,0 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
-From: Edmund Nadolski <enadolski@suse.com>
-Subject: btrfs: fix leak and use-after-free in resolve_indirect_refs
-References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
-
-The resolve_indirect_refs() calls prelim_ref_insert() which can free the
-ref on a merge. This call has to be moved after new parents are added,
-since those get a memcpy from the ref. The ref also can be leaked when a
-BACKREF_FOUND_SHARED is detected.
-
-Signed-off-by: Edmund Nadolski <enadolski@suse.de>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/btrfs/backref.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
-index 1c822cc..72a1ed3 100644
---- a/fs/btrfs/backref.c
-+++ b/fs/btrfs/backref.c
-@@ -603,6 +603,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
- }
-
- if (root_objectid && ref->root_id != root_objectid) {
-+ release_pref(ref);
- ret = BACKREF_FOUND_SHARED;
- goto out;
- }
-@@ -629,9 +630,6 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
- ref->parent = node ? node->val : 0;
- ref->inode_list = unode_aux_to_inode_list(node);
-
-- /* Now it's a direct ref, put it in the the direct tree */
-- prelim_ref_insert(fs_info, &preftrees->direct, ref);
--
- /* Add a prelim_ref(s) for any other parent(s). */
- while ((node = ulist_next(parents, &uiter))) {
- struct prelim_ref *new_ref;
-@@ -639,6 +637,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
- new_ref = kmem_cache_alloc(btrfs_prelim_ref_cache,
- GFP_NOFS);
- if (!new_ref) {
-+ release_pref(ref);
- ret = -ENOMEM;
- goto out;
- }
-@@ -648,6 +647,9 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
- prelim_ref_insert(fs_info, &preftrees->direct, new_ref);
- }
-
-+ /* Now it's a direct ref, put it in the the direct tree */
-+ prelim_ref_insert(fs_info, &preftrees->direct, ref);
-+
- ulist_reinit(parents);
- }
- out:
---
-2.10.2
-
-
diff --git a/patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c b/patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c
index a2eb7fe5f3..8640649ddb 100644
--- a/patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c
+++ b/patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c
@@ -1,8 +1,7 @@
-From enadolski@suse.com Fri Jun 16 14:56:32 2017
From: Edmund Nadolski <enadolski@suse.com>
Subject: btrfs: remove ref_tree implementation from backref.c
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
The BACKREF_FOUND_SHARED checking will be addressed in an upcoming
patch.
@@ -10,8 +9,8 @@ patch.
Signed-off-by: Edmund Nadolski <enadolski@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- fs/btrfs/backref.c | 356 +----------------------------------------------------
- 1 file changed, 8 insertions(+), 348 deletions(-)
+ fs/btrfs/backref.c | 355 +----------------------------------------------------
+ 1 file changed, 8 insertions(+), 347 deletions(-)
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -278,21 +277,21 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
- return 0;
-}
-
- static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb,
- struct btrfs_file_extent_item *fi,
- u64 extent_item_pos,
-@@ -975,7 +716,6 @@ static int __add_delayed_refs(struct btr
- static int __add_inline_refs(struct btrfs_fs_info *fs_info,
- struct btrfs_path *path, u64 bytenr,
- int *info_level, struct list_head *prefs,
-- struct ref_root *ref_tree,
- u64 *total_refs, u64 inum)
+ static int check_extent_in_eb(const struct btrfs_key *key,
+ const struct extent_buffer *eb,
+ const struct btrfs_file_extent_item *fi,
+@@ -978,7 +719,6 @@ static int add_delayed_refs(struct btrfs
+ static int add_inline_refs(struct btrfs_fs_info *fs_info,
+ struct btrfs_path *path, u64 bytenr,
+ int *info_level, struct list_head *prefs,
+- struct ref_root *ref_tree,
+ u64 *total_refs, u64 inum)
{
int ret = 0;
-@@ -1043,13 +783,6 @@ static int __add_inline_refs(struct btrf
+@@ -1045,13 +785,6 @@ static int add_inline_refs(struct btrfs_
count = btrfs_shared_data_ref_count(leaf, sdref);
- ret = __add_prelim_ref(prefs, 0, NULL, 0, offset,
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, 0, NULL, 0, offset,
+ bytenr, count, GFP_NOFS);
- if (ref_tree) {
- if (!ret)
- ret = ref_tree_add(ref_tree, 0, 0, 0,
@@ -303,10 +302,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_TREE_BLOCK_REF_KEY:
-@@ -1077,15 +810,6 @@ static int __add_inline_refs(struct btrf
+@@ -1079,15 +812,6 @@ static int add_inline_refs(struct btrfs_
root = btrfs_extent_data_ref_root(leaf, dref);
- ret = __add_prelim_ref(prefs, root, &key, 0, 0,
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, root, &key, 0, 0,
+ bytenr, count, GFP_NOFS);
- if (ref_tree) {
- if (!ret)
- ret = ref_tree_add(ref_tree, root,
@@ -319,19 +318,20 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -1105,7 +829,7 @@ static int __add_inline_refs(struct btrf
- static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
- struct btrfs_path *path, u64 bytenr,
- int info_level, struct list_head *prefs,
-- struct ref_root *ref_tree, u64 inum)
-+ u64 inum)
+@@ -1106,8 +830,7 @@ static int add_inline_refs(struct btrfs_
+ */
+ static int add_keyed_refs(struct btrfs_fs_info *fs_info,
+ struct btrfs_path *path, u64 bytenr,
+- int info_level, struct list_head *prefs,
+- struct ref_root *ref_tree, u64 inum)
++ int info_level, struct list_head *prefs, u64 inum)
{
struct btrfs_root *extent_root = fs_info->extent_root;
int ret;
-@@ -1148,13 +872,6 @@ static int __add_keyed_refs(struct btrfs
+@@ -1149,13 +872,6 @@ static int add_keyed_refs(struct btrfs_f
count = btrfs_shared_data_ref_count(leaf, sdref);
- ret = __add_prelim_ref(prefs, 0, NULL, 0, key.offset,
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, 0, NULL, 0, key.offset,
+ bytenr, count, GFP_NOFS);
- if (ref_tree) {
- if (!ret)
- ret = ref_tree_add(ref_tree, 0, 0, 0,
@@ -342,10 +342,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
case BTRFS_TREE_BLOCK_REF_KEY:
-@@ -1183,15 +900,6 @@ static int __add_keyed_refs(struct btrfs
+@@ -1184,15 +900,6 @@ static int add_keyed_refs(struct btrfs_f
root = btrfs_extent_data_ref_root(leaf, dref);
- ret = __add_prelim_ref(prefs, root, &key, 0, 0,
- bytenr, count, GFP_NOFS);
+ ret = add_prelim_ref(prefs, root, &key, 0, 0,
+ bytenr, count, GFP_NOFS);
- if (ref_tree) {
- if (!ret)
- ret = ref_tree_add(ref_tree, root,
@@ -358,7 +358,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
}
default:
-@@ -1218,16 +926,13 @@ static int __add_keyed_refs(struct btrfs
+@@ -1219,16 +926,13 @@ static int add_keyed_refs(struct btrfs_f
* commit root.
* The special case is for qgroup to search roots in commit_transaction().
*
@@ -376,15 +376,15 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
struct btrfs_key key;
struct btrfs_path *path;
-@@ -1239,7 +944,6 @@ static int find_parent_nodes(struct btrf
+@@ -1240,7 +944,6 @@ static int find_parent_nodes(struct btrf
struct list_head prefs;
- struct __prelim_ref *ref;
+ struct prelim_ref *ref;
struct extent_inode_elem *eie = NULL;
- struct ref_root *ref_tree = NULL;
u64 total_refs = 0;
INIT_LIST_HEAD(&prefs);
-@@ -1271,18 +975,6 @@ static int find_parent_nodes(struct btrf
+@@ -1272,18 +975,6 @@ static int find_parent_nodes(struct btrf
again:
head = NULL;
@@ -403,7 +403,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0);
if (ret < 0)
goto out;
-@@ -1327,36 +1019,6 @@ again:
+@@ -1328,36 +1019,6 @@ again:
} else {
spin_unlock(&delayed_refs->lock);
}
@@ -440,31 +440,30 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
}
if (path->slots[0]) {
-@@ -1372,13 +1034,11 @@ again:
+@@ -1372,12 +1033,12 @@ again:
+ (key.type == BTRFS_EXTENT_ITEM_KEY ||
key.type == BTRFS_METADATA_ITEM_KEY)) {
- ret = __add_inline_refs(fs_info, path, bytenr,
- &info_level, &prefs,
-- ref_tree, &total_refs,
-- inum);
-+ &total_refs, inum);
+ ret = add_inline_refs(fs_info, path, bytenr,
+- &info_level, &prefs, ref_tree,
++ &info_level, &prefs,
+ &total_refs, inum);
if (ret)
goto out;
- ret = __add_keyed_refs(fs_info, path, bytenr,
-- info_level, &prefs,
-- ref_tree, inum);
-+ info_level, &prefs, inum);
+ ret = add_keyed_refs(fs_info, path, bytenr, info_level,
+- &prefs, ref_tree, inum);
++ &prefs, inum);
if (ret)
goto out;
}
-@@ -1463,7 +1123,6 @@ again:
+@@ -1462,7 +1123,6 @@ again:
out:
btrfs_free_path(path);
- ref_root_free(ref_tree);
while (!list_empty(&prefs)) {
- ref = list_first_entry(&prefs, struct __prelim_ref, list);
+ ref = list_first_entry(&prefs, struct prelim_ref, list);
list_del(&ref->list);
-@@ -1518,7 +1177,7 @@ static int btrfs_find_all_leafs(struct b
+@@ -1517,7 +1177,7 @@ static int btrfs_find_all_leafs(struct b
return -ENOMEM;
ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
@@ -473,7 +472,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0 && ret != -ENOENT) {
free_leaf_list(*leafs);
return ret;
-@@ -1561,7 +1220,7 @@ static int __btrfs_find_all_roots(struct
+@@ -1560,7 +1220,7 @@ static int btrfs_find_all_roots_safe(str
ULIST_ITER_INIT(&uiter);
while (1) {
ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
@@ -482,7 +481,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret < 0 && ret != -ENOENT) {
ulist_free(tmp);
ulist_free(*roots);
-@@ -1635,8 +1294,9 @@ int btrfs_check_shared(struct btrfs_root
+@@ -1635,8 +1295,9 @@ int btrfs_check_shared(struct btrfs_root
ULIST_ITER_INIT(&uiter);
while (1) {
@@ -493,4 +492,3 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ret == BACKREF_FOUND_SHARED) {
/* this is the only condition under which we return 1 */
ret = 1;
-
diff --git a/patches.suse/btrfs-struct-funcs-constify-readers b/patches.suse/btrfs-struct-funcs-constify-readers
index 61d24516df..2baeb5a05f 100644
--- a/patches.suse/btrfs-struct-funcs-constify-readers
+++ b/patches.suse/btrfs-struct-funcs-constify-readers
@@ -1,8 +1,7 @@
-From jeffm@suse.com Fri Jun 16 14:56:32 2017
From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: struct-funcs, constify readers
References: bsc#974590 bsc#1030061 bsc#1022914 bsc#1017461
-Patch-mainline: not yet, needs testing on linux-next
+Patch-mainline: Submitted, 20 June 2017
We have reader helpers for most of the on-disk structures that use
an extent_buffer and pointer as offset into the buffer that are
@@ -412,7 +411,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
u64 val;
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
-@@ -5295,9 +5295,8 @@ unlock_exit:
+@@ -5317,9 +5317,8 @@ unlock_exit:
return ret;
}
@@ -424,7 +423,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
size_t cur;
size_t offset;
-@@ -5326,9 +5325,9 @@ void read_extent_buffer(struct extent_bu
+@@ -5348,9 +5347,9 @@ void read_extent_buffer(struct extent_bu
}
}
@@ -437,7 +436,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
size_t cur;
size_t offset;
-@@ -5368,10 +5367,10 @@ int read_extent_buffer_to_user(struct ex
+@@ -5390,10 +5389,10 @@ int read_extent_buffer_to_user(struct ex
* return 1 if the item spans two pages.
* return -EINVAL otherwise.
*/
@@ -452,7 +451,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
{
size_t offset = start & (PAGE_CACHE_SIZE - 1);
char *kaddr;
-@@ -5405,9 +5404,8 @@ int map_private_extent_buffer(struct ext
+@@ -5427,9 +5426,8 @@ int map_private_extent_buffer(struct ext
return 0;
}
@@ -533,4 +532,3 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
struct btrfs_disk_key *disk_key, int nr)
{
unsigned long ptr = btrfs_node_key_ptr_offset(nr);
-
diff --git a/series.conf b/series.conf
index fd44d35d95..b25114d76a 100644
--- a/series.conf
+++ b/series.conf
@@ -3887,17 +3887,16 @@
patches.suse/btrfs-8888-add-allow_unsupported-module-parameter.patch
+dsterba patches.suse/btrfs-8063-delete-qgroup-items-in-drop_snapshot.patch
patches.suse/btrfs-account-for-pinned-bytes-in-should_alloc_chunk.patch
- patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction
- patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c
- patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper
patches.suse/btrfs-struct-funcs-constify-readers
patches.suse/btrfs-constify-tracepoint-arguments
patches.suse/btrfs-backref-constify-some-arguments
+ patches.suse/btrfs-backref-add-unode_aux_to_inode_list-helper
patches.suse/btrfs-backref-cleanup-_-namespace-abuse
+ patches.suse/btrfs-btrfs_check_shared-should-manage-its-own-transaction
+ patches.suse/btrfs-remove-ref_tree-implementation-from-backref-c
patches.suse/btrfs-convert-prelimary-reference-tracking-to-use-rbtrees
patches.suse/btrfs-add-a-node-counter-to-each-of-the-rbtrees
patches.suse/btrfs-backref-add-tracepoints-for-prelim_ref-insertion-and-merging
- patches.suse/btrfs-fix-leak-and-use-after-free-in-resolve_indirect_refs
patches.suse/btrfs-add-cond_resched-calls-when-resolving-backrefs
patches.suse/btrfs-allow-backref-search-checks-for-shared-extents
patches.suse/btrfs-clean-up-extraneous-computations-in-add_delayed_refs