[PATCH v3 10/10] btrfs: add NR_METADATA_BYTES accounting

Josef Bacik
2017-12-11T21:55:55Z

From: Josef Bacik <jbacik@fb.com>

Now that we have these counters, account for the private pages we
allocate in NR_METADATA_BYTES.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
fs/btrfs/extent_io.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index e11372455fb0..7536352f424d 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4802,6 +4802,8 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb)
ClearPagePrivate(page);
set_page_private(page, 0);

+ mod_node_page_state(page_pgdat(page), NR_METADATA_BYTES,
+ -(long)PAGE_SIZE);
/* Once for the page private. */
put_page(page);

@@ -5081,6 +5083,8 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
goto free_eb;
}
attach_extent_buffer_page(eb, p);
+ mod_node_page_state(page_pgdat(p), NR_METADATA_BYTES,
+ PAGE_SIZE);
eb->pages[i] = p;
}
again:
--
2.7.5