diff mbox

[v10,14/16] Btrfs: fix wrong pinned bytes in __btrfs_free_extent

Message ID 1397101727-20806-15-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State Under Review
Headers show

Commit Message

Liu Bo April 10, 2014, 3:48 a.m. UTC
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.liu@oracle.com>
---
 fs/btrfs/extent-tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

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) {