summaryrefslogtreecommitdiff
path: root/fs/btrfs/delayed-ref.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2017-06-06 16:45:29 -0700
committerDavid Sterba <dsterba@suse.com>2017-06-29 20:17:01 +0200
commit0a16c7d7aecfae8987197e50116ebfc338cbe0a2 (patch)
tree45e7f32dd3253b5604db57d0fe198e6cef81d750 /fs/btrfs/delayed-ref.c
parent4da8b76d347bcae951f89522a040c36d9fc9f3b3 (diff)
Btrfs: always account pinned bytes when dropping a tree block ref
Currently, we only increment total_bytes_pinned in btrfs_free_tree_block() when dropping the last reference on the block. However, when the delayed ref is run later, we will decrement total_bytes_pinned regardless of whether it was the last reference or not. This causes the counter to underflow when the reference we dropped was not the last reference. Fix it by incrementing the counter unconditionally, which is what btrfs_free_extent() does. This makes total_bytes_pinned an overestimate when references to shared extents are dropped, but in the worst case this will just make us try to commit the transaction to try to free up space and find we didn't free enough. Signed-off-by: Omar Sandoval <osandov@fb.com> Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
0 files changed, 0 insertions, 0 deletions