With the special dedup reference, in the case of (refs == 1) in 
__btrfs_free_extent,
we'll actually free the extent, so pinned_bytes of it should not be added to 
that
global counter.

Signed-off-by: Liu Bo <bo.li....@oracle.com>
---
 fs/btrfs/extent-tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1cb3ec5..b8fee86 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5915,9 +5915,6 @@ again:
                                goto out;
                        }
                }
-               add_pinned_bytes(root->fs_info, -num_bytes, owner_objectid,
-                                root_objectid);
-
                /*
                 * special case for dedup
                 *
@@ -5934,6 +5931,9 @@ again:
                        refs_to_drop = 1;
 
                        goto again;
+               } else {
+                       add_pinned_bytes(root->fs_info, -num_bytes,
+                                        owner_objectid, root_objectid);
                }
        } else {
                if (is_data && root_objectid == BTRFS_DEDUP_TREE_OBJECTID) {
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to