Skip to content

Commit

Permalink
Btrfs: try to free metadata pages when we free btree blocks
Browse files Browse the repository at this point in the history
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: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Mar 31, 2009
1 parent 5a3f23d commit d57e62b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,10 @@ static int __free_extent(struct btrfs_trans_handle *trans,
if (owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) {
ret = btrfs_del_csums(trans, root, bytenr, num_bytes);
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,
Expand Down

0 comments on commit d57e62b

Please sign in to comment.