Home Home > GIT Browse > openSUSE-42.3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2019-05-17 15:04:23 +0800
committerQu Wenruo <wqu@suse.com>2019-05-17 15:04:23 +0800
commit9029f90ac577bfcedc54c713f128a9cf917d27cc (patch)
tree73d21ff73b2df5b6af85802787d75ea8eb3f8675
parentcccd8a9116ad3a524fa6a49f332779c317eb5e0a (diff)
btrfs: add a helper to return a head ref (bsc#1134813).
-rw-r--r--patches.suse/0001-btrfs-add-a-helper-to-return-a-head-ref.patch77
-rw-r--r--series.conf1
2 files changed, 78 insertions, 0 deletions
diff --git a/patches.suse/0001-btrfs-add-a-helper-to-return-a-head-ref.patch b/patches.suse/0001-btrfs-add-a-helper-to-return-a-head-ref.patch
new file mode 100644
index 0000000000..c542b6446a
--- /dev/null
+++ b/patches.suse/0001-btrfs-add-a-helper-to-return-a-head-ref.patch
@@ -0,0 +1,77 @@
+From 2eadaa22c17ac3c546850f70d9d20fa19459dbce Mon Sep 17 00:00:00 2001
+From: Josef Bacik <josef@toxicpanda.com>
+Date: Fri, 29 Sep 2017 15:43:52 -0400
+Git-commit: 2eadaa22c17ac3c546850f70d9d20fa19459dbce
+Patch-mainline: v4.15
+References: bsc#1134813
+Subject: [PATCH 1/5] btrfs: add a helper to return a head ref
+
+Simplify the error handling in __btrfs_run_delayed_refs by breaking out
+the code used to return a head back to the delayed_refs tree for
+processing into a helper function.
+
+Signed-off-by: Josef Bacik <jbacik@fb.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+---
+ fs/btrfs/extent-tree.c | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -2492,6 +2492,16 @@ select_delayed_ref(struct btrfs_delayed_
+ return ref;
+ }
+
++static void unselect_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs,
++ struct btrfs_delayed_ref_head *head)
++{
++ spin_lock(&delayed_refs->lock);
++ head->processing = 0;
++ delayed_refs->num_heads_ready++;
++ spin_unlock(&delayed_refs->lock);
++ btrfs_delayed_ref_unlock(head);
++}
++
+ /*
+ * Returns 0 on success or if called with an already aborted transaction.
+ * Returns -ENOMEM or -EIO on failure and will abort the transaction.
+@@ -2566,11 +2576,7 @@ static noinline int __btrfs_run_delayed_
+ if (ref && ref->seq &&
+ btrfs_check_delayed_seq(fs_info, delayed_refs, ref->seq)) {
+ spin_unlock(&locked_ref->lock);
+- spin_lock(&delayed_refs->lock);
+- locked_ref->processing = 0;
+- delayed_refs->num_heads_ready++;
+- spin_unlock(&delayed_refs->lock);
+- btrfs_delayed_ref_unlock(locked_ref);
++ unselect_delayed_ref_head(delayed_refs, locked_ref);
+ locked_ref = NULL;
+ cond_resched();
+ count++;
+@@ -2616,10 +2622,8 @@ static noinline int __btrfs_run_delayed_
+ */
+ if (must_insert_reserved)
+ locked_ref->must_insert_reserved = 1;
+- spin_lock(&delayed_refs->lock);
+- locked_ref->processing = 0;
+- delayed_refs->num_heads_ready++;
+- spin_unlock(&delayed_refs->lock);
++ unselect_delayed_ref_head(delayed_refs,
++ locked_ref);
+ btrfs_debug(fs_info,
+ "run_delayed_extent_op returned %d",
+ ret);
+@@ -2681,11 +2685,7 @@ static noinline int __btrfs_run_delayed_
+
+ btrfs_free_delayed_extent_op(extent_op);
+ if (ret) {
+- spin_lock(&delayed_refs->lock);
+- locked_ref->processing = 0;
+- delayed_refs->num_heads_ready++;
+- spin_unlock(&delayed_refs->lock);
+- btrfs_delayed_ref_unlock(locked_ref);
++ unselect_delayed_ref_head(delayed_refs, locked_ref);
+ btrfs_put_delayed_ref(ref);
+ btrfs_debug(fs_info, "run_one_delayed_ref returned %d",
+ ret);
diff --git a/series.conf b/series.conf
index 45b91da2b5..003b3b2658 100644
--- a/series.conf
+++ b/series.conf
@@ -23302,6 +23302,7 @@
patches.suse/0008-btrfs-tree-checker-Enhance-output-for-check_csum_ite.patch
patches.suse/0009-btrfs-tree-checker-Enhance-output-for-check_extent_d.patch
patches.suse/0010-btrfs-tree-checker-use-zu-format-string-for-size_t.patch
+ patches.suse/0001-btrfs-add-a-helper-to-return-a-head-ref.patch
patches.suse/0020-btrfs-remove-type-argument-from-comp_tree_refs.patch
patches.suse/0016-btrfs-cleanup-extent-locking-sequence.patch
patches.suse/0017-Btrfs-rework-outstanding_extents.patch