diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-07-29 16:15:18 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | ab78c84de1ce4db1b2a2cef361625ad80abbab3f (patch) | |
tree | a9726645832b50da1da9a9690c4200c0f198ce7d /fs/btrfs/disk-io.c | |
parent | 1a3f5d0400d786aec41ede15fec5710ad1a1d18b (diff) |
Btrfs: Throttle operations if the reference cache gets too large
A large reference cache is directly related to a lot of work pending
for the cleaner thread. This throttles back new operations based on
the size of the reference cache so the cleaner thread will be able to keep
up.
Overall, this actually makes the FS faster because the cleaner thread will
be more likely to find things in cache.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index eccdf13a95ac..27ffa9b7ddc8 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1171,8 +1171,10 @@ static int transaction_kthread(void *arg) | |||
1171 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); | 1171 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); |
1172 | mutex_lock(&root->fs_info->transaction_kthread_mutex); | 1172 | mutex_lock(&root->fs_info->transaction_kthread_mutex); |
1173 | 1173 | ||
1174 | printk("btrfs: total reference cache size %Lu\n", | 1174 | if (root->fs_info->total_ref_cache_size > 20 * 1024 * 1024) { |
1175 | root->fs_info->total_ref_cache_size); | 1175 | printk("btrfs: total reference cache size %Lu\n", |
1176 | root->fs_info->total_ref_cache_size); | ||
1177 | } | ||
1176 | 1178 | ||
1177 | mutex_lock(&root->fs_info->trans_mutex); | 1179 | mutex_lock(&root->fs_info->trans_mutex); |
1178 | cur = root->fs_info->running_transaction; | 1180 | cur = root->fs_info->running_transaction; |
@@ -1256,6 +1258,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1256 | btrfs_mapping_init(&fs_info->mapping_tree); | 1258 | btrfs_mapping_init(&fs_info->mapping_tree); |
1257 | atomic_set(&fs_info->nr_async_submits, 0); | 1259 | atomic_set(&fs_info->nr_async_submits, 0); |
1258 | atomic_set(&fs_info->throttles, 0); | 1260 | atomic_set(&fs_info->throttles, 0); |
1261 | atomic_set(&fs_info->throttle_gen, 0); | ||
1259 | fs_info->sb = sb; | 1262 | fs_info->sb = sb; |
1260 | fs_info->max_extent = (u64)-1; | 1263 | fs_info->max_extent = (u64)-1; |
1261 | fs_info->max_inline = 8192 * 1024; | 1264 | fs_info->max_inline = 8192 * 1024; |