struct completion kobj_unregister;
int do_barriers;
int closing;
+ unsigned long throttles;
u64 total_pinned;
spinlock_t delalloc_lock;
fs_info->tree_root = tree_root;
fs_info->extent_root = extent_root;
fs_info->sb = sb;
+ fs_info->throttles = 0;
fs_info->mount_opt = 0;
fs_info->max_extent = (u64)-1;
fs_info->delalloc_bytes = 0;
set_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
}
+void btrfs_throttle(struct btrfs_root *root)
+{
+ if (root->fs_info->throttles)
+ congestion_wait(WRITE, HZ/10);
+}
+
void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)
{
balance_dirty_pages_ratelimited_nr(
int btrfs_read_buffer(struct extent_buffer *buf);
u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len);
void btrfs_csum_final(u32 crc, char *result);
+void btrfs_throttle(struct btrfs_root *root);
#endif
balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages);
if (num_pages < (root->leafsize >> PAGE_CACHE_SHIFT) + 1)
btrfs_btree_balance_dirty(root, 1);
+ btrfs_throttle(root);
cond_resched();
}
out:
fail:
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return ret;
}
fail:
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
if (ret && !err)
err = ret;
btrfs_end_transaction(trans, root);
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return;
no_delete_lock:
btrfs_end_transaction(trans, root);
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
no_delete:
clear_inode(inode);
}
iput(inode);
}
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return err;
}
iput(inode);
}
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return err;
}
iput(inode);
}
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return err;
}
if (drop_on_err)
iput(inode);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return err;
}
BUG_ON(ret);
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
}
static int noinline create_subvol(struct btrfs_root *root, char *name,
fail_commit:
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return ret;
}
fail_unlock:
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return ret;
}
iput(inode);
}
btrfs_btree_balance_dirty(root, nr);
+ btrfs_throttle(root);
return err;
}
num_bytes = btrfs_root_used(&dirty->root->root_item);
root = dirty->latest_root;
+ root->fs_info->throttles++;
while(1) {
trans = btrfs_start_transaction(tree_root, 1);
mutex_lock(&tree_root->fs_info->fs_mutex);
}
BUG_ON(ret);
+ root->fs_info->throttles--;
num_bytes -= btrfs_root_used(&dirty->root->root_item);
bytes_used = btrfs_root_used(&root->root_item);
u64 objectid = 0;
int ret;
+ root->fs_info->throttles++;
while(1) {
ret = btrfs_find_first_ordered_inode(
&cur_trans->ordered_inode_tree,
mutex_lock(&root->fs_info->fs_mutex);
mutex_lock(&root->fs_info->trans_mutex);
}
+ root->fs_info->throttles--;
return 0;
}