Commit d57e62b8 authored by Chris Mason's avatar Chris Mason

Btrfs: try to free metadata pages when we free btree blocks

COW means we cycle though blocks fairly quickly, and once we
free an extent on disk, it doesn't make much sense to keep the pages around.

This commit tries to immediately free the page when we free the extent,
which lowers our memory footprint significantly.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 5a3f23d5
...@@ -2384,6 +2384,10 @@ static int __free_extent(struct btrfs_trans_handle *trans, ...@@ -2384,6 +2384,10 @@ static int __free_extent(struct btrfs_trans_handle *trans,
if (owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { if (owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) {
ret = btrfs_del_csums(trans, root, bytenr, num_bytes); ret = btrfs_del_csums(trans, root, bytenr, num_bytes);
BUG_ON(ret); BUG_ON(ret);
} else {
invalidate_mapping_pages(info->btree_inode->i_mapping,
bytenr >> PAGE_CACHE_SHIFT,
(bytenr + num_bytes - 1) >> PAGE_CACHE_SHIFT);
} }
ret = update_block_group(trans, root, bytenr, num_bytes, 0, ret = update_block_group(trans, root, bytenr, num_bytes, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment