Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2019-05-15 14:59:29 +0800
committerQu Wenruo <wqu@suse.com>2019-05-15 14:59:29 +0800
commitf19a7abcc81bd378d2ee96d62b7e7f2e78a012e9 (patch)
tree3881fe967a55e18dd97b046c2366a92ce8a3c132
parent595997361a4d349a5c389b6332936d09fd4d8727 (diff)
btrfs: extent-tree: Use btrfs_ref to refactor
add_pinned_bytes() (bsc#1063638 bsc#1128052 bsc#1108838).
-rw-r--r--patches.suse/0006-btrfs-extent-tree-Use-btrfs_ref-to-refactor-add_pinn.patch70
-rw-r--r--series.conf1
2 files changed, 71 insertions, 0 deletions
diff --git a/patches.suse/0006-btrfs-extent-tree-Use-btrfs_ref-to-refactor-add_pinn.patch b/patches.suse/0006-btrfs-extent-tree-Use-btrfs_ref-to-refactor-add_pinn.patch
new file mode 100644
index 0000000000..7eaad9adcd
--- /dev/null
+++ b/patches.suse/0006-btrfs-extent-tree-Use-btrfs_ref-to-refactor-add_pinn.patch
@@ -0,0 +1,70 @@
+From ddf30cf03fb53b9a0ad0f355a69dbedf416edde9 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Thu, 4 Apr 2019 14:45:34 +0800
+Git-commit: ddf30cf03fb53b9a0ad0f355a69dbedf416edde9
+References: bsc#1063638 bsc#1128052 bsc#1108838
+Patch-mainline: v5.2-rc1
+Subject: [PATCH 6/9] btrfs: extent-tree: Use btrfs_ref to refactor
+ add_pinned_bytes()
+
+Since add_pinned_bytes() only needs to know if the extent is metadata
+and if it's a chunk tree extent, btrfs_ref is a perfect match for it, as
+we don't need various owner/level trick to determine extent type.
+
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: Nikolay Borisov <nborisov@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+---
+ fs/btrfs/extent-tree.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -767,14 +767,15 @@ static struct btrfs_space_info *__find_s
+ return NULL;
+ }
+
+-static void add_pinned_bytes(struct btrfs_fs_info *fs_info, s64 num_bytes,
+- u64 owner, u64 root_objectid)
++static void add_pinned_bytes(struct btrfs_fs_info *fs_info,
++ struct btrfs_ref *ref)
+ {
+ struct btrfs_space_info *space_info;
++ s64 num_bytes = -ref->len;
+ u64 flags;
+
+- if (owner < BTRFS_FIRST_FREE_OBJECTID) {
+- if (root_objectid == BTRFS_CHUNK_TREE_OBJECTID)
++ if (ref->type == BTRFS_REF_METADATA) {
++ if (ref->tree_ref.root == BTRFS_CHUNK_TREE_OBJECTID)
+ flags = BTRFS_BLOCK_GROUP_SYSTEM;
+ else
+ flags = BTRFS_BLOCK_GROUP_METADATA;
+@@ -2134,7 +2135,7 @@ int btrfs_inc_extent_ref(struct btrfs_tr
+ }
+
+ if (ret == 0 && old_ref_mod < 0 && new_ref_mod >= 0)
+- add_pinned_bytes(fs_info, -num_bytes, owner, root_objectid);
++ add_pinned_bytes(fs_info, &generic_ref);
+
+ return ret;
+ }
+@@ -7167,8 +7168,7 @@ void btrfs_free_tree_block(struct btrfs_
+ }
+ out:
+ if (pin)
+- add_pinned_bytes(fs_info, buf->len, btrfs_header_level(buf),
+- root->root_key.objectid);
++ add_pinned_bytes(fs_info, &generic_ref);
+
+ if (last_ref) {
+ /*
+@@ -7217,7 +7217,7 @@ int btrfs_free_extent(struct btrfs_trans
+ }
+
+ if (ret == 0 && old_ref_mod >= 0 && new_ref_mod < 0)
+- add_pinned_bytes(fs_info, num_bytes, owner, root_objectid);
++ add_pinned_bytes(fs_info, &generic_ref);
+
+ return ret;
+ }
diff --git a/series.conf b/series.conf
index 0b8d497c2f..352380fe33 100644
--- a/series.conf
+++ b/series.conf
@@ -21789,6 +21789,7 @@
patches.suse/0002-btrfs-extent-tree-Open-code-process_func-in-__btrfs_.patch
patches.suse/0003-btrfs-delayed-ref-Use-btrfs_ref-to-refactor-btrfs_ad.patch
patches.suse/0004-btrfs-delayed-ref-Use-btrfs_ref-to-refactor-btrfs_ad.patch
+ patches.suse/0006-btrfs-extent-tree-Use-btrfs_ref-to-refactor-add_pinn.patch
patches.drivers/mmc-core-fix-possible-use-after-free-of-host.patch
patches.drivers/phy-sun4i-usb-Make-sure-to-disable-PHY0-passby-for-p.patch
patches.drivers/stm-class-Fix-channel-free-in-stm-output-free-path.patch