Commit 585ad2c3 authored by Chris Mason's avatar Chris Mason

Btrfs: fix metadata dirty throttling limits

Once a metadata block has been written, it must be recowed, so the
btrfs dirty balancing call has a check to make sure a fair amount of metadata
was actually dirty before it started writing it back to disk.

A previous commit had changed the dirty tracking for metadata without
updating the btrfs dirty balancing checks.  This commit switches it
to use the correct counter.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 2c943de6
...@@ -2378,17 +2378,14 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) ...@@ -2378,17 +2378,14 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
* looks as though older kernels can get into trouble with * looks as though older kernels can get into trouble with
* this code, they end up stuck in balance_dirty_pages forever * this code, they end up stuck in balance_dirty_pages forever
*/ */
struct extent_io_tree *tree;
u64 num_dirty; u64 num_dirty;
u64 start = 0;
unsigned long thresh = 32 * 1024 * 1024; unsigned long thresh = 32 * 1024 * 1024;
tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;
if (current->flags & PF_MEMALLOC) if (current->flags & PF_MEMALLOC)
return; return;
num_dirty = count_range_bits(tree, &start, (u64)-1, num_dirty = root->fs_info->dirty_metadata_bytes;
thresh, EXTENT_DIRTY);
if (num_dirty > thresh) { if (num_dirty > thresh) {
balance_dirty_pages_ratelimited_nr( balance_dirty_pages_ratelimited_nr(
root->fs_info->btree_inode->i_mapping, 1); root->fs_info->btree_inode->i_mapping, 1);
......
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