--- /dev/null
+From dc95f7bfc57fa4b75a77d0da84d5db249d74aa3f Mon Sep 17 00:00:00 2001
+From: Josef Bacik <jbacik@fb.com>
+Date: Wed, 13 Jan 2016 11:48:06 -0500
+Subject: Btrfs: fix truncate_space_check
+
+From: Josef Bacik <jbacik@fb.com>
+
+commit dc95f7bfc57fa4b75a77d0da84d5db249d74aa3f upstream.
+
+truncate_space_check is using btrfs_csum_bytes_to_leaves() but forgetting to
+multiply by nodesize so we get an actual byte count. We need a tracepoint here
+so that we have the matching reserve for the release that will come later. Also
+add a comment to make clear what the intent of truncate_space_check is.
+
+Signed-off-by: Josef Bacik <jbacik@fb.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/inode.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -4211,11 +4211,20 @@ static int truncate_space_check(struct b
+ {
+ int ret;
+
++ /*
++ * This is only used to apply pressure to the enospc system, we don't
++ * intend to use this reservation at all.
++ */
+ bytes_deleted = btrfs_csum_bytes_to_leaves(root, bytes_deleted);
++ bytes_deleted *= root->nodesize;
+ ret = btrfs_block_rsv_add(root, &root->fs_info->trans_block_rsv,
+ bytes_deleted, BTRFS_RESERVE_NO_FLUSH);
+- if (!ret)
++ if (!ret) {
++ trace_btrfs_space_reservation(root->fs_info, "transaction",
++ trans->transid,
++ bytes_deleted, 1);
+ trans->bytes_reserved += bytes_deleted;
++ }
+ return ret;
+
+ }
--- /dev/null
+From 503785306d182ab624a2232856ef8ab503ee85f9 Mon Sep 17 00:00:00 2001
+From: Zhao Lei <zhaolei@cn.fujitsu.com>
+Date: Fri, 18 Dec 2015 21:33:05 +0800
+Subject: btrfs: reada: Fix in-segment calculation for reada
+
+From: Zhao Lei <zhaolei@cn.fujitsu.com>
+
+commit 503785306d182ab624a2232856ef8ab503ee85f9 upstream.
+
+reada_zone->end is end pos of segment:
+ end = start + cache->key.offset - 1;
+
+So we need to use "<=" in condition to judge is a pos in the
+segment.
+
+The problem happened rearly, because logical pos rarely pointed
+to last 4k of a blockgroup, but we need to fix it to make code
+right in logic.
+
+Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/reada.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/btrfs/reada.c
++++ b/fs/btrfs/reada.c
+@@ -265,7 +265,7 @@ static struct reada_zone *reada_find_zon
+ spin_unlock(&fs_info->reada_lock);
+
+ if (ret == 1) {
+- if (logical >= zone->start && logical < zone->end)
++ if (logical >= zone->start && logical <= zone->end)
+ return zone;
+ spin_lock(&fs_info->reada_lock);
+ kref_put(&zone->refcnt, reada_zone_release);
+@@ -679,7 +679,7 @@ static int reada_start_machine_dev(struc
+ */
+ ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
+ dev->reada_next >> PAGE_CACHE_SHIFT, 1);
+- if (ret == 0 || re->logical >= dev->reada_curr_zone->end) {
++ if (ret == 0 || re->logical > dev->reada_curr_zone->end) {
+ ret = reada_pick_zone(dev);
+ if (!ret) {
+ spin_unlock(&fs_info->reada_lock);
--- /dev/null
+From 11ea474f74709fc764fb7e80306e0776f94ce8b8 Mon Sep 17 00:00:00 2001
+From: David Sterba <dsterba@suse.com>
+Date: Thu, 11 Feb 2016 15:30:07 +0100
+Subject: btrfs: remove error message from search ioctl for nonexistent tree
+
+From: David Sterba <dsterba@suse.com>
+
+commit 11ea474f74709fc764fb7e80306e0776f94ce8b8 upstream.
+
+Let's remove the error message that appears when the tree_id is not
+present. This can happen with the quota tree and has been observed in
+practice. The applications are supposed to handle -ENOENT and we don't
+need to report that in the system log as it's not a fatal error.
+
+Reported-by: Vlastimil Babka <vbabka@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/ioctl.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -2097,8 +2097,6 @@ static noinline int search_ioctl(struct
+ key.offset = (u64)-1;
+ root = btrfs_read_fs_root_no_name(info, &key);
+ if (IS_ERR(root)) {
+- btrfs_err(info, "could not find root %llu",
+- sk->tree_id);
+ btrfs_free_path(path);
+ return -ENOENT;
+ }
drm-radeon-fix-dp-link-training-issue-with-second-4k-monitor.patch
drm-radeon-fix-dp-mode-validation.patch
drm-amdgpu-fix-dp-mode-validation.patch
+btrfs-reada-fix-in-segment-calculation-for-reada.patch
+btrfs-fix-truncate_space_check.patch
+btrfs-remove-error-message-from-search-ioctl-for-nonexistent-tree.patch